Skip to content

Commit 298764e

Browse files
committed
feat(FR-1286): replace hardcoded strings with translations in React components (#4299)
resolves #4300 ([FR-1286](https://lablup.atlassian.net/browse/FR-1286)) ## Internationalize status labels This PR replaces hardcoded status labels with their translated equivalents across multiple components: - ResourceGroupList: Use translated "Active" and "Inactive" labels - UserCredentialList: Use translated "Active" and "Inactive" labels - UserNodeList: Use translated "Active" and "Inactive" labels - UserSettingModal: Replace static userStatus object with direct translation references - ComputeSessionListPage: Use translated "Running" and "Finished" labels - ServingPage: Use translated "Active" and "Destroyed" labels Added translation keys to all language files for: - "BeforeVerification" and "Deleted" in credential namespace - "Active" and "Inactive" in general namespace - "Active" and "Destroyed" in modelService namespace **Checklist:** - [ ] Documentation - [ ] Minium required manager version - [ ] Specific setting for review (eg., KB link, endpoint or how to setup) - [ ] Minimum requirements to check during review - [ ] Test case(s) to demonstrate the difference of before/after [FR-1286]: https://lablup.atlassian.net/browse/FR-1286?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
1 parent 160c5e5 commit 298764e

27 files changed

+155
-27
lines changed

react/src/components/ResourceGroupList.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -286,11 +286,11 @@ const ResourceGroupList: React.FC = () => {
286286
optionType="button"
287287
options={[
288288
{
289-
label: 'Active',
289+
label: t('general.Active'),
290290
value: 'active',
291291
},
292292
{
293-
label: 'Inactive',
293+
label: t('general.Inactive'),
294294
value: 'inactive',
295295
},
296296
]}

react/src/components/UserCredentialList.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,11 +179,11 @@ const UserCredentialList: React.FC = () => {
179179
optionType="button"
180180
options={[
181181
{
182-
label: 'Active',
182+
label: t('general.Active'),
183183
value: 'active',
184184
},
185185
{
186-
label: 'Inactive',
186+
label: t('general.Inactive'),
187187
value: 'inactive',
188188
},
189189
]}

react/src/components/UserNodeList.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,11 +160,11 @@ const UserNodeList: React.FC<UserNodeListProps> = () => {
160160
optionType="button"
161161
options={[
162162
{
163-
label: 'Active',
163+
label: t('general.Active'),
164164
value: 'active',
165165
},
166166
{
167-
label: 'Inactive',
167+
label: t('general.Inactive'),
168168
value: 'inactive',
169169
},
170170
]}

react/src/components/UserSettingModal.tsx

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -35,16 +35,6 @@ import React, { useRef } from 'react';
3535
import { useTranslation } from 'react-i18next';
3636
import { graphql, useMutation, useLazyLoadQuery } from 'react-relay';
3737

38-
type UserStatus = {
39-
[key: string]: string;
40-
};
41-
const userStatus: UserStatus = {
42-
active: 'Active',
43-
inactive: 'Inactive',
44-
'before-verification': 'Before Verification',
45-
deleted: 'Deleted',
46-
};
47-
4838
type UserRole = {
4939
[key: string]: string[];
5040
};
@@ -396,12 +386,24 @@ const UserSettingModal: React.FC<UserSettingModalProps> = ({
396386
</Form.Item>
397387
<Form.Item name="status" label={t('credential.UserStatus')}>
398388
<Select
399-
options={_.map(userStatus, (value, key) => {
400-
return {
401-
value: key,
402-
label: value,
403-
};
404-
})}
389+
options={[
390+
{
391+
value: 'active',
392+
label: t('general.Active'),
393+
},
394+
{
395+
value: 'inactive',
396+
label: t('general.Inactive'),
397+
},
398+
{
399+
value: 'before-verification',
400+
label: t('credential.BeforeVerification'),
401+
},
402+
{
403+
value: 'deleted',
404+
label: t('credential.Deleted'),
405+
},
406+
]}
405407
/>
406408
</Form.Item>
407409
{!!currentUserRole &&

react/src/pages/ComputeSessionListPage.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -457,11 +457,11 @@ const ComputeSessionListPage = () => {
457457
}}
458458
options={[
459459
{
460-
label: 'Running',
460+
label: t('session.Running'),
461461
value: 'running',
462462
},
463463
{
464-
label: 'Finished',
464+
label: t('session.Finished'),
465465
value: 'finished',
466466
},
467467
]}

react/src/pages/ServingPage.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,11 +151,11 @@ const ServingPage: React.FC = () => {
151151
buttonStyle="solid"
152152
options={[
153153
{
154-
label: 'Active',
154+
label: t('modelService.Active'),
155155
value: 'active',
156156
},
157157
{
158-
label: 'Destroyed',
158+
label: t('modelService.Destroyed'),
159159
value: 'destroyed',
160160
},
161161
]}

resources/i18n/de.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@
140140
"AdminCanOnlyRemoveTotp": "Es ist nur möglich, 2FA für andere Benutzer zu deaktivieren.",
141141
"Allocation": "Zuweisung",
142142
"Association": "Verband",
143+
"BeforeVerification": "Vor Überprüfung",
143144
"ConcurrentSessions": "Gleichzeitige Sitzungen",
144145
"Create": "Erstellen",
145146
"CreatePolicy": "Richtlinie erstellen",
@@ -153,6 +154,7 @@
153154
"DeactivateCredential": "Anmeldeinformationen deaktivieren",
154155
"DeactivateUser": "Benutzer deaktivieren",
155156
"DeleteCredential": "Anmeldedaten löschen",
157+
"Deleted": "Gelöscht",
156158
"DescActiveUser": "Aktiver Nutzer?",
157159
"DescRequirePasswordChange": "Passwortänderung erforderlich?",
158160
"Description": "Beschreibung",
@@ -645,6 +647,7 @@
645647
},
646648
"general": {
647649
"AccessKey": "Zugangsschlüssel",
650+
"Active": "Aktiv",
648651
"Add": "Hinzufügen",
649652
"Advanced": "Fortgeschritten",
650653
"All": "Alle",
@@ -662,6 +665,7 @@
662665
"General": "Allgemein",
663666
"Image": "Bild",
664667
"InProgress": "In Arbeit",
668+
"Inactive": "Inaktiv",
665669
"InvalidJSONFormat": "Ungültiges JSON-Format.",
666670
"LastUpdated": "Zuletzt aktualisiert",
667671
"Manual": "Handbuch",
@@ -901,6 +905,7 @@
901905
"64chars": "(maximal 64 Zeichen)"
902906
},
903907
"modelService": {
908+
"Active": "Aktiv",
904909
"Active/Total": "Aktiv/Gesamt",
905910
"AddRules": "Fügen Sie Regeln hinzu",
906911
"AdditionalMounts": "Zusätzliche Halterungen",
@@ -914,6 +919,7 @@
914919
"CreatedAt": "Erstellt am",
915920
"CurrentTime": "Aktuelle Uhrzeit",
916921
"DesiredSessionCount": "Gewünschte Anzahl von Sitzungen",
922+
"Destroyed": "Zerstört",
917923
"EditModelService": "Modelldienst bearbeiten",
918924
"EndpointId": "Endpunkt-ID",
919925
"EndpointName": "Endpunkt Name",

resources/i18n/el.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@
140140
"AdminCanOnlyRemoveTotp": "Είναι δυνατή μόνο η απενεργοποίηση της 2FA άλλων χρηστών.",
141141
"Allocation": "Κατανομή",
142142
"Association": "Σχέση",
143+
"BeforeVerification": "Πριν από την επαλήθευση",
143144
"ConcurrentSessions": "Ταυτόχρονες συνεδρίες",
144145
"Create": "Δημιουργώ",
145146
"CreatePolicy": "Δημιουργία πολιτικής",
@@ -153,6 +154,7 @@
153154
"DeactivateCredential": "Απενεργοποίηση διαπιστευτηρίων",
154155
"DeactivateUser": "Απενεργοποίηση χρήστη",
155156
"DeleteCredential": "Διαγραφή διαπιστευτηρίων",
157+
"Deleted": "Διαγραμμένος",
156158
"DescActiveUser": "Ενεργός χρήστης;",
157159
"DescRequirePasswordChange": "Απαιτείται αλλαγή κωδικού πρόσβασης;",
158160
"Description": "Περιγραφή",
@@ -641,6 +643,7 @@
641643
},
642644
"general": {
643645
"AccessKey": "Κλειδί πρόσβασης",
646+
"Active": "Ενεργός",
644647
"Add": "Προσθήκη",
645648
"Advanced": "Προχωρημένος",
646649
"All": "Όλα",
@@ -658,6 +661,7 @@
658661
"General": "Γενικά",
659662
"Image": "Εικόνα",
660663
"InProgress": "Σε εξέλιξη",
664+
"Inactive": "Αδρανής",
661665
"InvalidJSONFormat": "Μη έγκυρη μορφή JSON.",
662666
"LastUpdated": "Τελευταία ενημέρωση",
663667
"Manual": "Χειροκίνητο",
@@ -897,6 +901,7 @@
897901
"64chars": "(έως 64 χαρακτήρες)"
898902
},
899903
"modelService": {
904+
"Active": "Ενεργός",
900905
"Active/Total": "Ενεργό/Σύνολο",
901906
"AddRules": "Προσθέστε κανόνες",
902907
"AdditionalMounts": "Πρόσθετες βάσεις",
@@ -910,6 +915,7 @@
910915
"CreatedAt": "Δημιουργήθηκε στο",
911916
"CurrentTime": "Τρέχουσα ώρα",
912917
"DesiredSessionCount": "Επιθυμητός αριθμός συνόδων",
918+
"Destroyed": "Καταστράφηκε",
913919
"EditModelService": "Επεξεργασία υπηρεσίας μοντέλου",
914920
"EndpointId": "Αναγνωριστικό τελικού σημείου",
915921
"EndpointName": "Όνομα τελικού σημείου",

resources/i18n/en.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@
142142
"AdminCanOnlyRemoveTotp": "Only disabling 2FA of other users is possible.",
143143
"Allocation": "Allocation",
144144
"Association": "Association",
145+
"BeforeVerification": "Before Verification",
145146
"ConcurrentSessions": "Concurrent Sessions",
146147
"Create": "Create",
147148
"CreatePolicy": "Create Policy",
@@ -155,6 +156,7 @@
155156
"DeactivateCredential": "Deactivate credential",
156157
"DeactivateUser": "Deactivate user",
157158
"DeleteCredential": "Delete credential",
159+
"Deleted": "Deleted",
158160
"DescActiveUser": "Active user?",
159161
"DescRequirePasswordChange": "Require password change?",
160162
"Description": "Description",
@@ -649,6 +651,7 @@
649651
},
650652
"general": {
651653
"AccessKey": "Access Key",
654+
"Active": "Active",
652655
"Add": "Add",
653656
"Advanced": "Advanced",
654657
"All": "All",
@@ -666,6 +669,7 @@
666669
"General": "General",
667670
"Image": "Image",
668671
"InProgress": "In progress",
672+
"Inactive": "Inactive",
669673
"InvalidJSONFormat": "Invalid JSON format.",
670674
"LastUpdated": "Last Updated",
671675
"Manual": "Manual",
@@ -905,6 +909,7 @@
905909
"64chars": "(maximum 64 chars)"
906910
},
907911
"modelService": {
912+
"Active": "Active",
908913
"Active/Total": "Active/Total",
909914
"AddRules": "Add Rules",
910915
"AdditionalMounts": "Additional Mounts",
@@ -918,6 +923,7 @@
918923
"CreatedAt": "Created At",
919924
"CurrentTime": "Current time",
920925
"DesiredSessionCount": "Desired Session Count",
926+
"Destroyed": "Destroyed",
921927
"EditModelService": "Edit Model Service",
922928
"EndpointId": "Endpoint ID",
923929
"EndpointName": "Endpoint Name",

resources/i18n/es.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@
140140
"AdminCanOnlyRemoveTotp": "Sólo es posible desactivar 2FA de otros usuarios.",
141141
"Allocation": "Asignación",
142142
"Association": "Asociación",
143+
"BeforeVerification": "Antes de la verificación",
143144
"ConcurrentSessions": "Sesiones simultáneas",
144145
"Create": "Cree",
145146
"CreatePolicy": "Crear política",
@@ -153,6 +154,7 @@
153154
"DeactivateCredential": "Desactivar credencial",
154155
"DeactivateUser": "Desactivar usuario",
155156
"DeleteCredential": "Eliminar credencial",
157+
"Deleted": "Eliminado",
156158
"DescActiveUser": "¿Usuario activo?",
157159
"DescRequirePasswordChange": "¿Requerir cambio de contraseña?",
158160
"Description": "Descripción",
@@ -645,6 +647,7 @@
645647
},
646648
"general": {
647649
"AccessKey": "Clave de acceso",
650+
"Active": "Activo",
648651
"Add": "Añadir",
649652
"Advanced": "Avanzado",
650653
"All": "Todos",
@@ -662,6 +665,7 @@
662665
"General": "General",
663666
"Image": "Imagen",
664667
"InProgress": "En curso",
668+
"Inactive": "Inactivo",
665669
"InvalidJSONFormat": "Formato JSON no válido.",
666670
"LastUpdated": "Última actualización",
667671
"Manual": "Manual",
@@ -901,6 +905,7 @@
901905
"64chars": "(máximo 64 caracteres)"
902906
},
903907
"modelService": {
908+
"Active": "Activo",
904909
"Active/Total": "Activo/Total",
905910
"AddRules": "Agregar reglas",
906911
"AdditionalMounts": "Montajes adicionales",
@@ -914,6 +919,7 @@
914919
"CreatedAt": "Creado en",
915920
"CurrentTime": "Hora actual",
916921
"DesiredSessionCount": "Recuento de sesiones deseado",
922+
"Destroyed": "Destruido",
917923
"EditModelService": "Editar modelo de servicio",
918924
"EndpointId": "ID de punto final",
919925
"EndpointName": "Nombre del punto final",

0 commit comments

Comments
 (0)