Home > Software design >  How to make the language as English in this javascript app?
How to make the language as English in this javascript app?

Time:09-03

I come across this beautiful electron app - https://github.com/c10342/player The locale is being configured in player-master\src\renderer\lang\index.js

The toggle of language works fine on clicking language button from chinese to english.

Is it possible to make the default language as english on startup? i tried with index.js but not successfull.

Thanks in advance

CodePudding user response:

not sure but looks like the default is set to 'cn' so try changing it to 'en'.

// file player-master\src\renderer\lang\index.js

if(!locale){
    locale = 'en'
}

// or
let locale = storage.get('locale')
locale = 'en';

CodePudding user response:

I got the problem. it's due to storage get method requires second parameter as a default value. so set as below.

let locale = storage.get('locale', 'en');
  • Related