fix translations

This commit is contained in:
marlon-erler
2024-07-07 18:32:36 +02:00
parent 9a9b8f1ee5
commit 4d0855b5d0
2 changed files with 7 additions and 8 deletions
+3 -2
View File
@@ -306,8 +306,9 @@
}
};
function getText(key) {
if (translations[navigator.language] && translations[navigator.language][key]) {
return translations[navigator.language.substring(0, 2)][key];
const language = navigator.language.substring(0, 2);
if (translations[language]) {
return translations[language][key];
}
return translations.en[key];
}
+4 -6
View File
@@ -33,7 +33,7 @@ export const translations: { [key: string]: typeof staticTextEnglish } = {
message_placeholder: "Hola!",
message_placeholder_generic: "Nuevo mensaje",
noMessagesReceived: "Sin mensajes",
messageLastReceived: "Ültimo mensaje",
messageLastReceived: "Último mensaje",
messagesReceived: "Todos los Mensajes",
send: "Enviar",
serverInfo: "Información",
@@ -65,11 +65,9 @@ export const translations: { [key: string]: typeof staticTextEnglish } = {
};
export function getText(key: keyof typeof staticTextEnglish): string {
if (
translations[navigator.language] &&
translations[navigator.language][key]
) {
return translations[navigator.language.substring(0, 2)][key];
const language = navigator.language.substring(0, 2);
if (translations[language]) {
return translations[language][key];
}
return translations.en[key];
}