Skip to content
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

Update 1.6 translation files #166

Merged
merged 8 commits into from
Oct 18, 2022
Merged
Show file tree
Hide file tree
Changes from all 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
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { Injectable } from '@angular/core';
import { MatPaginatorIntl } from '@angular/material/paginator';

//Custom Paginator to allow for internalization
@Injectable()
export class PaginatorIntlComponent extends MatPaginatorIntl {
itemsPerPageLabel = $localize`Items per page:`;
nextPageLabel = $localize`Next page`;
previousPageLabel = $localize`Previous page`;
firstPageLabel = $localize`First page`;
lastPageLabel = $localize`Last page`;

getRangeLabel=(page: number, pageSize: number, length: number) => {
if(length === 0 || pageSize === 0){
return $localize`0 of ${length}`
}

length = Math.max(length, 0);
const startIndex = page*pageSize;
const endIndex = startIndex < length ? Math.min(startIndex+pageSize, length) : startIndex+pageSize;

return $localize`${startIndex+1} - ${endIndex} of ${length}`;
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ import { MatDividerModule } from '@angular/material/divider';
import { MatIconModule } from '@angular/material/icon';
import { MatMenuModule } from '@angular/material/menu';
import { MatTableModule } from '@angular/material/table';
import { MatPaginatorModule } from '@angular/material/paginator';
import { MatPaginatorModule, MatPaginatorIntl } from '@angular/material/paginator';
import { PaginatorIntlComponent } from './paginator/paginator.component';
import { StatusComponent } from './status/status.component';
import { MatTooltipModule } from '@angular/material/tooltip';
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
Expand Down Expand Up @@ -54,5 +55,6 @@ import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
ComponentValueComponent,
],
exports: [ResourceTableComponent, TableComponent],
providers: [{provide: MatPaginatorIntl, useClass: PaginatorIntlComponent}],
})
export class ResourceTableModule {}
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,5 @@ export interface Status {
phase: string;
state: string;
message: string;
key: string;
}
838 changes: 674 additions & 164 deletions frontend/jupyter/i18n/fr/messages.fr.xlf

Large diffs are not rendered by default.

746 changes: 603 additions & 143 deletions frontend/jupyter/i18n/messages.xlf

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
title="Configurations"
i18n-title
text="Extra layers of configurations that will be applied to the new Notebook. (e.g. Insert credentials as Secrets, set Environment Variables.)"
i18n-text
icon="fa:fas:sliders-h"
>
<mat-form-field class="wide" appearance="outline">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,9 @@
<div class="row" [formGroup]="parentForm">
<!--CPU AAW, do not take their lib-positive-input -->
<mat-form-field appearance="outline" class="column">
<mat-label>CPU Request</mat-label>
<mat-label i18n>Requested CPUs</mat-label>
<input
[attr.disabled]="readonlySpecs ? '' : null"
label="Requested CPUs"
i18n-label
matInput
formControlName="cpu"
[errorStateMatcher]="parentErrorKeysErrorStateMatcher('maxCpu')"
Expand All @@ -22,13 +20,11 @@

<!--RAM AAW, do not take their lib-positive-input-->
<mat-form-field appearance="outline" class="column">
<mat-label>Memory requests</mat-label>
<mat-label i18n>Requested memory in Gi</mat-label>
<input
[attr.disabled]="readonlySpecs ? '' : null"
matInput
i18n-label
formControlName="memory"
label="Requested memory in Gi"
[errorStateMatcher]="parentErrorKeysErrorStateMatcher('maxRam')"
/>
<mat-error>{{getRAMLimitError()}}</mat-error>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
title="New notebook"
[backButton]="true"
(back)="onCancel()"
i18n-title
>
</lib-title-actions-toolbar>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
{{ v }}
</mat-option>
</mat-select>
<mat-hint i18n>{{ message }}</mat-hint>
<mat-hint>{{ message }}</mat-hint>
</mat-form-field>

<!--GPUs Vendor-->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export class FormGpusComponent implements OnInit {
this.message = "";
this.gpuCtrl.get('vendor').disable();
} else {
this.message = "Selecting 1 GPU will automatically set 4 CPUs and 96Gi of memory.";
this.message = $localize`Selecting 1 GPU will automatically set 4 CPUs and 96Gi of memory.`;
this.gpuCtrl.get('vendor').enable();
}
this.gpuValueEvent.emit(n);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
linkText="Here's some more information to help you select an image for your requirements."
icon="fa:fab:docker"
i18n-title
i18n-text
i18n-linkText
>
<div class="flex-column">
<mat-checkbox
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<mat-checkbox [formControl]="pvcGroup.get('readOnly')">Readonly</mat-checkbox>
<mat-checkbox [formControl]="pvcGroup.get('readOnly')">ReadOnly</mat-checkbox>

<mat-form-field appearance="outline" class="wide">
<mat-label i18n>Name</mat-label>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -253,17 +253,40 @@ export class IndexDefaultComponent implements OnInit, OnDestroy {
);

notebook.status.phase = STATUS_TYPE.TERMINATING;
notebook.status.message = 'Preparing to stop the Notebook Server...';
notebook.status.message = $localize`Preparing to stop the Notebook Server...`;
this.updateNotebookFields(notebook);
});
});
}

