Skip to content

Commit

Permalink
Add comments/jsdocs to i18n.js
Browse files Browse the repository at this point in the history
  • Loading branch information
advplyr committed Apr 18, 2024
1 parent ad30977 commit b03198a
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions client/plugins/i18n.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand All @@ -66,7 +74,7 @@ Vue.prototype.$getString = (key, subs) => {
return Vue.prototype.$strings[key]
}

var translations = {
const translations = {
[defaultCode]: enUsStrings
}

Expand Down

0 comments on commit b03198a

Please sign in to comment.