angular-localization icon indicating copy to clipboard operation
angular-localization copied to clipboard

Setting up default locale

Open alaksandarjesus opened this issue 7 years ago • 3 comments

Hi

I am trying to set the default locale and my configuration is as below.

`var localeConf = { basePath: 'languages', defaultLocale: 'ta-IN', sharedDictionary: 'common', fileExtension: '.lang.json', persistSelection: true, cookieName: 'COOKIE_LOCALE_LANG', observableAttrs: new RegExp('^data-(?!ng-|i18n)'), delimiter: '::', validTokens: new RegExp('^[\w.-]+.[\w\s.-]+\w(:.*)?$') };

var localeSupported = [ 'ta-IN', 'fr-FR', 'en-US' ]

var localeFallbacks = { 'ta': 'ta-IN', 'en': 'en-US', 'fr': 'fr-FR' }`

But i could not see the output for ta-IN.

Tested it with en-US and its working. Maintained the same folder structure too.

alaksandarjesus avatar Sep 22 '16 14:09 alaksandarjesus

Try open the page in incognito mode. Iirc the default locale is cache in local storage On Thu, Sep 22, 2016 at 7:28 AM alaksandarjesus [email protected] wrote:

Hi

I am trying to set the default locale and my configuration is as below.

`var localeConf = { basePath: 'languages', defaultLocale: 'ta-IN', sharedDictionary: 'common', fileExtension: '.lang.json', persistSelection: true, cookieName: 'COOKIE_LOCALE_LANG', observableAttrs: new RegExp('^data-(?!ng-|i18n)'), delimiter: '::', validTokens: new RegExp('^[\w.-]+.[\w\s.-]+\w(:.*)?$') };

var localeSupported = [ 'ta-IN', 'fr-FR', 'en-US' ]

var localeFallbacks = { 'ta': 'ta-IN', 'en': 'en-US', 'fr': 'fr-FR' }`

But i could not see the output for ta-IN.

Tested it with en-US and its working. Maintained the same folder structure too.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/doshprompt/angular-localization/issues/98, or mute the thread https://github.com/notifications/unsubscribe-auth/AA0EEM9ALbsuAgzp8dt4KkusDFtqA61kks5qspCNgaJpZM4KD9Ws .

Sincerely, Bret Ikehara

Sent from my iPhone

bretkikehara avatar Sep 22 '16 15:09 bretkikehara

Looks like I am having the same problem too. Followed everything as in the doc, tried in incognito mode but still the default locale is not changed

youfacepalm avatar Oct 11 '16 10:10 youfacepalm

After a year later... I changed initialSetLocale() to follow the developer choice, not the client configuration

function initialSetLocale() { setLocale(cookieStore && cookieStore.get(localeConf.cookieName) ? cookieStore.get(localeConf.cookieName) : /* getPreferredBrowserLanguage() */ localeConf.defaultLocale); }

studiocircus avatar Nov 22 '17 13:11 studiocircus