Add comments/jsdocs to i18n.js

This commit is contained in:
advplyr 2024-04-18 17:06:12 -05:00
parent ad30977781
commit b03198abd9

View File

@ -50,14 +50,22 @@ Vue.prototype.$podcastSearchRegionOptions = Object.keys(podcastSearchRegionMap).
}) })
Vue.prototype.$languageCodes = { Vue.prototype.$languageCodes = {
default: defaultCode, default: defaultCode, // en-us
current: defaultCode, current: defaultCode, // Current language code in use
local: null, local: null, // Language code set at user level
server: null server: null // Language code set at server level
} }
// Currently loaded strings (default enUS)
Vue.prototype.$strings = { ...enUsStrings } Vue.prototype.$strings = { ...enUsStrings }
/**
* Get string and substitute
*
* @param {string} key
* @param {string[]} subs
* @returns {string}
*/
Vue.prototype.$getString = (key, subs) => { Vue.prototype.$getString = (key, subs) => {
if (!Vue.prototype.$strings[key]) return '' if (!Vue.prototype.$strings[key]) return ''
if (subs?.length && Array.isArray(subs)) { if (subs?.length && Array.isArray(subs)) {
@ -66,7 +74,7 @@ Vue.prototype.$getString = (key, subs) => {
return Vue.prototype.$strings[key] return Vue.prototype.$strings[key]
} }
var translations = { const translations = {
[defaultCode]: enUsStrings [defaultCode]: enUsStrings
} }