🌐 i18n: add french locales for france and belgium
french is now available in colorshell thanks to @Elgemp4 in #19!!
This commit is contained in:
+15
-13
@@ -1,18 +1,20 @@
|
||||
import GLib from "gi://GLib?version=2.0";
|
||||
|
||||
|
||||
const i18nKeys = {
|
||||
"en_US": (await import("./lang/en_US")).default,
|
||||
"pt_BR": (await import("./lang/pt_BR")).default,
|
||||
"ru_RU": (await import("./lang/ru_RU")).default
|
||||
en_US: (await import("./lang/en_US")).default,
|
||||
fr_FR: (await import("./lang/fr_FR")).default,
|
||||
fr_BE: (await import("./lang/fr_FR")).default,
|
||||
pt_BR: (await import("./lang/pt_BR")).default,
|
||||
ru_RU: (await import("./lang/ru_RU")).default,
|
||||
};
|
||||
|
||||
const languages: Array<string> = Object.keys(i18nKeys);
|
||||
let language: string = getSystemLanguage();
|
||||
|
||||
export function getSystemLanguage(): string {
|
||||
const sysLanguage: (string|null|undefined) = GLib.getenv("LANG") ?? GLib.getenv("LANGUAGE"),
|
||||
splitted: Array<string>|undefined = sysLanguage?.split('.');
|
||||
const sysLanguage: string | null | undefined =
|
||||
GLib.getenv("LANG") ?? GLib.getenv("LANGUAGE"),
|
||||
splitted: Array<string> | undefined = sysLanguage?.split(".");
|
||||
|
||||
if (!splitted || !languages.includes(splitted![0])) {
|
||||
console.warn(`Intl: Falling back to default \`${languages[0]}\``);
|
||||
@@ -31,7 +33,7 @@ export function setLanguage(lang: string): string {
|
||||
});
|
||||
|
||||
throw new Error(`Intl: couldn't set language: ${lang}`, {
|
||||
cause: `language ${lang} not found in languages of type ${typeof languages}`
|
||||
cause: `language ${lang} not found in languages of type ${typeof languages}`,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -39,16 +41,16 @@ export function tr(key: string): string {
|
||||
let result = i18nKeys[language as keyof typeof i18nKeys],
|
||||
defResult = i18nKeys[languages[0] as keyof typeof i18nKeys];
|
||||
|
||||
for(const keyString of key.split('.')) {
|
||||
for (const keyString of key.split(".")) {
|
||||
result = result[keyString as keyof typeof result] as never;
|
||||
defResult = defResult[keyString as keyof typeof defResult] as never;
|
||||
}
|
||||
|
||||
return (typeof result == "string") ?
|
||||
result
|
||||
: ((typeof defResult == "string") ?
|
||||
defResult
|
||||
: "not found / is not of type \"string\"");
|
||||
return typeof result == "string"
|
||||
? result
|
||||
: typeof defResult == "string"
|
||||
? defResult
|
||||
: 'not found / is not of type "string"';
|
||||
}
|
||||
|
||||
export function trGet() {
|
||||
|
||||
@@ -0,0 +1,105 @@
|
||||
import { i18nStruct } from "../struct";
|
||||
|
||||
export default {
|
||||
language: "Français (France)",
|
||||
|
||||
cancel: "Annuler",
|
||||
accept: "Ok",
|
||||
devices: "Appareils",
|
||||
others: "Autres",
|
||||
|
||||
connected: "Connecté",
|
||||
disconnected: "Déconnecté",
|
||||
unknown: "Inconnu",
|
||||
connecting: "Connexion en cours",
|
||||
none: "Aucun",
|
||||
limited: "Limité",
|
||||
apps: "Applications",
|
||||
|
||||
clear: "Effacer",
|
||||
|
||||
connect: "Se connecter",
|
||||
disconnect: "Se déconnecter",
|
||||
copy_to_clipboard: "Copier dans le presse-papiers",
|
||||
|
||||
media: {
|
||||
play: "Lecture",
|
||||
pause: "Pause",
|
||||
next: "Suivant",
|
||||
previous: "Précédent",
|
||||
loop: "Boucle",
|
||||
no_loop: "Pas de boucle",
|
||||
song_loop: "Répéter le morceau",
|
||||
shuffle_order: "Lecture aléatoire",
|
||||
follow_order: "Lecture dans l'ordre",
|
||||
no_artist: "Aucun artiste",
|
||||
no_title: "Aucun titre",
|
||||
},
|
||||
control_center: {
|
||||
tiles: {
|
||||
enabled: "Activé",
|
||||
disabled: "Désactivé",
|
||||
more: "Plus",
|
||||
|
||||
network: {
|
||||
network: "Réseau",
|
||||
wireless: "Sans fil",
|
||||
wired: "Filaire",
|
||||
},
|
||||
recording: {
|
||||
title: "Enregistrement de l'écran",
|
||||
disabled_desc: "Démarrer l'enregistrement",
|
||||
enabled_desc: "Arrêter l'enregistrement",
|
||||
},
|
||||
dnd: {
|
||||
title: "Ne pas déranger",
|
||||
},
|
||||
night_light: {
|
||||
title: "Éclairage nocturne",
|
||||
default_desc: "Fidélité",
|
||||
},
|
||||
},
|
||||
pages: {
|
||||
more_settings: "Plus de paramètres",
|
||||
sound: {
|
||||
title: "Son",
|
||||
description: "Configurer la sortie audio",
|
||||
},
|
||||
microphone: {
|
||||
title: "Microphone",
|
||||
description: "Configurer l'entrée audio",
|
||||
},
|
||||
night_light: {
|
||||
title: "Éclairage nocturne",
|
||||
description: "Contrôler l'éclairage nocturne et les filtres Gamma",
|
||||
gamma: "Gamma",
|
||||
temperature: "Température",
|
||||
},
|
||||
backlight: {
|
||||
title: "Rétroéclairage",
|
||||
description: "Contrôler la luminosité de vos écrans",
|
||||
refresh: "Actualiser les rétroéclairages",
|
||||
},
|
||||
bluetooth: {
|
||||
title: "Bluetooth",
|
||||
description: "Gérer les appareils Bluetooth",
|
||||
new_devices: "Nouveaux appareils",
|
||||
adapters: "Adaptateurs",
|
||||
paired_devices: "Appareils appairés",
|
||||
start_discovering: "Démarrer la recherche",
|
||||
stop_discovering: "Arrêter la recherche",
|
||||
untrust_device: "Retirer la confiance",
|
||||
unpair_device: "Désappairer",
|
||||
trust_device: "Faire confiance",
|
||||
pair_device: "Appairer",
|
||||
},
|
||||
network: {
|
||||
title: "Réseau",
|
||||
interface: "Interface",
|
||||
},
|
||||
},
|
||||
},
|
||||
ask_popup: {
|
||||
title: "Question",
|
||||
},
|
||||
} satisfies i18nStruct;
|
||||
+1
-3
@@ -8,9 +8,7 @@
|
||||
"lib": ["ES2024"],
|
||||
"moduleResolution": "bundler",
|
||||
"skipLibCheck": true,
|
||||
"types": [
|
||||
"./@types"
|
||||
],
|
||||
"types": ["./@types"],
|
||||
"strict": true,
|
||||
"jsx": "react-jsx",
|
||||
"jsxImportSource": "ags/gtk4"
|
||||
|
||||
Reference in New Issue
Block a user