Skip to content

Commit 0b9d16d

Browse files
committed
add locales
1 parent 191b016 commit 0b9d16d

File tree

11 files changed

+48
-38
lines changed

11 files changed

+48
-38
lines changed

src/common/coderbot.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ class CoderBot {
2424
const defaultActivity = {
2525
stock: true,
2626
default: true,
27-
uiLang: 'browser',
2827
defaultView: null,
2928
exec: {
3029
camera: true,
@@ -193,6 +192,7 @@ class CoderBot {
193192
data.movementUseMPU = remoteConfig.movement_use_mpu;
194193
data.movementUseMotion = remoteConfig.movement_use_motion;
195194
data.movementUseEncoder = remoteConfig.movement_use_encoder;
195+
data.locale = remoteConfig.locale;
196196
this.$store.commit('setSettings', data);
197197
}
198198

@@ -244,7 +244,8 @@ class CoderBot {
244244
prog_scrollbars: settings.progScrollbars,
245245
movement_use_mpu: settings.movementUseMPU,
246246
movement_use_motion: settings.movementUseMotion,
247-
movement_use_encoder: settings.movementUseEncoder
247+
movement_use_encoder: settings.movementUseEncoder,
248+
locale: settings.locale
248249
};
249250
this.$store.commit('setSettings', settings);
250251
return this.$axios.put(`${this.CB}/settings`, legacySettings);

src/components/Activity.vue

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -354,9 +354,6 @@ export default {
354354
}
355355
this.$coderbot.loadActivity(activityName, activityDefault).then((activity) => {
356356
this.activity = activity.data;
357-
if (this.activity.uiLang != 'browser') {
358-
this.$i18n.locale = this.activity.uiLang;
359-
}
360357
this.theme.global.name.value = this.activity.theme != 'dark' ? 'light' : 'dark';
361358
this.settings.maxBlocks = this.activity.maxBlocks;
362359
this.updateCssProps();

src/components/ActivityEditor.vue

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -134,24 +134,6 @@
134134
</v-col>
135135
</v-row>
136136
<v-row>
137-
<v-col>
138-
<v-card>
139-
<v-card-title>
140-
{{ $t("message.activity_locale") }}
141-
</v-card-title>
142-
<v-card-text>
143-
<v-select v-model="activity.uiLang"
144-
:items="langs"
145-
item-title="text"
146-
item-value="key"
147-
v-bind:label="$t('message.activity_locale')" required
148-
@change="v$.activity.uiLang.$touch"
149-
></v-select>
150-
</v-card-text>
151-
</v-card>
152-
</v-col>
153-
</v-row>
154-
<v-row>
155137
<v-col>
156138
<v-card>
157139
<v-card-title>
@@ -500,7 +482,6 @@ export default {
500482
activity: {
501483
stock: null,
502484
default: null,
503-
uiLang: "browser",
504485
theme: null,
505486
defaultView: null,
506487
exec: {
@@ -588,14 +569,6 @@ export default {
588569
'Protanomaly',
589570
'Protanopia',
590571
],
591-
langs: [
592-
{ key: 'browser', text: this.$i18n.t('message.activity_lang_browser') },
593-
{ key: 'it', text: this.$i18n.t('message.activity_lang_italian') },
594-
{ key: 'en', text: this.$i18n.t('message.activity_lang_english') },
595-
{ key: 'fr', text: this.$i18n.t('message.activity_lang_french') },
596-
{ key: 'es', text: this.$i18n.t('message.activity_lang_spanish') },
597-
{ key: 'de', text: this.$i18n.t('message.activity_lang_german') },
598-
],
599572
editHistory: false,
600573
navHistory: false,
601574
experimental: true,
@@ -631,7 +604,6 @@ export default {
631604
return {
632605
activity: {
633606
default: { },
634-
uiLang: { },
635607
defaultView: { },
636608
drawerEnabled: { },
637609
showName: { },

src/components/Settings.vue

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,22 @@
174174
</v-card-text>
175175
</v-card>
176176
</v-col>
177+
<v-col>
178+
<v-card>
179+
<v-card-title>
180+
{{ $t("message.settings_locale") }}
181+
</v-card-title>
182+
<v-card-text>
183+
<v-select v-model="settings.locale"
184+
:items="langs"
185+
item-title="text"
186+
item-value="key"
187+
v-bind:label="$t('message.settings_locale')" required
188+
@change="v$.settings.locale.$touch"
189+
></v-select>
190+
</v-card-text>
191+
</v-card>
192+
</v-col>
177193
<v-col>
178194
<v-card>
179195
<v-card-title>
@@ -1081,6 +1097,7 @@ export default {
10811097
},
10821098
save() {
10831099
if (this.v$.$invalid) {
1100+
console.log(this.v$)
10841101
this.snackText = this.$i18n.t('message.settings_errors');
10851102
this.snackbar = true;
10861103
} else {
@@ -1241,6 +1258,7 @@ export default {
12411258
startupProgram: null,
12421259
progLevel: null,
12431260
adminPassword: null,
1261+
locale: null
12441262
},
12451263
musicPackages: null,
12461264
cb: {
@@ -1276,6 +1294,14 @@ export default {
12761294
passwordIncorrect: false,
12771295
interval_wifi: null,
12781296
interval_info: null,
1297+
langs: [
1298+
{ key: 'browser', text: this.$i18n.t('message.activity_lang_browser') },
1299+
{ key: 'it', text: this.$i18n.t('message.activity_lang_italian') },
1300+
{ key: 'en', text: this.$i18n.t('message.activity_lang_english') },
1301+
{ key: 'fr', text: this.$i18n.t('message.activity_lang_french') },
1302+
{ key: 'es', text: this.$i18n.t('message.activity_lang_spanish') },
1303+
{ key: 'de', text: this.$i18n.t('message.activity_lang_german') },
1304+
]
12791305
};
12801306
},
12811307
validations() {
@@ -1436,6 +1462,8 @@ export default {
14361462
},
14371463
adminPassword: {
14381464
},
1465+
locale: {
1466+
}
14391467
},
14401468
};
14411469
},

src/i18n/index.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ import { createI18n } from 'vue-i18n';
33
import * as it_messages from './locales/it/messages.json';
44
import * as en_messages from './locales/en/messages.json';
55
import * as fr_messages from './locales/fr/messages.json';
6+
import * as es_messages from './locales/es/messages.json';
7+
import * as de_messages from './locales/de/messages.json';
68

79
const locales = {
810
it: {
@@ -14,6 +16,12 @@ const locales = {
1416
fr: {
1517
message: fr_messages.default,
1618
},
19+
es: {
20+
message: es_messages.default,
21+
},
22+
de: {
23+
message: de_messages.default,
24+
},
1725
};
1826

1927
const language = (window.navigator.userLanguage || window.navigator.language).substring(0, 2);

src/i18n/locales/de/messages.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@
3737
"activity_edit": "Aktivität bearbeiten",
3838
"activity_tip_1": "Hier können Sie eine Aktivität erstellen oder bearbeiten und definieren, wie sie dem Schüler angezeigt werden soll, der sie zum Schreiben von Programmen verwenden wird. Denken Sie daran, dass die Aktivität dann gestartet werden muss (Aktivitätsmenü -> Öffnen), um sie auszuführen tatsächlich verwenden.",
3939
"activity_data": "Aktivitätseinstellungen",
40-
"activity_locale": "Sprache der Benutzeroberfläche",
4140
"activity_typography": "Typografie",
4241
"activity_typography_font_ui": "Schriftart der Benutzeroberfläche",
4342
"activity_typography_font_editor": "Code-Schriftart (Werte, Code-Editoren)",
@@ -303,6 +302,7 @@
303302
"settings_admin_password_title": "Administrationspasswort",
304303
"settings_admin_password": "Passwort",
305304
"settings_admin_password_incorrect": "Ungültiges Passwort",
305+
"settings_locale": "Sprache der Benutzeroberfläche",
306306
"validation_integer": "Gib eine ganze Zahl ein (1234)",
307307
"validation_decimal": "Fügen Sie eine Dezimalzahl ein (12,34)",
308308
"validation_integer_positive": "Gib eine ganze Zahl ein, positiv oder gleich 0 ",

src/i18n/locales/en/messages.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@
3737
"activity_edit": "Edit Activity",
3838
"activity_tip_1": "Here you can create or edit an activity, defining how it should appear to the student who will use it to write programs. Remember that the activity will then have to be started (Activity Menu -> Open) in order to actually use it.",
3939
"activity_data": "Activity settings",
40-
"activity_locale": "User interface language",
4140
"activity_typography": "Typography",
4241
"activity_typography_font_ui": "Interface font",
4342
"activity_typography_font_editor": "Code font (values, code editors)",
@@ -303,6 +302,7 @@
303302
"settings_admin_password_title": "Administration password",
304303
"settings_admin_password": "password",
305304
"settings_admin_password_incorrect": "Invalid password",
305+
"settings_locale": "User interface language",
306306
"validation_integer": "Insert a integer number (1234)",
307307
"validation_decimal": "Insert a decimal number (12.34)",
308308
"validation_integer_positive": "Insert a integer number, positive or equal to 0 ",

src/i18n/locales/es/messages.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@
3737
"activity_edit": "Editar Actividad",
3838
"activity_tip_1": "Aquí puedes crear o editar una actividad, definiendo cómo debe aparecer para el estudiante que la usará para escribir programas. Recuerda que la actividad deberá iniciarse (Menú Actividad -> Abrir) para poder realmente usarlo.",
3939
"activity_data": "Configuración de la actividad",
40-
"activity_locale": "Idioma de la interfaz de usuario",
4140
"activity_typography": "Tipografía",
4241
"activity_typography_font_ui": "Fuente de la interfaz",
4342
"activity_typography_font_editor": "Fuente de código (valores, editores de código)",
@@ -303,6 +302,7 @@
303302
"settings_admin_password_title": "Contraseña de administración",
304303
"settings_admin_password": "contraseña",
305304
"settings_admin_password_incorrect": "Contraseña no válida",
305+
"settings_locale": "Idioma de la interfaz de usuario",
306306
"validation_integer": "Insertar un número entero (1234)",
307307
"validation_decimal": "Insertar un número decimal (12.34)",
308308
"validation_integer_positive": "Inserte un número entero, positivo o igual a 0",

src/i18n/locales/fr/messages.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@
3737
"activity_edit": "Modifier l'activité",
3838
"activity_tip_1": "Ici, vous pouvez créer ou modifier une activité, en définissant comment elle doit apparaître à l'étudiant qui l'utilisera pour écrire des programmes. N'oubliez pas que l'activité devra ensuite être lancée (Menu Activité -> Ouvrir) afin de l'utiliser réellement.",
3939
"activity_data": "Paramètres d'activité",
40-
"activity_locale": "Langue de l'interface utilisateur",
4140
"activity_typography": "Typographie",
4241
"activity_typography_font_ui": "Police de l'interface",
4342
"activity_typography_font_editor": "Police du code (valeurs, éditeurs de code)",
@@ -303,6 +302,7 @@
303302
"settings_admin_password_title": "Mot de passe administrateur",
304303
"settings_admin_password": "mot de passe",
305304
"settings_admin_password_incorrect": "Mot de passe invalide",
305+
"settings_locale": "Langue de l'interface utilisateur",
306306
"validation_integer": "Insérez un nombre entier (1234)",
307307
"validation_decimal": "Insérer un nombre décimal (12.34)",
308308
"validation_integer_positive": "Insère un nombre entier, positif ou égal à 0",

src/i18n/locales/it/messages.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@
3737
"activity_edit": "Modifica Attività",
3838
"activity_tip_1": "Qui puoi creare o modificare una attività, definendo come dovrà apparire allo studente che dovrà utilizzarla per scrivere programmi. Ricorda che l'attività andrà poi avviata (Menù Attività -> Apri) per poterne fare effettivamente uso.",
3939
"activity_data": "Dati Attività",
40-
"activity_locale": "Lingua interfaccia",
4140
"activity_typography": "Tipografia",
4241
"activity_typography_font_ui": "Carattere tipografico dell'interfaccia",
4342
"activity_typography_font_editor": "Carattere tipografico del codice (valori, editor di codice)",
@@ -303,6 +302,7 @@
303302
"settings_admin_password_title": "Password di amministrazione.",
304303
"settings_admin_password": "password",
305304
"settings_admin_password_incorrect": "Password non corretta.",
305+
"settings_locale": "Lingua interfaccia",
306306
"validation_integer": "Inserire un numero intero (1234)",
307307
"validation_decimal": "Inserire un numero decimale (12.34)",
308308
"validation_integer_positive": "Inserire un numero intero maggiore o uguale a 0",

0 commit comments

Comments
 (0)