From e4c785de339b45969280a9c555e91176e2b015aa Mon Sep 17 00:00:00 2001 From: root Date: Mon, 25 Apr 2022 12:57:50 +0530 Subject: [PATCH] Add support for Indonesian and refactor a little bit --- src/plugins/i18n.js | 15 +++++++++++---- src/styles/main.scss | 2 +- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/plugins/i18n.js b/src/plugins/i18n.js index ae6d409..30e6bc7 100644 --- a/src/plugins/i18n.js +++ b/src/plugins/i18n.js @@ -32,6 +32,10 @@ export const LANGUAGE_OPTIONS = [ value: 'es', text: 'Spanish' }, + { + value: 'id', + text: 'Indonesian' + }, { value: 'zh-Hans', text: 'Chinese (Simplified, only loads the font)' @@ -118,21 +122,22 @@ export const COUNTRY_I18N_EXCEPTIONS = { // Similar switches for RTL can be found in the i18n store async function syncStylesPerLanguage (locale) { switch (locale) { - // All the latin languages + // All the Inter-based languages + case 'cs': case 'de': case 'en': case 'el': case 'es': + case 'id': case 'fr': case 'lt': case 'ml': case 'tr': - case 'cs': case 'ru': case 'bn-Latn': - // Don't need to import fonts because Latin fonts are always loaded + // Don't need to import fonts because Inter supports Latin and Cyrillic and is always loaded document.body.classList.remove(...document.body.classList) - document.body.classList.add('latin') + document.body.classList.add('default-font') break // Bengali script case 'bn-Beng': @@ -168,6 +173,8 @@ async function syncStylesPerLanguage (locale) { document.body.classList.remove(...document.body.classList) document.body.classList.add('korean') break + default: + throw new Error('Invalid language') } } diff --git a/src/styles/main.scss b/src/styles/main.scss index 7d09a43..3c0ebc5 100644 --- a/src/styles/main.scss +++ b/src/styles/main.scss @@ -18,7 +18,7 @@ word-break: normal !important; } -.latin { +.default-font { @include addFonts('Antar'); }