diff --git a/i18n/translate.ts b/i18n/translate.ts new file mode 100644 index 0000000000..9d92799a4a --- /dev/null +++ b/i18n/translate.ts @@ -0,0 +1,130 @@ +import { get } from '../helpers/object'; +import { logger } from '../logging/logger'; +import type { Translation } from '../models/i18n/translation'; +import { translation as langAr } from './translations/lang-ar'; +import { translation as langCs } from './translations/lang-cs'; +import { translation as langDe } from './translations/lang-de'; +import { translation as langEn } from './translations/lang-en'; +import { translation as langEs } from './translations/lang-es'; +import { translation as langFr } from './translations/lang-fr'; +import { translation as langId } from './translations/lang-id'; +import { translation as langIt } from './translations/lang-it'; +import { translation as langJa } from './translations/lang-ja'; +import { translation as langKo } from './translations/lang-ko'; +import { translation as langNl } from './translations/lang-nl'; +import { translation as langPl } from './translations/lang-pl'; +import { translation as langPtBr } from './translations/lang-pt-br'; +import { translation as langPtPt } from './translations/lang-pt-pt'; +import { translation as langRu } from './translations/lang-ru'; +import { translation as langUk } from './translations/lang-uk'; +import { translation as langZhCn } from './translations/lang-zh-cn'; +import { translation as langZhTw } from './translations/lang-zh-tw'; + + +let currentTranslation: Translation; +let fallbackTranslation: Translation; + +const placeholder = '%'; + +/** Initialize the translations */ +export const initTranslations = async (language: string) => { + try { + currentTranslation = await loadTranslation(language); + fallbackTranslation = await loadTranslation('en'); + logger.info('Translations initialized.'); + } catch (error) { + logger.error(error); + } +}; + +/** Load the required translation */ +const loadTranslation = async (language: string) => { + try { + return await getTranslationObject(language); + } catch { + return await getTranslationObject('en'); + } +}; + +/** Get the translation object of the separated translation files */ +const getTranslationObject = async (language: string): Promise => { + switch (language) { + case 'ar': + return langAr; + case 'cs': + return langCs; + case 'de': + return langDe; + case 'en': + return langEn; + case 'es': + return langEs; + case 'fr': + return langFr; + case 'id': + return langId; + case 'it': + return langIt; + case 'ja': + return langJa; + case 'ko': + return langKo; + case 'nl': + return langNl; + case 'pl': + return langPl; + case 'pt-br': + return langPtBr; + case 'pt-pt': + return langPtPt; + case 'ru': + return langRu; + case 'uk': + return langUk; + case 'zh-cn': + return langZhCn; + case 'zh-tw': + return langZhTw; + default: + return langEn; + } +}; + +/** + * We look up the matching translation in the translation files. + * If we cannot find a matching key in the file we use the fallback. + * With optional parameters you can configure both the translations + * and the fallback (required for testing purposes). + * */ +export const getTranslationValue = ( + key: string, + translations = currentTranslation, + fallback = fallbackTranslation +): string | undefined => { + return get(translations, key) ?? get(fallback, key); +}; + +/** + * The instant method is required for the translate pipe. + * It helps to translate a word instantly. + */ +export const translate = (key: string, ...variables: string[]): string => { + const translation = getTranslationValue(key); + + if (variables.length === 0) return translation ?? key; + return replace(translation, ...variables); +}; + +/** + * The replace function will replace the current placeholder with the + * data parameter from the translation. You can give it one or more optional + * parameters ('variables'). + */ +export const replace = (value: string = '', ...variables: string[]) => { + let translation: string = value; + variables.forEach((variable, i) => { + translation = translation.replace(`${placeholder}${i}`, variable); + }); + + return translation; +}; diff --git a/i18n/translations/lang-ar.ts b/i18n/translations/lang-ar.ts new file mode 100644 index 0000000000..5fb65daaae --- /dev/null +++ b/i18n/translations/lang-ar.ts @@ -0,0 +1,46 @@ +import type { Translation } from '../../models/i18n/translation'; + +export const translation: Translation = { + activate: 'تفعيل', + activated: 'تم تفعيل Material Icon Theme.', + iconPacks: { + selectPack: 'اختر حزمة الأيقونات', + description: "اختر حزمة الأيقونات '%0'", + disabled: 'تعطيل حزم الأيقونات', + }, + folders: { + toggleIcons: 'اختر سمة المجلد', + disabled: 'بدون أيقونات مجلدات', + theme: { + description: "اختر سمة المجلد '%0'", + }, + }, + colorSelect: { + color: 'اختر لونًا', + hexCode: 'أدخل كود لون HEX', + wrongHexCode: 'كود HEX غير صالح!', + }, + opacity: { + inputPlaceholder: 'قيمة الشفافية (بين 0 و 1)', + wrongValue: 'يرجى إدخال رقم عشري بين 0 و 1.', + }, + toggleSwitch: { + on: 'تشغيل', + off: 'إيقاف', + }, + explorerArrows: { + toggle: 'تبديل أسهم المجلدات في المستكشف', + enable: 'إظهار أسهم المجلدات في المستكشف', + disable: 'إخفاء أسهم المجلدات في المستكشف', + }, + grayscale: { + toggle: 'تبديل الأيقونات الرمادية', + enable: 'تفعيل الأيقونات الرمادية', + disable: 'تعطيل الأيقونات الرمادية', + }, + saturation: { + inputPlaceholder: 'قيمة التشبع (بين 0 و 1)', + wrongValue: 'يرجى إدخال رقم عشري بين 0 و 1.', + }, + +}; diff --git a/i18n/translations/lang-cs.ts b/i18n/translations/lang-cs.ts new file mode 100644 index 0000000000..ce259019ed --- /dev/null +++ b/i18n/translations/lang-cs.ts @@ -0,0 +1,45 @@ +import type { Translation } from '../../models/i18n/translation'; + +export const translation: Translation = { + activate: 'Aktivovat', + activated: 'Material Icon Téma je aktivní.', + iconPacks: { + selectPack: 'Vyberte sadu ikon', + description: "Vyberte sadu ikon '%0'", + disabled: 'Zakázat balíčky ikon', + }, + folders: { + toggleIcons: 'Vyberte motiv složky', + disabled: 'Žádné ikony složek', + theme: { + description: "Vyberte motiv složky '%0'", + }, + }, + colorSelect: { + color: 'Vyberte barvu', + hexCode: 'Vložte hexadecimální kód barvy', + wrongHexCode: 'Neplatný hexadecimální kód barvy!', + }, + opacity: { + inputPlaceholder: 'Hodnota průhlednosti (od 0 do 1)', + wrongValue: 'Zadejte desetinné číslo mezi 0 a 1.', + }, + toggleSwitch: { + on: 'ZAPNUTO', + off: 'VYPNUTO', + }, + explorerArrows: { + toggle: 'Šipky složek v průzkumníkovi', + enable: 'Zobrazit šipky složek v Průzkumníkovi', + disable: 'Skrýt šipky složek v Průzkumníkovi', + }, + grayscale: { + toggle: 'Zobrazovat ikony ve stupních šedi', + enable: 'Povolit ikony ve stupních šedi', + disable: 'Zakázat ikony ve stupních šedi', + }, + saturation: { + inputPlaceholder: 'Hodnota sytosti (mezi 0 a 1)', + wrongValue: 'Zadejte desetinné číslo mezi 0 a 1.', + }, +}; diff --git a/i18n/translations/lang-de.ts b/i18n/translations/lang-de.ts new file mode 100644 index 0000000000..fdef538a65 --- /dev/null +++ b/i18n/translations/lang-de.ts @@ -0,0 +1,45 @@ +import type { Translation } from '../../models/i18n/translation'; + +export const translation: Translation = { + activate: 'Aktivieren', + activated: 'Material Icon Theme ist jetzt aktiviert.', + iconPacks: { + selectPack: 'Icon Pack auswählen', + description: "Das '%0' Icon Pack auswählen", + disabled: 'Icon Packs deaktivieren', + }, + folders: { + toggleIcons: 'Wähle ein Ordner Design', + disabled: 'Keine Ordner Icons', + theme: { + description: "Wähle das '%0' Design", + }, + }, + colorSelect: { + color: 'Wähle eine Farbe', + hexCode: 'Gebe einen HEX Farbcode ein', + wrongHexCode: 'Ungültiger HEX Farbcode', + }, + opacity: { + inputPlaceholder: 'Wert der Deckkraft (zwischen 0 und 1)', + wrongValue: 'Der Wert muss zwischen 0 und 1 liegen!', + }, + toggleSwitch: { + on: 'EIN', + off: 'AUS', + }, + explorerArrows: { + toggle: 'Pfeile im Explorer anpassen', + enable: 'Explorer Pfeile anzeigen', + disable: 'Explorer Pfeile ausblenden', + }, + grayscale: { + toggle: 'Schaltet graustufige Icons um', + enable: 'Aktiviert graustufige Icons', + disable: 'Deaktiviert graustufige Icons', + }, + saturation: { + inputPlaceholder: 'Wert der Sättigung (zwischen 0 und 1)', + wrongValue: 'Der Wert muss zwischen 0 und 1 liegen!', + }, +}; diff --git a/i18n/translations/lang-en.ts b/i18n/translations/lang-en.ts new file mode 100644 index 0000000000..98567d81a4 --- /dev/null +++ b/i18n/translations/lang-en.ts @@ -0,0 +1,45 @@ +import type { Translation } from '../../models/i18n/translation'; + +export const translation: Translation = { + activate: 'Activate', + activated: 'Material Icon Theme is active.', + iconPacks: { + selectPack: 'Select an icon pack', + description: "Select the '%0' icon pack", + disabled: 'Disable icon packs', + }, + folders: { + toggleIcons: 'Pick a folder theme', + disabled: 'No folder icons', + theme: { + description: "Select the '%0' folder theme", + }, + }, + colorSelect: { + color: 'Choose a color', + hexCode: 'Insert a HEX color code', + wrongHexCode: 'Invalid HEX color code!', + }, + opacity: { + inputPlaceholder: 'Opacity value (between 0 and 1)', + wrongValue: 'Please enter a floating-point number between 0 and 1.', + }, + toggleSwitch: { + on: 'ON', + off: 'OFF', + }, + explorerArrows: { + toggle: 'Toggle folder arrows in Explorer', + enable: 'Show folder arrows in Explorer', + disable: 'Hide folder arrows in Explorer', + }, + grayscale: { + toggle: 'Toggle grayscale icons', + enable: 'Enable grayscale icons', + disable: 'Disable grayscale icons', + }, + saturation: { + inputPlaceholder: 'Saturation value (between 0 and 1)', + wrongValue: 'Please enter a floating-point number between 0 and 1.', + }, +}; diff --git a/i18n/translations/lang-es.ts b/i18n/translations/lang-es.ts new file mode 100644 index 0000000000..e27277f59f --- /dev/null +++ b/i18n/translations/lang-es.ts @@ -0,0 +1,45 @@ +import type { Translation } from '../../models/i18n/translation'; + +export const translation: Translation = { + activate: 'Activar', + activated: 'Material Icon Theme está activado.', + iconPacks: { + selectPack: 'Seleccione un paquete de iconos', + description: "Seleccione el paquete de iconos '%0'", + disabled: 'Desactivar paquetes de iconos', + }, + folders: { + toggleIcons: 'Cambiar activación de iconos de carpetas', + disabled: 'Sin iconos de carpeta', + theme: { + description: "Iconos de carpeta '%0'", + }, + }, + colorSelect: { + color: 'Elija un color', + hexCode: 'Insertar un código de color HEX', + wrongHexCode: '¡Código de color HEX inválido!', + }, + opacity: { + inputPlaceholder: 'Valor de opacidad (entre 0 y 1)', + wrongValue: '¡El valor debe estar entre 0 y 1!', + }, + toggleSwitch: { + on: 'ON', + off: 'OFF', + }, + explorerArrows: { + toggle: 'Conmutar las flechas de carpetas', + enable: 'Mostrar flechas de carpeta', + disable: 'Ocultar las flechas de carpetas', + }, + grayscale: { + toggle: 'Alternar los iconos en escala de grises', + enable: 'Activar los iconos en escala de grises', + disable: 'Desactivar los iconos en escala de grises', + }, + saturation: { + inputPlaceholder: 'Valor de saturación (entre 0 y 1)', + wrongValue: 'El valor debe estar entre 0 y 1.', + }, +}; diff --git a/i18n/translations/lang-fr.ts b/i18n/translations/lang-fr.ts new file mode 100644 index 0000000000..b3c47480dc --- /dev/null +++ b/i18n/translations/lang-fr.ts @@ -0,0 +1,45 @@ +import type { Translation } from '../../models/i18n/translation'; + +export const translation: Translation = { + activate: 'Activer', + activated: 'Material Icon Theme est actif.', + iconPacks: { + selectPack: "Sélectionnez un pack d'icônes", + description: "Sélectionner le pack d'icônes '%0'", + disabled: "Désactiver les paquets d'icônes", + }, + folders: { + toggleIcons: 'Basculer les icônes de dossiers', + disabled: 'Aucune icônes de dossiers', + theme: { + description: "Icônes de dossiers '%0'", + }, + }, + colorSelect: { + color: 'Choisissez une couleur', + hexCode: 'Insérer un code couleur HEX', + wrongHexCode: 'Code couleur HEX non valide!', + }, + opacity: { + inputPlaceholder: "Valeur d'opacité (entre 0 et 1)", + wrongValue: 'La valeur doit être comprise entre 0 et 1!', + }, + toggleSwitch: { + on: 'ON', + off: 'OFF', + }, + explorerArrows: { + toggle: 'Basculer les flèches du dossier', + enable: 'Afficher les flèches du dossier', + disable: 'Cacher les flèches de dossier', + }, + grayscale: { + toggle: 'Basculer les icônes en niveaux de gris', + enable: 'Activer les icônes en niveaux de gris', + disable: 'Désactiver les icônes en niveaux de gris', + }, + saturation: { + inputPlaceholder: 'Valeur de saturation (entre 0 et 1)', + wrongValue: 'La valeur doit être comprise entre 0 et 1 !', + }, +}; diff --git a/i18n/translations/lang-id.ts b/i18n/translations/lang-id.ts new file mode 100644 index 0000000000..78b2090289 --- /dev/null +++ b/i18n/translations/lang-id.ts @@ -0,0 +1,45 @@ +import type { Translation } from '../../models/i18n/translation'; + +export const translation: Translation = { + activate: 'Aktifkan', + activated: 'Tema Ikon Material aktif.', + iconPacks: { + selectPack: 'Pilih paket ikon', + description: "Pilih paket ikon '%0'", + disabled: 'Nonaktifkan paket ikon', + }, + folders: { + toggleIcons: 'Pilih tema folder', + disabled: 'Tidak ada ikon folder', + theme: { + description: "Pilih tema folder '%0'", + }, + }, + colorSelect: { + color: 'Pilih warna', + hexCode: 'Masukkan kode warna HEX', + wrongHexCode: 'Kode warna HEX tidak valid!', + }, + opacity: { + inputPlaceholder: 'Nilai opasitas (antara 0 dan 1)', + wrongValue: 'Silakan masukkan angka desimal antara 0 dan 1.', + }, + toggleSwitch: { + on: 'AKTIF', + off: 'NONAKTIF', + }, + explorerArrows: { + toggle: 'Alihkan panah folder di Explorer', + enable: 'Tampilkan panah folder di Explorer', + disable: 'Sembunyikan panah folder di Explorer', + }, + grayscale: { + toggle: 'Alihkan ikon grayscale', + enable: 'Aktifkan ikon grayscale', + disable: 'Nonaktifkan ikon grayscale', + }, + saturation: { + inputPlaceholder: 'Nilai saturasi (antara 0 dan 1)', + wrongValue: 'Silakan masukkan angka desimal antara 0 dan 1.', + }, +}; diff --git a/i18n/translations/lang-it.ts b/i18n/translations/lang-it.ts new file mode 100644 index 0000000000..e511e05c7f --- /dev/null +++ b/i18n/translations/lang-it.ts @@ -0,0 +1,45 @@ +import type { Translation } from '../../models/i18n/translation'; + +export const translation: Translation = { + activate: 'Attiva', + activated: 'Material Icon Theme è attivo.', + iconPacks: { + selectPack: 'Seleziona un pacchetto icone', + description: "Seleziona il pacchetto icone '%0'", + disabled: 'Disabilita pacchetti delle icone', + }, + folders: { + toggleIcons: 'Scegli un tema per le cartelle', + disabled: 'Nessuna icona cartella', + theme: { + description: "Seleziona il tema cartelle '%0'", + }, + }, + colorSelect: { + color: 'Scegli un colore', + hexCode: 'Inserisci un codice HEX', + wrongHexCode: 'Codice HEX non valido!', + }, + opacity: { + inputPlaceholder: 'Valore opacità (tra 0 e 1)', + wrongValue: 'Inserisci un numero decimale tra 0 e 1.', + }, + toggleSwitch: { + on: 'ON', + off: 'OFF', + }, + explorerArrows: { + toggle: 'Attiva/Disattiva frecce cartelle in Explorer', + enable: 'Mostra le frecce nelle cartelle in Explorer', + disable: 'Nascondi le frecce nelle cartelle in Explorer', + }, + grayscale: { + toggle: 'Attiva/Disattiva icone in scala di grigi', + enable: 'Abilita icone in scala di grigi', + disable: 'Disabilita icone in scala di grigi', + }, + saturation: { + inputPlaceholder: 'Valore saturazione (tra 0 e 1)', + wrongValue: 'Inserisci un numero decimale tra 0 e 1.', + }, +}; diff --git a/i18n/translations/lang-ja.ts b/i18n/translations/lang-ja.ts new file mode 100644 index 0000000000..e93f7d41fd --- /dev/null +++ b/i18n/translations/lang-ja.ts @@ -0,0 +1,45 @@ +import type { Translation } from '../../models/i18n/translation'; + +export const translation: Translation = { + activate: '有効化', + activated: 'Material Icon Theme は有効です。', + iconPacks: { + selectPack: 'アイコンパックを選択する', + description: "アイコンパック '%0' を選択する", + disabled: 'アイコンパックを無効化する', + }, + folders: { + toggleIcons: 'フォルダーアイコンを切り替える', + disabled: 'フォルダーアイコンを表示しない', + theme: { + description: "フォルダーテーマ '%0' を選択する", + }, + }, + colorSelect: { + color: '色を変える', + hexCode: 'HEX カラーコードを入力する', + wrongHexCode: '無効な HEX カラーコードです!', + }, + opacity: { + inputPlaceholder: '不透明度(0〜1)', + wrongValue: '値は0から1の間にしてください!', + }, + toggleSwitch: { + on: 'ON', + off: 'OFF', + }, + explorerArrows: { + toggle: 'フォルダーの矢印を切り替える', + enable: 'フォルダーの矢印を表示する', + disable: 'フォルダーの矢印を隠す', + }, + grayscale: { + toggle: 'グレースケールアイコンを切り替える', + enable: 'グレースケールアイコンを有効にする', + disable: 'グレースケールアイコンを無効にする', + }, + saturation: { + inputPlaceholder: '彩度(0〜1)', + wrongValue: '値は0から1の間にしてください!', + }, +}; diff --git a/i18n/translations/lang-ko.ts b/i18n/translations/lang-ko.ts new file mode 100644 index 0000000000..ae46858310 --- /dev/null +++ b/i18n/translations/lang-ko.ts @@ -0,0 +1,45 @@ +import type { Translation } from '../../models/i18n/translation'; + +export const translation: Translation = { + activate: '활성화', + activated: 'Material Icon Theme이 활성화되었습니다.', + iconPacks: { + selectPack: '아이콘 팩 선택', + description: "'%0' 아이콘 팩 선택", + disabled: '아이콘 팩 비활성화', + }, + folders: { + toggleIcons: '폴더 테마 선택', + disabled: '폴더 아이콘 없음', + theme: { + description: "'%0' 폴더 테마 선택", + }, + }, + colorSelect: { + color: '색상 선택', + hexCode: 'HEX 색상 코드 입력', + wrongHexCode: '유효하지 않은 HEX 색상 코드입니다!', + }, + opacity: { + inputPlaceholder: '투명도 값 (0과 1 사이)', + wrongValue: '0과 1 사이의 부동 소수점 숫자를 입력하세요.', + }, + toggleSwitch: { + on: '켜짐', + off: '꺼짐', + }, + explorerArrows: { + toggle: '파일 탐색기의 폴더 화살표 설정', + enable: '파일 탐색기의 폴더 화살표 표시', + disable: '파일 탐색기의 폴더 화살표 숨기기', + }, + grayscale: { + toggle: '그레이스케일 아이콘 설정', + enable: '그레이스케일 아이콘 활성화', + disable: '그레이스케일 아이콘 비활성화', + }, + saturation: { + inputPlaceholder: '채도 값 (0과 1 사이)', + wrongValue: '0과 1 사이의 부동 소수점 숫자를 입력하세요.', + }, +}; diff --git a/i18n/translations/lang-nl.ts b/i18n/translations/lang-nl.ts new file mode 100644 index 0000000000..77fa55285c --- /dev/null +++ b/i18n/translations/lang-nl.ts @@ -0,0 +1,45 @@ +import type { Translation } from '../../models/i18n/translation'; + +export const translation: Translation = { + activate: 'Activeer', + activated: 'Material Icon Thema is actief.', + iconPacks: { + selectPack: 'Selecteer een iconpakket', + description: "Selecteer het '%0' iconpakket", + disabled: 'Zet iconpaketten uit', + }, + folders: { + toggleIcons: 'Kies een folderthema', + disabled: 'Geen foldericons', + theme: { + description: "Selecteer het '%0' folderthema", + }, + }, + colorSelect: { + color: 'Kies een kleur', + hexCode: 'Voeg een HEX kleurcode in', + wrongHexCode: 'Ongeldige HEX kleurcode!', + }, + opacity: { + inputPlaceholder: 'Doorzichtbaarheidswaarde (tussen 0 en 1)', + wrongValue: 'De waarde moet tussen de 0 en 1 zijn!', + }, + toggleSwitch: { + on: 'AAN', + off: 'UIT', + }, + explorerArrows: { + toggle: 'Zet folderpijlen aan of uit', + enable: 'Laat folderpijlen zien', + disable: 'Verberg folderpijlen', + }, + grayscale: { + toggle: 'Zet grijsgetinte icons aan of uit', + enable: 'Zet grijsgetinte icons aan', + disable: 'Zet grijsgetinte icons uit', + }, + saturation: { + inputPlaceholder: 'Saturatiewaarde (tussen 0 en 1)', + wrongValue: 'De waarde moet tussen de 0 en 1 zijn!', + }, +}; diff --git a/i18n/translations/lang-pl.ts b/i18n/translations/lang-pl.ts new file mode 100644 index 0000000000..d44fe024da --- /dev/null +++ b/i18n/translations/lang-pl.ts @@ -0,0 +1,45 @@ +import type { Translation } from '../../models/i18n/translation'; + +export const translation: Translation = { + activate: 'Aktywuj', + activated: 'Motyw Material Icon jest aktywny.', + iconPacks: { + selectPack: 'Wybierz paczkę ikon', + description: "Wybierz paczkę ikon '%0'", + disabled: 'Wyłącz paczki ikon', + }, + folders: { + toggleIcons: 'Wybierz motyw folderów', + disabled: 'Brak ikon folderów', + theme: { + description: "Wybierz motyw folderów '%0'", + }, + }, + colorSelect: { + color: 'Wybierz kolor', + hexCode: 'Podaj kolor w formacie HEX', + wrongHexCode: 'Nieprawidłowy kolor HEX!', + }, + opacity: { + inputPlaceholder: 'Wartość przezroczystości (pomiędzy 0 a 1)', + wrongValue: 'Wartość musi być pomiędzy 0 i 1!', + }, + toggleSwitch: { + on: 'WŁĄCZONE', + off: 'WYŁĄCZONE', + }, + explorerArrows: { + toggle: 'Przełącz strzałki przy folderach', + enable: 'Pokaż strzałki przy folderach', + disable: 'Schowaj strzałki przy folderach', + }, + grayscale: { + toggle: 'Przełącz czarno-białe ikony', + enable: 'Włącz czarno-białe ikony', + disable: 'Wyłącz czarno-białe ikony', + }, + saturation: { + inputPlaceholder: 'Wartość nasycenia (pomiędzy 0 a 1)', + wrongValue: 'Wartość musi być pomiędzy 0 i 1!', + }, +}; diff --git a/i18n/translations/lang-pt-br.ts b/i18n/translations/lang-pt-br.ts new file mode 100644 index 0000000000..ecbbe3fcda --- /dev/null +++ b/i18n/translations/lang-pt-br.ts @@ -0,0 +1,45 @@ +import type { Translation } from '../../models/i18n/translation'; + +export const translation: Translation = { + activate: 'Ativar', + activated: 'O Material Icon Theme está ativo.', + iconPacks: { + selectPack: 'Selecione um pacote de ícones', + description: "Selecionar o pacote de ícones '%0'", + disabled: 'Desabilitar pacotes de ícones', + }, + folders: { + toggleIcons: 'Escolha um tema para as pastas', + disabled: 'Nenhum ícone de pasta', + theme: { + description: "Selecionar o tema para pastas '%0'", + }, + }, + colorSelect: { + color: 'Escolha uma cor', + hexCode: 'Insira um código de cor hexadecimal', + wrongHexCode: 'Código de cor hexadecimal inválido!', + }, + opacity: { + inputPlaceholder: 'Valor de opacidade (entre 0 e 1)', + wrongValue: 'O valor deve estar entre 0 e 1!', + }, + toggleSwitch: { + on: 'ON', + off: 'OFF', + }, + explorerArrows: { + toggle: 'Alternar setas do explorador de arquivos', + enable: 'Exibir setas do explorador de arquivos', + disable: 'Ocultar setas do explorador de arquivos', + }, + grayscale: { + toggle: 'Alternar os ícones em escala de cinza', + enable: 'Habilitar ícones em escala de cinza', + disable: 'Desativar ícones em escala de cinza', + }, + saturation: { + inputPlaceholder: 'Valor de saturação (entre 0 e 1)', + wrongValue: 'O valor deve estar entre 0 e 1!', + }, +}; diff --git a/i18n/translations/lang-pt-pt.ts b/i18n/translations/lang-pt-pt.ts new file mode 100644 index 0000000000..ba093f7c98 --- /dev/null +++ b/i18n/translations/lang-pt-pt.ts @@ -0,0 +1,45 @@ +import type { Translation } from '../../models/i18n/translation'; + +export const translation: Translation = { + activate: 'Habilitar', + activated: 'O Material Icon Theme está habilitado.', + iconPacks: { + selectPack: 'Seleccione um pacote de ícones', + description: "Seleccionar o pacote de ícones '%0'", + disabled: 'Desabilitar pacotes de ícones', + }, + folders: { + toggleIcons: 'Escolhe um tema para os directórios', + disabled: 'Nenhum ícone do directório', + theme: { + description: "Seleccionar o tema para directórios '%0'", + }, + }, + colorSelect: { + color: 'Escolhe uma cor', + hexCode: 'Insira um código de cor hexadecimal', + wrongHexCode: 'Código de cor hexadecimal inválido!', + }, + opacity: { + inputPlaceholder: 'Valor de opacidade (entre 0 e 1)', + wrongValue: 'O valor deve estar entre 0 e 1!', + }, + toggleSwitch: { + on: 'ON', + off: 'OFF', + }, + explorerArrows: { + toggle: 'Alternar setas do explorador de ficheiros', + enable: 'Exibir setas do explorador de ficheiros', + disable: 'Ocultar setas do explorador de ficheiros', + }, + grayscale: { + toggle: 'Alternar ícones em escala de cinzentos', + enable: 'Habilitar ícones em escala de cinzentos', + disable: 'Desactivar ícones em escala de cinzentos', + }, + saturation: { + inputPlaceholder: 'Valor de saturação (entre 0 e 1)', + wrongValue: 'O valor deve estar entre 0 e 1!', + }, +}; diff --git a/i18n/translations/lang-ru.ts b/i18n/translations/lang-ru.ts new file mode 100644 index 0000000000..f30c909112 --- /dev/null +++ b/i18n/translations/lang-ru.ts @@ -0,0 +1,45 @@ +import type { Translation } from '../../models/i18n/translation'; + +export const translation: Translation = { + activate: 'Активировать', + activated: 'Material Icon Theme активен.', + iconPacks: { + selectPack: 'Выбрать набор иконок', + description: "Выбрать '%0' набор иконок", + disabled: 'Выключить набор иконок', + }, + folders: { + toggleIcons: 'Выбрать тему папки', + disabled: 'Нет иконок для папки', + theme: { + description: "Выбрать '%0' тему папки", + }, + }, + colorSelect: { + color: 'Выберите цвет', + hexCode: 'Вставить HEX-код цвета', + wrongHexCode: 'Неверный HEX-код цвета!', + }, + opacity: { + inputPlaceholder: 'Значение непрозрачности (между 0 и 1)', + wrongValue: 'Значение должно быть между 0 и 1!', + }, + toggleSwitch: { + on: 'Включить', + off: 'Выключить', + }, + explorerArrows: { + toggle: 'Показать/скрыть стрелки у папок', + enable: 'Показать стрелки у папок', + disable: 'Скрыть стрелки у папок', + }, + grayscale: { + toggle: 'Переключение серых значков', + enable: 'Включить значки в оттенках серого', + disable: 'Отключить значки в оттенках серого', + }, + saturation: { + inputPlaceholder: 'Значение насыщенности (между 0 и 1)', + wrongValue: 'Значение должно быть между 0 и 1!', + }, +}; diff --git a/i18n/translations/lang-uk.ts b/i18n/translations/lang-uk.ts new file mode 100644 index 0000000000..982d509750 --- /dev/null +++ b/i18n/translations/lang-uk.ts @@ -0,0 +1,45 @@ +import type { Translation } from '../../models/i18n/translation'; + +export const translation: Translation = { + activate: 'Активувати', + activated: 'Material Icon Theme активований.', + iconPacks: { + selectPack: 'Виберіть набір іконок', + description: "Виберіть набір значків '%0'", + disabled: 'Вимкнути пакети значків', + }, + folders: { + toggleIcons: 'Переключити теку icons', + disabled: 'Немає піктограм папок', + theme: { + description: "Виберіть тему папки '%0'", + }, + }, + colorSelect: { + color: 'Виберіть колір', + hexCode: 'Введіть HEX колірний код', + wrongHexCode: 'Недійсний HEX колірний код!', + }, + opacity: { + inputPlaceholder: 'Значення непрозорості (від 0 до 1)', + wrongValue: 'Значення має бути від 0 до 1!', + }, + toggleSwitch: { + on: 'Включити', + off: 'Відключити', + }, + explorerArrows: { + toggle: 'Стрілки для перемикання папок', + enable: 'Показати стрілки папки', + disable: 'Приховати стрілки папки', + }, + grayscale: { + toggle: 'Перемикання значків у відтінках сірого', + enable: 'Увімкнути значки у відтінках сірого', + disable: 'Вимкнути значки у відтінках сірого', + }, + saturation: { + inputPlaceholder: 'Значення насичення (від 0 до 1)', + wrongValue: 'Значення має бути від 0 до 1!', + }, +}; diff --git a/i18n/translations/lang-zh-cn.ts b/i18n/translations/lang-zh-cn.ts new file mode 100644 index 0000000000..033a4612f2 --- /dev/null +++ b/i18n/translations/lang-zh-cn.ts @@ -0,0 +1,45 @@ +import type { Translation } from '../../models/i18n/translation'; + +export const translation: Translation = { + activate: '激活', + activated: 'Material主题图标已激活', + iconPacks: { + selectPack: '选择图标包', + description: '选择%0符号', + disabled: '禁用图标包', + }, + folders: { + toggleIcons: '切换文件夹图标的显示', + disabled: '不显示文件夹图标', + theme: { + description: "'%0'主题的文件夹图标", + }, + }, + colorSelect: { + color: '选择颜色', + hexCode: '插入HEX颜色代码', + wrongHexCode: '无效的HEX颜色代码!', + }, + opacity: { + inputPlaceholder: '不透明度值(0和1之间)', + wrongValue: '该值必须介于0和1之间!', + }, + toggleSwitch: { + on: 'ON', + off: 'OFF', + }, + explorerArrows: { + toggle: '切换文件夹箭头', + enable: '显示文件夹箭头', + disable: '隐藏文件夹箭头', + }, + grayscale: { + toggle: '切换灰度图标', + enable: '启用灰度图标', + disable: '禁用灰度图标', + }, + saturation: { + inputPlaceholder: '饱和度值(在0和1之间)。', + wrongValue: '该值必须在0和1之间!', + }, +}; diff --git a/i18n/translations/lang-zh-tw.ts b/i18n/translations/lang-zh-tw.ts new file mode 100644 index 0000000000..818b1d73e3 --- /dev/null +++ b/i18n/translations/lang-zh-tw.ts @@ -0,0 +1,45 @@ +import type { Translation } from '../../models/i18n/translation'; + +export const translation: Translation = { + activate: '啟用', + activated: 'Material Icon Theme 已啟用。', + iconPacks: { + selectPack: '選取圖示套件', + description: '選取「%0」圖示套件', + disabled: '停用圖示套件', + }, + folders: { + toggleIcons: '選取資料夾佈景主題', + disabled: '無資料夾圖示', + theme: { + description: '選取「%0」資料夾佈景主題', + }, + }, + colorSelect: { + color: '選擇色彩', + hexCode: '插入十六進位色彩代碼', + wrongHexCode: '無效的十六進位色彩代碼!', + }, + opacity: { + inputPlaceholder: '不透明度值 (介於 0 到 1 之間)', + wrongValue: '請輸入介於 0 到 1 之間的浮點數。', + }, + toggleSwitch: { + on: '開啟', + off: '關閉', + }, + explorerArrows: { + toggle: '切換檔案總管中的資料夾箭頭圖示', + enable: '顯示檔案總管中的資料夾箭頭圖示', + disable: '隱藏檔案總管中的資料夾箭頭圖示', + }, + grayscale: { + toggle: '切換灰階圖示', + enable: '啟用灰階圖示', + disable: '停用灰階圖示', + }, + saturation: { + inputPlaceholder: '飽和度值 (介於 0 到 1 之間)', + wrongValue: '請輸入介於 0 到 1 之間的浮點數。', + }, +}; diff --git a/package.nls.ar.json b/package.nls.ar.json new file mode 100644 index 0000000000..882650059c --- /dev/null +++ b/package.nls.ar.json @@ -0,0 +1,53 @@ +{ + "command.activateIcons": "Material Icons: تفعيل سمة الأيقونات", + "command.toggleIconPacks": "Material Icons: إعداد حزم الأيقونات", + "command.changeFolderTheme": "Material Icons: تغيير سمة المجلد", + "command.changeFolderColor": "Material Icons: تغيير لون المجلد", + "command.changeRootFolderColor": "Material Icons: تغيير لون المجلد الرئيسي", + "command.changeFileColor": "Material Icons: تغيير لون الملف", + "command.restoreDefaultConfig": "Material Icons: استعادة الإعدادات الافتراضية", + "command.toggleExplorerArrows": "Material Icons: إظهار أو إخفاء أسهم المستكشف", + "command.changeOpacity": "Material Icons: تغيير شفافية الأيقونات", + "command.toggleGrayscale": "Material Icons: تشغيل أو إيقاف التدرج الرمادي", + "command.changeSaturation": "Material Icons: تغيير تشبع الألوان", + "configuration.title": "أيقونات Material", + "configuration.files.associations": "تعيين ارتباطات مخصصة لأيقونات الملفات.", + "configuration.folders.associations": "تعيين ارتباطات مخصصة لأيقونات المجلدات.", + "configuration.rootFolders.associations": "تعيين ارتباطات مخصصة لأيقونات المجلدات الرئيسية.", + "configuration.languages.associations": "تعيين ارتباطات مخصصة لأيقونات لغات البرمجة.", + "configuration.customClones": "استنساخ أيقونة موجودة وإنشاء أيقونة جديدة بألوان وارتباطات مخصصة", + "configuration.customClones.base": "الأيقونة المستخدمة كأساس لإنشاء الأيقونة المخصصة", + "configuration.customClones.name": "اسم الأيقونة المخصصة", + "configuration.customClones.color": "اللون المستخدم كأساس لإعادة تلوين الأيقونة", + "configuration.customClones.lightColor": "اللون المستخدم لإعادة التلوين عند استخدام السمة الفاتحة", + "configuration.customClones.fileNames": "أسماء الملفات المرتبطة بالأيقونة المخصصة", + "configuration.customClones.fileExtensions": "امتدادات الملفات المرتبطة بالأيقونة المخصصة", + "configuration.customClones.folderNames": "أسماء المجلدات المرتبطة بالأيقونة المخصصة", + "configuration.customClones.rootFolderNames": "أسماء المجلدات الرئيسية المرتبطة بالأيقونة المخصصة", + "configuration.customClones.ids": "معرفات اللغات المرتبطة بالأيقونة المخصصة", + "configuration.customClones.activeForPacks": "يتم إنشاء هذه النسخة فقط عندما تكون حزمة الأيقونات النشطة من بين هذه الحزم.", + "configuration.activeIconPack": "اختر حزمة الأيقونات التي تفعّل أيقونات محددة.", + "configuration.activeIconPack.angular": "أيقونات خاصة بـ Angular.", + "configuration.activeIconPack.angular_ngrx": "أيقونات خاصة بـ Angular و ngrx.", + "configuration.activeIconPack.react": "أيقونات خاصة بـ React.", + "configuration.activeIconPack.react_redux": "أيقونات خاصة بـ React و Redux.", + "configuration.activeIconPack.roblox": "أيقونات خاصة بـ Roblox.", + "configuration.activeIconPack.qwik": "أيقونات خاصة بـ Qwik.", + "configuration.activeIconPack.vue": "أيقونات خاصة بـ Vue.", + "configuration.activeIconPack.vue_vuex": "أيقونات خاصة بـ Vue و Vuex.", + "configuration.activeIconPack.nest": "أيقونات خاصة بـ NestJS.", + "configuration.activeIconPack.bashly": "أيقونات خاصة بـ Bashly.", + "configuration.activeIconPack.none": "لا توجد حزمة أيقونات مفعّلة.", + "configuration.folders.theme": "تحديد نوع أيقونات المجلد.", + "configuration.folders.theme.specific": "اختيار أيقونات مجلدات محددة.", + "configuration.folders.theme.classic": "اختيار أيقونات مجلدات كلاسيكية.", + "configuration.folders.theme.none": "بدون أيقونات للمجلدات.", + "configuration.folders.color": "تغيير لون أيقونات المجلدات.", + "configuration.rootFolders.color": "تغيير لون أيقونات المجلدات الرئيسية.", + "configuration.files.color": "تغيير لون أيقونات الملفات.", + "configuration.hidesExplorerArrows": "إخفاء أسهم المستكشف قبل المجلد.", + "configuration.opacity": "تغيير شفافية الأيقونات.", + "configuration.saturation": "تغيير تشبع الألوان.", + "configuration.enableLogging": "تفعيل تسجيل السجلات في قناة الإخراج.", + "configuration.logLevel": "تحديد مستوى السجل لرسائل الإخراج." +} \ No newline at end of file diff --git a/src/core/i18n/translate.ts b/src/core/i18n/translate.ts index b21ee61069..9d92799a4a 100644 --- a/src/core/i18n/translate.ts +++ b/src/core/i18n/translate.ts @@ -1,6 +1,7 @@ import { get } from '../helpers/object'; import { logger } from '../logging/logger'; import type { Translation } from '../models/i18n/translation'; +import { translation as langAr } from './translations/lang-ar'; import { translation as langCs } from './translations/lang-cs'; import { translation as langDe } from './translations/lang-de'; import { translation as langEn } from './translations/lang-en'; @@ -19,6 +20,7 @@ import { translation as langUk } from './translations/lang-uk'; import { translation as langZhCn } from './translations/lang-zh-cn'; import { translation as langZhTw } from './translations/lang-zh-tw'; + let currentTranslation: Translation; let fallbackTranslation: Translation; @@ -47,6 +49,8 @@ const loadTranslation = async (language: string) => { /** Get the translation object of the separated translation files */ const getTranslationObject = async (language: string): Promise => { switch (language) { + case 'ar': + return langAr; case 'cs': return langCs; case 'de': diff --git a/src/core/i18n/translations/lang-ar.ts b/src/core/i18n/translations/lang-ar.ts new file mode 100644 index 0000000000..5fb65daaae --- /dev/null +++ b/src/core/i18n/translations/lang-ar.ts @@ -0,0 +1,46 @@ +import type { Translation } from '../../models/i18n/translation'; + +export const translation: Translation = { + activate: 'تفعيل', + activated: 'تم تفعيل Material Icon Theme.', + iconPacks: { + selectPack: 'اختر حزمة الأيقونات', + description: "اختر حزمة الأيقونات '%0'", + disabled: 'تعطيل حزم الأيقونات', + }, + folders: { + toggleIcons: 'اختر سمة المجلد', + disabled: 'بدون أيقونات مجلدات', + theme: { + description: "اختر سمة المجلد '%0'", + }, + }, + colorSelect: { + color: 'اختر لونًا', + hexCode: 'أدخل كود لون HEX', + wrongHexCode: 'كود HEX غير صالح!', + }, + opacity: { + inputPlaceholder: 'قيمة الشفافية (بين 0 و 1)', + wrongValue: 'يرجى إدخال رقم عشري بين 0 و 1.', + }, + toggleSwitch: { + on: 'تشغيل', + off: 'إيقاف', + }, + explorerArrows: { + toggle: 'تبديل أسهم المجلدات في المستكشف', + enable: 'إظهار أسهم المجلدات في المستكشف', + disable: 'إخفاء أسهم المجلدات في المستكشف', + }, + grayscale: { + toggle: 'تبديل الأيقونات الرمادية', + enable: 'تفعيل الأيقونات الرمادية', + disable: 'تعطيل الأيقونات الرمادية', + }, + saturation: { + inputPlaceholder: 'قيمة التشبع (بين 0 و 1)', + wrongValue: 'يرجى إدخال رقم عشري بين 0 و 1.', + }, + +};