Skip to content

Kf1.9(jupyter): fix i18n #353

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
Apr 1, 2025
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20,969 changes: 9,466 additions & 11,503 deletions frontend/common/kubeflow-common-lib/package-lock.json

Large diffs are not rendered by default.

5 changes: 4 additions & 1 deletion frontend/common/kubeflow-common-lib/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,9 @@
"http-proxy-middleware": "2.0.7",
"webpack-dev-middleware": "6.1.2",
"undici": "6.21.1",
"webpack": "5.94.0"
"webpack": "5.94.0",
"@babel/runtime": "7.26.10",
"esbuild": "0.25.1",
"vite": "5.4"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export function generateConfig(): TableConfig {
theme: TABLE_THEME.FLAT,
columns: [
{
matHeaderCellDef: 'Status',
matHeaderCellDef: $localize`Status`,
matColumnDef: 'status',
style: { width: '40px' },
value: new StatusValue({
Expand All @@ -23,7 +23,7 @@ export function generateConfig(): TableConfig {
sort: true,
},
{
matHeaderCellDef: 'Type',
matHeaderCellDef: $localize`Type`,
matColumnDef: 'type',
style: { width: '150px' },
value: new PropertyValue({
Expand All @@ -32,7 +32,7 @@ export function generateConfig(): TableConfig {
sort: true,
},
{
matHeaderCellDef: 'Last Transition Time',
matHeaderCellDef: $localize`Last Transition Time`,
matColumnDef: 'lastTransitionTime',
style: { width: '150px' },
value: new DateTimeValue({
Expand All @@ -41,7 +41,7 @@ export function generateConfig(): TableConfig {
sort: true,
},
{
matHeaderCellDef: 'Reason',
matHeaderCellDef: $localize`Reason`,
matColumnDef: 'reason',
style: { width: '150px' },
value: new PropertyValue({
Expand All @@ -50,7 +50,7 @@ export function generateConfig(): TableConfig {
sort: true,
},
{
matHeaderCellDef: 'Message',
matHeaderCellDef: $localize`Message`,
matColumnDef: 'message',
style: { width: '150px' },
value: new PropertyValue({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export class ContentListItemComponent {
@Input() topDivider = false;
@Input() bottomDivider = true;
@Input() keyMinWidth = '250px';
@Input() loadErrorMsg = 'Resources not available';
@Input() loadErrorMsg = $localize`Resources not available`;

constructor() {}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export class DetailsListItemComponent {
if (!this.copyValue) {
const configWarning: SnackBarConfig = {
data: {
msg: 'No value to copy to clipboard',
msg: $localize`No value to copy to clipboard`,
snackType: SnackType.Warning,
},
duration: 2000,
Expand All @@ -41,7 +41,7 @@ export class DetailsListItemComponent {

const configInfo: SnackBarConfig = {
data: {
msg: 'Content copied to clipboard',
msg: $localize`Content copied to clipboard`,
snackType: SnackType.Info,
},
duration: 2000,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<div
class="threadline"
(click)="toggleClicked()"
matTooltip="Hide"
matTooltip="Hide this section"
i18n-matTooltip
matTooltipPosition="right"
></div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
<mat-form-field class="wide" appearance="outline">
<mat-label i18n>Name</mat-label>
<input matInput placeholder="Name" [formControl]="nameControl" />
<input
matInput
placeholder="Name"
[formControl]="nameControl"
i18n-placeholder
/>
<mat-error>{{ nameError() }}</mat-error>
</mat-form-field>
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
<a href="{{ link }}" target="_blank" style="text-decoration: none">
{{ linkText }}
</a>
<p *ngIf="readOnly">*The cluster admin has disabled setting this section!</p>
<p *ngIf="readOnly" i18n>
*The cluster admin has disabled setting this section!
</p>
<ng-content></ng-content>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,10 @@
<a href="{{ link }}" target="_blank" style="text-decoration: none">
{{ linkText }}
</a>
<!--need to check if this change messes with the other things, else just restore old file-->
<p *ngIf="readOnly">*The cluster admin has disabled setting this section!</p>
<!--need to check if this change messes with the other things or just restore old file-->
<p *ngIf="readOnly" i18n>
*The cluster admin has disabled setting this section!
</p>

<ng-content></ng-content>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
(click)="create.emit(true)"
[disabled]="createDisabled"
data-cy-submit-bar-create
i18n
>
CREATE
</button>
Expand All @@ -20,22 +21,28 @@
>
<div class="waiting-button-wrapper">
<mat-spinner diameter="16"></mat-spinner>
<div>CREATING</div>
<div i18n>CREATING</div>
</div>
</button>

<button
mat-raised-button
(click)="cancel.emit(true)"
data-cy-submit-bar-cancel
i18n
>
CANCEL
</button>

<div class="flex text-area" *ngIf="allowYAMLEditing">
<button class="btn-link" (click)="yaml.emit(true)" data-cy-submit-bar-edit>
<button
class="btn-link"
(click)="yaml.emit(true)"
data-cy-submit-bar-edit
i18n
>
Edit
</button>
<span> and submit YAML</span>
<span i18n> and submit YAML</span>
</div>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export function updateNonDirtyControl(control: AbstractControl, value: any) {
export function updateControlNonNullValue(
control: AbstractControl,
value: any,
msg = 'Can not update control with value null',
msg = $localize`Can not update control with value null`,
) {
if (value === null) {
console.warn(msg);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ export const dns1123Validator: IValidator = {
regex: '^' + dns1123LabelFmt + '(\\.' + dns1123LabelFmt + ')*' + '$',
help:
// prettier-ignore
'Name must consist of lowercase alphanumeric characters or \'-\', and"' +
' must start and end with an alphanumeric character',
$localize `Name must consist of lowercase alphanumeric characters or '-',
and must start and end with an alphanumeric character`,
};

// TODO(kimwnasptd): We only use this validator, do we need the others?
Expand All @@ -30,12 +30,11 @@ export const dns1035Validator: IValidator = {
help: $localize`Name must consist of lowercase alphanumeric characters or '-',
start with an alphabetic character, and end with an alphanumeric character.`,
};

// aaw verify if i18n works
export const volSizeValidator: IValidator = {
regex: '^[0-9]+(E|Ei|P|Pi|T|Ti|G|Gi|M|Mi|K|Ki)?$',
help:
'Invalid volume size: Should be an integer, or integer followed ' +
'by a valid unit',
help: $localize`Invalid volume size: Should be an integer,
or integer followed by a valid unit`,
};

export const memoryValidator: IValidator = {
Expand All @@ -45,17 +44,14 @@ export const memoryValidator: IValidator = {
'|' +
'(E|Ei|P|Pi|T|Ti|G|Gi|M|Mi|K|Ki)' +
')?$',
help:
'Invalid memory size: Should be an integer, or fixed-point integer' +
' followed by a valid unit',
help: $localize`Invalid memory size: Should be an integer,
or fixed-point integer followed by a valid unit`,
};

export const cpuValidator: IValidator = {
regex: '^[0-9]*(m|[.][0-9]+)?$',
help:
'Invalid cpu limit: Should be a fixed-point integer or an integer ' +
// prettier-ignore
'followed by \'m\'',
help: $localize`Invalid cpu limit: Should be a fixed-point
integer or an integer followed by 'm'`,
};

export const DEBOUNCE_TIME = 500;
Expand Down Expand Up @@ -95,7 +91,7 @@ export const MAX_NAME_LENGTH = 50;

export function getNameError(nameCtrl: AbstractControl, resource: string) {
if (nameCtrl.hasError('existingName')) {
return `${resource} "${nameCtrl.value}" already exists`;
return `${resource} "${nameCtrl.value}"` + $localize` already exists`;
} else if (nameCtrl.hasError('pattern')) {
// TODO: "pattern", is generic error, this might break in the future
return dns1035Validator.help;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export class ChipsListValue {

private defaultValues: ChipsListConfig = {
field: '',
noValueText: 'No items',
noValueText: $localize`No items`,
maxVisibleChips: 3,
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ export class BackendService {
return error.message;
}

return `Unexpected error encountered`;
return $localize`Unexpected error encountered`;
}

public getSnackErrorMessage(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export class VariablesGroupsTableComponent {
get envGroups() {
return this.prvEnvGroups;
}
@Input() loadErrorMsg = 'Resources not available';
@Input() loadErrorMsg = $localize`Resources not available`;
@Input() loadCompleted = false;

envGroupsEmpty(): boolean {
Expand Down
10 changes: 2 additions & 8 deletions frontend/jupyter/cypress/e2e/notebook-details-page.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,10 @@ describe('Notebook Details Page', () => {
'lib-details-list-item[key="Type"] > .list-entry-row > .list-entry-value > div',
).should('have.text', ' JupyterLab\n');
cy.get(
'lib-details-list-item[key="Minimum CPU"] > .list-entry-row > .list-entry-value > div',
'lib-details-list-item[key="Requested CPU"] > .list-entry-row > .list-entry-value > div',
).should('have.text', ' 500m\n');
cy.get(
'lib-details-list-item[key="Maximum CPU"] > .list-entry-row > .list-entry-value > div',
).should('have.text', ' 500m\n');
cy.get(
'lib-details-list-item[key="Minimum memory"] > .list-entry-row > .list-entry-value > div',
).should('have.text', ' 2Gi\n');
cy.get(
'lib-details-list-item[key="Maximum memory"] > .list-entry-row > .list-entry-value > div',
'lib-details-list-item[key="Requested memory"] > .list-entry-row > .list-entry-value > div',
).should('have.text', ' 2Gi\n');
cy.get(
'lib-details-list-item[key="Image"] > .list-entry-row > .list-entry-value > div',
Expand Down
Loading
Loading