Skip to content

Commit 0d83ede

Browse files
authored
Move user visible strings in AboutModal to i18n (#265)
1 parent b126614 commit 0d83ede

File tree

4 files changed

+73
-17
lines changed

4 files changed

+73
-17
lines changed

src/i18n/locales/en/translation.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,24 @@
7171
"NO_FILES_FOUND": "No {{type}} files found",
7272
"MECHANISMS": "Mechanisms",
7373
"OPMODES": "OpModes",
74+
"ABOUT": {
75+
"TITLE": "About",
76+
"OK": "OK",
77+
"VERSION": "Version",
78+
"NAME": "Name",
79+
"AUTHORS": "Authors",
80+
"URL": "URL",
81+
"LICENSE": "License",
82+
"TAB_ATTRIBUTIONS": "Third-Party Attributions",
83+
"TAB_DEPENDENCIES": "Dependencies",
84+
"LOADING_ATTRIBUTIONS": "Loading attributions...",
85+
"LOADING_DEPENDENCIES": "Loading dependencies...",
86+
"ATTRIBUTIONS_NOT_FOUND": "Attributions file not found.",
87+
"ERROR_LOADING_ATTRIBUTIONS": "Error loading attributions.",
88+
"DEPENDENCIES_NOT_AVAILABLE": "Dependencies information not available.",
89+
"ERROR_LOADING_DEPENDENCIES": "Error loading dependencies.",
90+
"COPYRIGHT": "© 2025 FIRST. All rights reserved."
91+
},
7492
"BLOCKLY":{
7593
"OF_TYPE": "of type",
7694
"WITH": "with",

src/i18n/locales/es/translation.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,24 @@
7272
},
7373
"MECHANISMS": "Mecanismos",
7474
"OPMODES": "OpModes",
75+
"ABOUT": {
76+
"TITLE": "Acerca de",
77+
"OK": "Aceptar",
78+
"VERSION": "Versión",
79+
"NAME": "Nombre",
80+
"AUTHORS": "Autores",
81+
"URL": "URL",
82+
"LICENSE": "Licencia",
83+
"TAB_ATTRIBUTIONS": "Atribuciones de Terceros",
84+
"TAB_DEPENDENCIES": "Dependencias",
85+
"LOADING_ATTRIBUTIONS": "Cargando atribuciones...",
86+
"LOADING_DEPENDENCIES": "Cargando dependencias...",
87+
"ATTRIBUTIONS_NOT_FOUND": "Archivo de atribuciones no encontrado.",
88+
"ERROR_LOADING_ATTRIBUTIONS": "Error al cargar atribuciones.",
89+
"DEPENDENCIES_NOT_AVAILABLE": "Información de dependencias no disponible.",
90+
"ERROR_LOADING_DEPENDENCIES": "Error al cargar dependencias.",
91+
"COPYRIGHT": "© 2025 FIRST. Todos los derechos reservados."
92+
},
7593
"BLOCKLY": {
7694
"OF_TYPE": "de tipo",
7795
"WITH": "con",

src/i18n/locales/he/translation.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,24 @@
7171
"NO_FILES_FOUND": "לא נמצאו קבצי {{type}}",
7272
"MECHANISMS": "מנגנונים",
7373
"OPMODES": "אופמודים",
74+
"ABOUT": {
75+
"TITLE": "אודות",
76+
"OK": "אישור",
77+
"VERSION": "גרסה",
78+
"NAME": "שם",
79+
"AUTHORS": "מחברים",
80+
"URL": "כתובת URL",
81+
"LICENSE": "רישיון",
82+
"TAB_ATTRIBUTIONS": "ייחוסים לצד שלישי",
83+
"TAB_DEPENDENCIES": "תלויות",
84+
"LOADING_ATTRIBUTIONS": "טוען ייחוסים...",
85+
"LOADING_DEPENDENCIES": "טוען תלויות...",
86+
"ATTRIBUTIONS_NOT_FOUND": "קובץ הייחוסים לא נמצא.",
87+
"ERROR_LOADING_ATTRIBUTIONS": "שגיאה בטעינת ייחוסים.",
88+
"DEPENDENCIES_NOT_AVAILABLE": "מידע על תלויות אינו זמין.",
89+
"ERROR_LOADING_DEPENDENCIES": "שגיאה בטעינת תלויות.",
90+
"COPYRIGHT": "© 2025 FIRST. כל הזכויות שמורות."
91+
},
7492
"BLOCKLY": {
7593
"OF_TYPE": "מטיפוס",
7694
"WITH": "עם",

src/reactComponents/AboutModal.tsx

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import * as React from 'react';
2222
import * as Antd from 'antd';
2323
import { InfoCircleOutlined } from '@ant-design/icons';
24+
import { useTranslation } from 'react-i18next';
2425

2526
declare const __APP_VERSION__: string;
2627
const __APP_NAME__ = "SystemCore Blocks";
@@ -34,8 +35,9 @@ const AboutDialog: React.FC<AboutDialogProps> = ({
3435
visible,
3536
onClose,
3637
}) => {
37-
const [attributions, setAttributions] = React.useState<string>('Loading attributions...');
38-
const [dependencies, setDependencies] = React.useState<string>('Loading dependencies...');
38+
const { t } = useTranslation();
39+
const [attributions, setAttributions] = React.useState<string>(t('ABOUT.LOADING_ATTRIBUTIONS'));
40+
const [dependencies, setDependencies] = React.useState<string>(t('ABOUT.LOADING_DEPENDENCIES'));
3941
const attributionsFile = '/attributions.txt'; // Path to the attributions file
4042

4143
React.useEffect(() => {
@@ -60,21 +62,21 @@ const AboutDialog: React.FC<AboutDialogProps> = ({
6062
let text = ''
6163

6264
licenses.forEach((licenseData) => {
63-
text += `Name: ${licenseData.name}\n`;
64-
text += `Version: ${licenseData.version}\n`;
65-
text += `Authors: ${licenseData.authors}\n`;
66-
text += `URL: ${licenseData.url}\n`;
67-
text += `License: ${licenseData.license}\n`;
65+
text += `${t('ABOUT.NAME')}: ${licenseData.name}\n`;
66+
text += `${t('ABOUT.VERSION')}: ${licenseData.version}\n`;
67+
text += `${t('ABOUT.AUTHORS')}: ${licenseData.authors}\n`;
68+
text += `${t('ABOUT.URL')}: ${licenseData.url}\n`;
69+
text += `${t('ABOUT.LICENSE')}: ${licenseData.license}\n`;
6870
text += `\n`;
6971
});
7072

7173
setAttributions(text);
7274
} else {
73-
setAttributions('Attributions file not found.');
75+
setAttributions(t('ABOUT.ATTRIBUTIONS_NOT_FOUND'));
7476
}
7577
} catch (error) {
7678
console.error('Error loading attributions:', error);
77-
setAttributions('Error loading attributions.');
79+
setAttributions(t('ABOUT.ERROR_LOADING_ATTRIBUTIONS'));
7880
}
7981
};
8082

@@ -96,11 +98,11 @@ const AboutDialog: React.FC<AboutDialogProps> = ({
9698
});
9799
setDependencies(depText);
98100
} else {
99-
setDependencies('Dependencies information not available.');
101+
setDependencies(t('ABOUT.DEPENDENCIES_NOT_AVAILABLE'));
100102
}
101103
} catch (error) {
102104
console.error('Error loading dependencies:', error);
103-
setDependencies('Error loading dependencies.');
105+
setDependencies(t('ABOUT.ERROR_LOADING_DEPENDENCIES'));
104106
}
105107
};
106108

@@ -109,11 +111,11 @@ const AboutDialog: React.FC<AboutDialogProps> = ({
109111
title={
110112
<Antd.Space>
111113
<InfoCircleOutlined />
112-
About
114+
{t('ABOUT.TITLE')}
113115
</Antd.Space>
114116
}
115117
open={visible}
116-
footer={[<Antd.Button key="submit" onClick={onClose}>OK</Antd.Button>]}
118+
footer={[<Antd.Button key="submit" onClick={onClose}>{t('ABOUT.OK')}</Antd.Button>]}
117119
onCancel={onClose}
118120
onOk={onClose}
119121
width={600}
@@ -122,7 +124,7 @@ const AboutDialog: React.FC<AboutDialogProps> = ({
122124
<Antd.Space direction="vertical" style={{ width: '100%' }} size="small">
123125
<div>
124126
<Antd.Typography.Title level={4}>{__APP_NAME__}</Antd.Typography.Title>
125-
<Antd.Typography.Text>Version: {__APP_VERSION__}</Antd.Typography.Text>
127+
<Antd.Typography.Text>{t('ABOUT.VERSION')}: {__APP_VERSION__}</Antd.Typography.Text>
126128
</div>
127129

128130
<Antd.Divider style={{ margin: '8px 0' }} />
@@ -131,7 +133,7 @@ const AboutDialog: React.FC<AboutDialogProps> = ({
131133
items={[
132134
{
133135
key: 'attributions',
134-
label: 'Third-Party Attributions',
136+
label: t('ABOUT.TAB_ATTRIBUTIONS'),
135137
children: (
136138
<Antd.Input.TextArea
137139
value={attributions}
@@ -147,7 +149,7 @@ const AboutDialog: React.FC<AboutDialogProps> = ({
147149
},
148150
{
149151
key: 'dependencies',
150-
label: 'Dependencies',
152+
label: t('ABOUT.TAB_DEPENDENCIES'),
151153
children: (
152154
<Antd.Input.TextArea
153155
value={dependencies}
@@ -166,7 +168,7 @@ const AboutDialog: React.FC<AboutDialogProps> = ({
166168

167169
<div style={{ textAlign: 'center', marginTop: '16px' }}>
168170
<Antd.Typography.Text type="secondary">
169-
© 2025 FIRST. All rights reserved.
171+
{t('ABOUT.COPYRIGHT')}
170172
</Antd.Typography.Text>
171173
</div>
172174
</Antd.Space>

0 commit comments

Comments
 (0)