//gets internationalized status messageks based on status key message values from backend
getStatusMessage(notebook: NotebookProcessedObject) {
switch(notebook.status.key){
case "notebookDeleting":
return $localize`Deleting this notebook server`;
case "noPodsRunning":
return $localize`No Pods are currently running for this Notebook Server`;
case "notebookStopping":
return $localize`Notebook Server is stopping`;
case "running":
return $localize`Running`;
case "waitingStatus":
return $localize`Current status is waiting. Check 'kubectl describe pod' for more information`;
case "errorEvent":
return $localize`An error has occured. Check 'kubectl describe pod' for more information`;
case "schedulingPod":
return $localize`Scheduling the Pod`;
default:
return "";
}
}

// Data processing functions
updateNotebookFields(notebook: NotebookProcessedObject) {
notebook.deleteAction = this.processDeletionActionStatus(notebook);
notebook.connectAction = this.processConnectActionStatus(notebook);
notebook.startStopAction = this.processStartStopActionStatus(notebook);
notebook.status.message = this.getStatusMessage(notebook);
}

processIncomingData(notebooks: NotebookResponseObject[]) {
Expand Down Expand Up @@ -333,11 +356,11 @@ export class IndexDefaultComponent implements OnInit, OnDestroy {
if(mounts[element.name]){
element.usedBy = mounts[element.name].name;
element.status = {} as Status;
element.status.message = "Attached";
element.status.message = $localize`Attached`;
element.status.phase = STATUS_TYPE.MOUNTED;
} else {
element.status = {} as Status;
element.status.message = "Unattached";
element.status.message = $localize`Unattached`;
element.status.phase = STATUS_TYPE.UNMOUNTED;
}
});
Expand Down
6 changes: 3 additions & 3 deletions frontend/jupyter/src/app/shared/utils/volumes/panel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ function getVolumeType(pvc: V1PersistentVolumeClaim): NEW_VOLUME_TYPE {
}

export function getVolumeTitle(vol: Volume) {
return vol.existingSource ? 'Existing volume' : 'New volume';
return vol.existingSource ? $localize`Existing volume` : $localize`New volume`;
}

export function getVolumeName(vol: Volume): string {
Expand All @@ -45,7 +45,7 @@ export function getVolumeName(vol: Volume): string {
if (vol.existingSource) {
const source = vol.existingSource;
if (!source.persistentVolumeClaim) {
return 'Custom (Advanced)';
return $localize`Custom (Advanced)`;
}

name = source.persistentVolumeClaim.claimName;
Expand Down Expand Up @@ -98,7 +98,7 @@ function getExistingVolumeDesc(vol: Volume): string {

const source = vol.existingSource;
if (!source.persistentVolumeClaim) {
return 'Custom (Advanced)';
return $localize`Custom (Advanced)`;
}

const name = source.persistentVolumeClaim.claimName;
Expand Down
43 changes: 8 additions & 35 deletions notebooks.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,18 +120,12 @@ type updatenotebookrequest struct {
// notebookPhase is the phase of a notebook.
type notebookPhase string

// KeyType is the type of key
type KeyType struct {
Key string
Params []string
}

// status represents the status of a notebook.
type status struct {
Message string `json:"message"`
Phase notebookPhase `json:"phase"`
State string `json:"state"`
Key KeyType `json:"key"`
Key string `json:"key"`
}

const (
Expand Down Expand Up @@ -167,10 +161,7 @@ func processStatus(notebook *kubeflowv1.Notebook, events []*corev1.Event) status
return status{
Message: "Deleting this Notebook Server.",
Phase: NotebookPhaseTerminating,
Key: KeyType{
Key: "jupyter.backend.status.notebookDeleting",
Params: []string{},
},
Key: "notebookDeleting",
}
}

Expand All @@ -180,20 +171,14 @@ func processStatus(notebook *kubeflowv1.Notebook, events []*corev1.Event) status
return status{
Message: "No pods are currently running for this Notebook Server.",
Phase: NotebookPhaseStopped,
Key: KeyType{
Key: "jupyter.backend.status.noPodsRunning",
Params: []string{},
},
Key: "noPodsRunning",
}
}

return status{
Message: "Notebook Server is stopping.",
Phase: NotebookPhaseTerminating,
Key: KeyType{
Key: "jupyter.backend.status.notebookStopping",
Params: []string{},
},
Key: "notebookStopping",
}
}

Expand All @@ -204,21 +189,15 @@ func processStatus(notebook *kubeflowv1.Notebook, events []*corev1.Event) status
return status{
Message: "Running",
Phase: NotebookPhaseReady,
Key: KeyType{
Key: "jupyter.backend.status.running",
Params: []string{},
},
Key: "running",
}
}

if state.Waiting != nil {
return status{
Message: state.Waiting.Reason,
Phase: NotebookPhaseWaiting,
Key: KeyType{
Key: "jupyter.backend.status.waitingStatus",
Params: []string{},
},
Key: "waitingStatus",
}
}

Expand All @@ -228,21 +207,15 @@ func processStatus(notebook *kubeflowv1.Notebook, events []*corev1.Event) status
return status{
Message: event.Reason,
Phase: NotebookPhaseWarning,
Key: KeyType{
Key: "jupyter.backend.status.errorEvent",
Params: []string{},
},
Key: "errorEvent",
}
}
}

return status{
Message: "Scheduling the Pod",
Phase: NotebookPhaseWaiting,
Key: KeyType{
Key: "jupyter.backend.status.schedulingPod",
Params: []string{},
},
Key: "schedulingPod",
}
}

Expand Down