Skip to content

Commit

Permalink
Add/fix 'language' translation + add to UI
Browse files Browse the repository at this point in the history
  • Loading branch information
benoit74 committed Nov 27, 2024
1 parent 72e106e commit 554a72f
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 8 deletions.
2 changes: 1 addition & 1 deletion locales/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"Sinopsistrans"
]
},
"language": "Inglés",
"language": "Español",
"faq": {
"whatIsZim": "¿Qué es un archivo ZIM?",
"whatIsZimDescParagraph": "El formato de archivo ZIM almacena el contenido de un sitio web para su uso {0}. Reúne el contenido normal de un sitio web en un único archivo y lo comprime para que sea más fácil guardarlo, compartirlo y almacenarlo.",
Expand Down
1 change: 1 addition & 0 deletions locales/fa.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"@metadata": {
"authors": []
},
"language": "فارسی",
"faq": {
"whatIsZim": "فایل ZIM چیست؟",
"whatIsZimDescParagraph": "فرمت فایل ZIM محتوای وب‌سایت را برای استفاده {0} ذخیره می‌کند. این فرمت اجزای اصلی یک وب‌سایت را در یک آرشیو واحد جمع‌آوری و فشرده می‌کند تا ذخیره، اشتراک‌گذاری و نگهداری آن آسان‌تر شود.",
Expand Down
2 changes: 1 addition & 1 deletion locales/id.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"Akmaie Ajam"
]
},
"language": "Bahasa Inggris",
"language": "Bahasa Indonesia",
"faq": {
"whatIsZim": "Apa itu berkas ZIM?",
"whatIsZimDescParagraph": "Format berkas ZIM menyimpan konten situs web untuk penggunaan {0}. Format ini menyusun unsur-unsur normal situs web menjadi satu arsip, dan mengompresnya agar lebih mudah disimpan, dibagi, dan disimpan.",
Expand Down
1 change: 1 addition & 0 deletions locales/mk.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"Bjankuloski06"
]
},
"language": "македонски",
"faq": {
"whatIsZim": "Што е тоа ZIM-податотека?",
"whatIsZimDescParagraph": "Форматот на ZIM-податотеката ја складира содржината на мрежното место за употреба на {0}. Ја собира нормалната составница на мрежното место во еден архив, и ја збива за да биде полесна за зачувување, споделување и складирање.",
Expand Down
1 change: 1 addition & 0 deletions locales/sq.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"Besnik b"
]
},
"language": "shqip",
"faq": {
"whatIsZim": "Ç’është një kartelë ZIM?",
"whatIsZimDescParagraph": "Formati ZIM i kartelave depoziton lëndën e sajtit për përdorim {0}. Grumbullon në një arkiv të vetëm pjesët përbërëse të një sajti dhe e ngjesh atë, për ta bërë më të kollajtë të ruhet, ndahet me të tjerët dhe depozitohet.",
Expand Down
16 changes: 10 additions & 6 deletions ui/src/i18n.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,23 @@ const localesFiles = import.meta.glob('../../locales/*.json')
// Display name must be in native language. Display name must start with an upper-character.
// It should be provided by the translator under `language` key. If not, you might source proper values from https://w.wiki/C7AQ since Translate Wiki uses IETF codes
export const supportedLanguages: Language[] = [
{ code: 'en', display: 'English', rtl: false }, // Keep default first in array
{ code: 'en', display: 'English', rtl: false },
{ code: 'es', display: 'Español', rtl: false },
{ code: 'fa', display: 'فارسی', rtl: true },
{ code: 'fr', display: 'Français', rtl: false },
{ code: 'es', display: 'Español', rtl: false },
{ code: 'id', display: 'Bahasa Indonesia', rtl: false },
// { code: 'ko', display: '한국어', rtl: false },
// { code: 'lb', display: 'Lëtzebuergesch', rtl: false },
// { code: 'mk', display: 'македонски', rtl: false }
// { code: 'sq', display: 'shqip', rtl: false },
{ code: 'zh-hans', display: '简体中文', rtl: false }
// { code: 'ko', display: 'Korean', rtl: false },
// { code: 'lb', display: 'Luxembourgish', rtl: false },
// { code: 'mk', display: 'Macedonian', rtl: false }
]

// Check if browser language is supported, otherwise fallback to English
const defaultLanguage: Language =
supportedLanguages.find((lang) => lang.code == simplifiedBrowserLanguage) || supportedLanguages[0]
supportedLanguages.find((lang) => lang.code == simplifiedBrowserLanguage) ||
supportedLanguages.find((lang) => lang.code == 'en') ||
supportedLanguages[0]

// Create the i18n system
const i18n = createI18n({
Expand Down

0 comments on commit 554a72f

Please sign in to comment.