🎧 Your Personal Streaming Service
Go airsonicmadsonicmedia-servermusicmusic-servernavidromeopensubsonicraspberry-piself-hostedstreamerstreaming-apistreaming-audiosubsonicsubsonic-server
Remove empty keys to allow English fallback
Deluan056d5e71117e
diff --git a/ui/src/i18nProvider/index.js b/ui/src/i18nProvider/index.jsindex 23af9267d..2e0d65469 100644--- a/ui/src/i18nProvider/index.js+++ b/ui/src/i18nProvider/index.js@@ -7,14 +7,27 @@ import en from './en.json'// Only returns current selected locale if its translations are found in localStorageconst defaultLocale = function () {const locale = localStorage.getItem('locale')- const current = localStorage.getItem('translation')+ const current = JSON.parse(localStorage.getItem('translation'))if (current && current.id === locale) {return locale}return 'en'}+const removeEmpty = (obj) => {+ for (let k in obj) {+ if (obj.hasOwnProperty(k) && typeof obj[k] === 'object') {+ removeEmpty(obj[k])+ } else {+ if (!obj[k]) {+ delete obj[k]+ }+ }+ }+}+const prepareLanguage = (lang) => {+ removeEmpty(lang)// Make "albumSongs" resource use the same translations as "song"lang.resources.albumSong = lang.resources.song// ra.boolean.null should always be empty