diff options
| author | Adrien Hopkins <[email protected]> | 2022-07-29 16:03:54 -0500 |
|---|---|---|
| committer | Adrien Hopkins <[email protected]> | 2022-07-29 16:03:54 -0500 |
| commit | 3b216dd6c170a7d71d21a391098c554008c8bdb4 (patch) | |
| tree | ac5722050e3fdbbc55fb470243974bb93f0f3c14 /src/lib | |
| parent | 92d79f9900298e3e775d7089b25e815077f4c0f7 (diff) | |
| download | coinos-ui-3b216dd6c170a7d71d21a391098c554008c8bdb4.tar.gz coinos-ui-3b216dd6c170a7d71d21a391098c554008c8bdb4.zip | |
Removed i18n.js documentation (am going to do it a different way)
Diffstat (limited to 'src/lib')
| -rw-r--r-- | src/lib/i18n.js | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/src/lib/i18n.js b/src/lib/i18n.js index 5232a399..0600a2a8 100644 --- a/src/lib/i18n.js +++ b/src/lib/i18n.js @@ -1,25 +1,17 @@ import { register, init, getLocaleFromNavigator } from 'svelte-i18n'; -/** The list of locales to look for */ +// The list of locales to look for const localeCodes = ['en', 'fr']; -/** The directory where locale files are stored */ +// The directory where locale files are stored const localeDirectory = "../locales"; -/** - * Adds a new locale from the appropriate JSON file - * @param {string} localeCode - the code of the locale to add - */ +// Adds a new locale based on its code function addLocale(localeCode) { register(localeCode, () => import(`${localeDirectory}/${localeCode}.json`)); } -/** - * Determines the default locale. - * @param {string} navigatorLocale - the locale given by the navigator - * @param {array<string>} avalableLocales - a list of the available locales - * @returns {string} chosen default locale - */ +// Picks the default locale based on navigator locale and the list of available locales function pickLocale(navigatorLocale, availableLocales) { // determine langugage part of locale // (e.g. if navigatorLocale is 'en-US', languageCode is 'en') |
