Skip to content

Commit

Permalink
Updated Translations
Browse files Browse the repository at this point in the history
  • Loading branch information
TheBaconCat committed Oct 20, 2024
1 parent 21b5729 commit e02f2bd
Show file tree
Hide file tree
Showing 5 changed files with 79 additions and 77 deletions.
82 changes: 40 additions & 42 deletions src/renderer/i18n.ts
Original file line number Diff line number Diff line change
@@ -1,58 +1,56 @@
import i18next from 'i18next';
import jqueryI18next from 'jquery-i18next';
import LanguageDetector from 'i18next-browser-languagedetector';
import Backend from "i18next-http-backend";
import Backend from 'i18next-http-backend';
const DETECTION_OPTIONS = {
order: ['localStorage', 'navigator'],
caches: ['localStorage']
order: ['localStorage', 'navigator'],
caches: ['localStorage'],
};

async function initI18n() {
await i18next
.use(LanguageDetector)
.use(Backend)
// detect user language
// learn more: https://github.com/i18next/i18next-browser-languageDetector
// init i18next
// for all options read: https://www.i18next.com/overview/configuration-options
.init({
debug: false,
fallbackLng: 'en',
load: 'languageOnly',
detection: DETECTION_OPTIONS,
backend: {
loadPath: './localization/locales/{{lng}}/{{ns}}.json',
},
interpolation: {
escapeValue: false,
},
},
);
}
jqueryI18next.init(i18next, $, { useOptionsAttr: true });
await i18next
.use(LanguageDetector)
.use(Backend)
// detect user language
// learn more: https://github.com/i18next/i18next-browser-languageDetector
// init i18next
// for all options read: https://www.i18next.com/overview/configuration-options
.init({
debug: false,
fallbackLng: 'en',
load: 'languageOnly',
detection: DETECTION_OPTIONS,
backend: {
loadPath: './localization/locales/{{lng}}/{{ns}}.json',
},
interpolation: {
escapeValue: false,
},
});
}
jqueryI18next.init(i18next, $, {useOptionsAttr: true});
function translatePage() {

$(document).localize();
setTimeout(() =>{
$('.loader').hide();
$('#menuContent').removeAttr('style');
},1000)
$(document).localize();
setTimeout(() => {
$('.loader').hide();
$('#menuContent').removeAttr('style');
}, 1000);
}

function bindLocaleSwitcher() {
const $switcher = $("[data-i18n-switcher]");
const $switcher = $('[data-i18n-switcher]');

$switcher.val(i18next.language);
$switcher.val(i18next.language);

$switcher.on("change", async function () {
const chosenLng = $(this).find("option:selected").attr('value');
await i18next.changeLanguage(chosenLng);
translatePage();
});
$switcher.on('change', async function () {
const chosenLng = $(this).find('option:selected').attr('value');
await i18next.changeLanguage(chosenLng);
translatePage();
});
}

