mirror of
				https://github.com/TeamPiped/Piped.git
				synced 2024-08-14 23:57:27 +00:00 
			
		
		
		
	Use user's system language by default.
This commit is contained in:
		
							parent
							
								
									4e4ecd1fba
								
							
						
					
					
						commit
						58e69da0c2
					
				
					 3 changed files with 15 additions and 3 deletions
				
			
		| 
						 | 
				
			
			@ -62,7 +62,7 @@ export default {
 | 
			
		|||
        const App = this;
 | 
			
		||||
 | 
			
		||||
        (async function() {
 | 
			
		||||
            const locale = App.getPreferenceString("hl", "en");
 | 
			
		||||
            const locale = App.getPreferenceString("hl", App.defaultLangage);
 | 
			
		||||
            if (window.i18n.global.locale.value !== locale) {
 | 
			
		||||
                if (!window.i18n.global.availableLocales.includes(locale)) {
 | 
			
		||||
                    const messages = await import("@/locales/" + locale + ".json").then(module => module.default);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -352,7 +352,7 @@ export default {
 | 
			
		|||
            this.showComments = this.getPreferenceBoolean("comments", true);
 | 
			
		||||
            this.minimizeDescription = this.getPreferenceBoolean("minimizeDescription", false);
 | 
			
		||||
            this.watchHistory = this.getPreferenceBoolean("watchHistory", false);
 | 
			
		||||
            this.selectedLanguage = this.getPreferenceString("hl", "en");
 | 
			
		||||
            this.selectedLanguage = this.getPreferenceString("hl", this.defaultLangage);
 | 
			
		||||
            this.enabledCodecs = this.getPreferenceString("enabledCodecs", "av1,vp9,avc").split(",");
 | 
			
		||||
            this.disableLBRY = this.getPreferenceBoolean("disableLBRY", false);
 | 
			
		||||
            this.proxyLBRY = this.getPreferenceBoolean("proxyLBRY", false);
 | 
			
		||||
| 
						 | 
				
			
			@ -377,7 +377,7 @@ export default {
 | 
			
		|||
                if (
 | 
			
		||||
                    this.getPreferenceString("theme", "dark") !== this.selectedTheme ||
 | 
			
		||||
                    this.getPreferenceBoolean("watchHistory", false) != this.watchHistory ||
 | 
			
		||||
                    this.getPreferenceString("hl", "en") !== this.selectedLanguage ||
 | 
			
		||||
                    this.getPreferenceString("hl", this.defaultLangage) !== this.selectedLanguage ||
 | 
			
		||||
                    this.getPreferenceString("enabledCodecs", "av1,vp9,avc") !== this.enabledCodecs.join(",")
 | 
			
		||||
                )
 | 
			
		||||
                    shouldReload = true;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										12
									
								
								src/main.js
									
										
									
									
									
								
							
							
						
						
									
										12
									
								
								src/main.js
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -210,6 +210,18 @@ const mixin = {
 | 
			
		|||
                return false;
 | 
			
		||||
            }
 | 
			
		||||
        },
 | 
			
		||||
        defaultLangage() {
 | 
			
		||||
            const languages = window.navigator.languages;
 | 
			
		||||
            for (let i = 0; i < languages.length; i++) {
 | 
			
		||||
                try {
 | 
			
		||||
                    require("@/locales/" + languages[i] + ".json");
 | 
			
		||||
                    return languages[i];
 | 
			
		||||
                } catch {
 | 
			
		||||
                    continue;
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
            return "en";
 | 
			
		||||
        },
 | 
			
		||||
    },
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue