From b03198abd99da3b0d7728ecae2150d7f71913bae Mon Sep 17 00:00:00 2001 From: advplyr Date: Thu, 18 Apr 2024 17:06:12 -0500 Subject: [PATCH] Add comments/jsdocs to i18n.js --- client/plugins/i18n.js | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/client/plugins/i18n.js b/client/plugins/i18n.js index a13675c9..8b930bc3 100644 --- a/client/plugins/i18n.js +++ b/client/plugins/i18n.js @@ -50,14 +50,22 @@ Vue.prototype.$podcastSearchRegionOptions = Object.keys(podcastSearchRegionMap). }) Vue.prototype.$languageCodes = { - default: defaultCode, - current: defaultCode, - local: null, - server: null + default: defaultCode, // en-us + current: defaultCode, // Current language code in use + local: null, // Language code set at user level + server: null // Language code set at server level } +// Currently loaded strings (default enUS) Vue.prototype.$strings = { ...enUsStrings } +/** + * Get string and substitute + * + * @param {string} key + * @param {string[]} subs + * @returns {string} + */ Vue.prototype.$getString = (key, subs) => { if (!Vue.prototype.$strings[key]) return '' if (subs?.length && Array.isArray(subs)) { @@ -66,7 +74,7 @@ Vue.prototype.$getString = (key, subs) => { return Vue.prototype.$strings[key] } -var translations = { +const translations = { [defaultCode]: enUsStrings }