(async function () {
await initI18n();
translatePage();
bindLocaleSwitcher();
})();
await initI18n();
translatePage();
bindLocaleSwitcher();
})();
19 changes: 10 additions & 9 deletions src/renderer/public/localization/locales/en/translation.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
{
"alwaysOnTop": "Always on Top?",
"attemptingToConnectToF1MV": "Attempting to Connect to F1MV in:",
"attemptingToConnectToF1MV": "Attempting to Connect to MultiViewer in:",
"attemptingToConnectToLiveReplayTimingWindow": "Attempting to Connect to Live or Replay Timing Window:",
"attemptingToGetCurrentSessionInfoFromF1mv": "Attempting to Get Current Session Info From F1MV...",
"attemptingToGetCurrentSessionInfoFromF1mv": "Attempting to Get Current Session Info From MultiViewer...",
"back": "Back",
"blueFlags": "Blue Flags",
"checkNetworkSettings": "Move your Mouse to the Bottom Right Corner & Click on the Settings Gear to check your Network Settings.",
"currentSession": "Current Session:",
"digiflagNotLinked": "DigiFlag is currently not linked to F1MV",
"digiflagNotLinked": "DigiFlag is currently not linked to MultiViewer",
"digiflagVersion": "DigiFlag Version:",
"extraFlags": "Extra Flags",
"failedToConnect": "Failed to connect to F1MV",
"failedToConnect": "Failed to connect to MultiViewer",
"failedToRetrieveCurrentSession": "Failed to Retrieve Current Session",
"general": "General",
"infoTag": "Maybe you are trying to connect to another host? Maybe your port isn't the default one?",
Expand All @@ -25,16 +26,16 @@
"openDigiflagGithub": "Open DigiFlag Github",
"pixel": "Pixel",
"restoreDefaultSettings": "Restore Default Network Settings",
"retrievingCurrentSession": "Retrieving Current Session From F1MV...",
"retryingToConnectToF1mvIn": "Retrying to Connect to F1MV in :",
"retrievingCurrentSession": "Retrieving Current Session From MultiViewer...",
"retryingToConnectToF1mvIn": "Retrying to Connect to MultiViewer in :",
"saveNetworkSettings": "Save Network Settings",
"seconds": "seconds",
"selectADevice": "Select a Device",
"selectADigiflagTheme": "Select a DigiFlag Theme",
"selectAMapStyle": "Select a Map Style",
"startDigiflag": "Start DigiFlag",
"successfullyConnectedToF1mvTimingWindow": "Successfully Connected to F1MV Timing Window",
"unableToRetrieveCurrentSessionFromF1mv": "Unable to Retrieve Current Session from F1MV",
"successfullyConnectedToF1mvTimingWindow": "Successfully Connected to MultiViewer Timing Window",
"unableToRetrieveCurrentSessionFromF1mv": "Unable to Retrieve Current Session from MultiViewer",
"useF1TrackMapBackground": "Use F1 Track Map Background?",
"youAreConnectedToF1mvButTheLiveReplayTimingWindowIsNotOpen": "You are Connected to F1MV, but the Live or Replay Timing Window is not open"
"youAreConnectedToF1mvButTheLiveReplayTimingWindowIsNotOpen": "You are Connected to MultiViewer, but the Live or Replay Timing Window is not open"
}
19 changes: 10 additions & 9 deletions src/renderer/public/localization/locales/es/translation.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
{
"alwaysOnTop": "Siempre en la cima?",
"attemptingToConnectToF1MV": "Intentando conectar con F1MV en:",
"attemptingToConnectToF1MV": "Intentando conectar con MultiViewer en:",
"attemptingToConnectToLiveReplayTimingWindow": "Intentar conectarse a una ventana de tiempo en directo o de repetición:",
"attemptingToGetCurrentSessionInfoFromF1mv": "Intento de obtener información de la sesión actual de F1MV...",
"attemptingToGetCurrentSessionInfoFromF1mv": "Intento de obtener información de la sesión actual de MultiViewer...",
"back": "Atrás",
"blueFlags": "banderas azules",
"checkNetworkSettings": "Mueva el ratón a la esquina inferior derecha y haga clic en el engranaje de configuración para comprobar la configuración de red.",
"currentSession": "Sesión en Curso:",
"digiflagNotLinked": "DigiFlag no está vinculado actualmente a F1MV",
"digiflagNotLinked": "DigiFlag no está vinculado actualmente a MultiViewer",
"digiflagVersion": "DigiFlag Versión:",
"extraFlags": "Banderas adicionales",
"failedToConnect": "Fallo de conexión con F1MV",
"failedToConnect": "Fallo de conexión con MultiViewer",
"failedToRetrieveCurrentSession": "Fallo al recuperar la sesión actual",
"general": "General",
"infoTag": "¿Quizás estás intentando conectarte a otro host? ¿Tal vez tu puerto no es el predeterminado?",
Expand All @@ -25,16 +26,16 @@
"openDigiflagGithub": "Abrir DigiFlag Github",
"pixel": "Píxel",
"restoreDefaultSettings": "Restablecer la configuración de red predeterminada",
"retrievingCurrentSession": "Recuperar la sesión actual de F1MV...",
"retryingToConnectToF1mvIn": "Reintento de conexión a F1MV en :",
"retrievingCurrentSession": "Recuperar la sesión actual de MultiViewer...",
"retryingToConnectToF1mvIn": "Reintento de conexión a MultiViewer en :",
"saveNetworkSettings": "Guardar configuración de red",
"seconds": "segundos",
"selectADevice": "Seleccione un dispositivo",
"selectADigiflagTheme": "Seleccione un tema DigiFlag",
"selectAMapStyle": "Seleccione un estilo de mapa",
"startDigiflag": "Iniciar DigiFlag",
"successfullyConnectedToF1mvTimingWindow": "Conectado con éxito a la ventana de tiempo F1MV",
"unableToRetrieveCurrentSessionFromF1mv": "No se puede recuperar la sesión actual de F1MV",
"successfullyConnectedToF1mvTimingWindow": "Conectado con éxito a la ventana de tiempo MultiViewer",
"unableToRetrieveCurrentSessionFromF1mv": "No se puede recuperar la sesión actual de MultiViewer",
"useF1TrackMapBackground": "¿Utilizar el fondo del mapa de la pista de F1?",
"youAreConnectedToF1mvButTheLiveReplayTimingWindowIsNotOpen": "Está conectado a F1MV, pero la ventana de cronometraje en directo o de repetición no está abierta"
"youAreConnectedToF1mvButTheLiveReplayTimingWindowIsNotOpen": "Está conectado a MultiViewer, pero la ventana de cronometraje en directo o de repetición no está abierta"
}
19 changes: 10 additions & 9 deletions src/renderer/public/localization/locales/fr/translation.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
{
"alwaysOnTop": "Toujours au dessus?",
"attemptingToConnectToF1MV": "Tentative de connexion à F1MV dans:",
"attemptingToConnectToF1MV": "Tentative de connexion à MultiViewer dans:",
"attemptingToConnectToLiveReplayTimingWindow": "Tentative de connexion au Live Timing :",
"attemptingToGetCurrentSessionInfoFromF1mv": "Récupération des informations de la session actuelle de F1MV...",
"attemptingToGetCurrentSessionInfoFromF1mv": "Récupération des informations de la session actuelle de MultiViewer...",
"back": "Retourner",
"blueFlags": "Drapeaux bleus",
"checkNetworkSettings": "Déplacez votre souris dans le coin inférieur droit et cliquez sur le bouton paramètres pour vérifier vos paramètres réseau.",
"currentSession": "Session Actuelle:",
"digiflagNotLinked": "DigiFlag n'est actuellement pas lié à F1MV",
"digiflagNotLinked": "DigiFlag n'est actuellement pas lié à MultiViewer",
"digiflagVersion": "Version de DigiFlag:",
"extraFlags": "Drapeaux supplémentaires",
"failedToConnect": "Impossible de se connecter à F1MV",
"failedToConnect": "Impossible de se connecter à MultiViewer",
"failedToRetrieveCurrentSession": "Impossible de récupérer la session actuelle",
"general": "Général",
"infoTag": "Peut-être essayez-vous de vous connecter à un autre ordinateur ? Peut-être que votre port n'est pas celui par défaut ?",
Expand All @@ -25,16 +26,16 @@
"openDigiflagGithub": "Ouvrir DigiFlag sur Github",
"pixel": "Pixel",
"restoreDefaultSettings": "Réinitialiser les paramètres réseau",
"retrievingCurrentSession": "Récupération de la session actuelle depuis F1MV...",
"retryingToConnectToF1mvIn": "Essai de connexion à F1MV dans :",
"retrievingCurrentSession": "Récupération de la session actuelle depuis MultiViewer...",
"retryingToConnectToF1mvIn": "Essai de connexion à MultiViewer dans :",
"saveNetworkSettings": "Sauvegarder les paramètres réseau",
"seconds": "secondes",
"selectADevice": "Sélectionner un appareil",
"selectADigiflagTheme": "Sélectionnez un thème DigiFlag",
"selectAMapStyle": "Sélectionnez un style de carte",
"startDigiflag": "Démarrer DigiFlag",
"successfullyConnectedToF1mvTimingWindow": "Connexion réussie à la fenêtre de chronométrage F1MV",
"unableToRetrieveCurrentSessionFromF1mv": "Impossible de récupérer la session en cours à partir de F1MV",
"successfullyConnectedToF1mvTimingWindow": "Connexion réussie à la fenêtre de chronométrage MultiViewer",
"unableToRetrieveCurrentSessionFromF1mv": "Impossible de récupérer la session en cours à partir de MultiViewer",
"useF1TrackMapBackground": "Utiliser le fond de carte de la piste F1?",
"youAreConnectedToF1mvButTheLiveReplayTimingWindowIsNotOpen": "Vous êtes connecté à F1MV, mais la fenêtre de télémétrie n'est pas ouverte"
"youAreConnectedToF1mvButTheLiveReplayTimingWindowIsNotOpen": "Vous êtes connecté à MultiViewer, mais la fenêtre de télémétrie n'est pas ouverte"
}
17 changes: 9 additions & 8 deletions src/renderer/public/localization/locales/nl/translation.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
{
"alwaysOnTop": "Altijd bovenop?",
"attemptingToConnectToF1MV": "Poging on verbinding te maken met F1MV in:",
"attemptingToConnectToF1MV": "Poging on verbinding te maken met MultiViewer in:",
"attemptingToConnectToLiveReplayTimingWindow": "Poging om verbinding te maken met het live of herhaal tijdvenster:",
"attemptingToGetCurrentSessionInfoFromF1mv": "Poging tot het ophalen van de huidige sessie informatie...",
"back": "Terug",
"blueFlags": "Blauwe vlaggen",
"checkNetworkSettings": "Verplaats je muis naar de rechteronderhoek en klik of het instellingen tandwiel.",
"currentSession": "Huidige Sessie:",
"digiflagNotLinked": "DigiFlag is op het moment niet gekoppelt aan F1MV",
"digiflagNotLinked": "DigiFlag is op het moment niet gekoppelt aan MultiViewer",
"digiflagVersion": "DigiFlag Versie:",
"extraFlags": "Extra vlaggen",
"failedToConnect": "Connectie naar F1MV mislukt",
"failedToConnect": "Connectie naar MultiViewer mislukt",
"failedToRetrieveCurrentSession": "Ophalen van de huidige sessie mislukt",
"general": "Algemeen",
"infoTag": "Misschien probeer je verbinding te maken met een andere host? Misschien is je port niet de stardaard port?",
Expand All @@ -25,16 +26,16 @@
"openDigiflagGithub": "Open DigiFlag Github",
"pixel": "Pixel",
"restoreDefaultSettings": "Herstel Standaard Netwerk Instellingen",
"retrievingCurrentSession": "Ophal van de huidige sessie in F1MV...",
"retryingToConnectToF1mvIn": "Opnieuw proberen verbinding te maken met F1MV in:",
"retrievingCurrentSession": "Ophal van de huidige sessie in MultiViewer...",
"retryingToConnectToF1mvIn": "Opnieuw proberen verbinding te maken met MultiViewer in:",
"saveNetworkSettings": "Sla Netwerk Instellingen op",
"seconds": "seconden",
"selectADevice": "Selecteer een apparaat",
"selectADigiflagTheme": "Selecteer een DigiFlag thema",
"selectAMapStyle": "Selecteer een kaart stijl",
"startDigiflag": "Start DigiFlag",
"successfullyConnectedToF1mvTimingWindow": "Succesvol verbonden met het F1MV tijdvenster",
"unableToRetrieveCurrentSessionFromF1mv": "Niet in staat om de huidige sessie van F1MV te krijgen",
"successfullyConnectedToF1mvTimingWindow": "Succesvol verbonden met het MultiViewer tijdvenster",
"unableToRetrieveCurrentSessionFromF1mv": "Niet in staat om de huidige sessie van MultiViewer te krijgen",
"useF1TrackMapBackground": "Gebruik F1 baan kaart achtergrond?",
"youAreConnectedToF1mvButTheLiveReplayTimingWindowIsNotOpen": "Je bent verbonden met F1MV, maar het Live of herhaal tijdvenster is niet geopened"
"youAreConnectedToF1mvButTheLiveReplayTimingWindowIsNotOpen": "Je bent verbonden met MultiViewer, maar het Live of herhaal tijdvenster is niet geopened"
}

0 comments on commit e02f2bd

Please sign in to comment.