Page 1 of 1
How to get client locale language?
Posted: 26 August 2017, 00:35
by Victoria_La
How to get language that user want to see the game in? The translation stuff works auto-magically, but I have card images in french
and english, would be nice to change graphics files too, but I cannot figure out how to get that locale/language for client
Re: How to get client locale language?
Posted: 26 August 2017, 15:30
by quietmint
BGA is doing this (in ly_studio.js):
Code: Select all
var lang = dojo.config.locale.substr(0, 2); // "en"
Re: How to get client locale language?
Posted: 27 August 2017, 19:02
by Morgalad
I would encourage you to do what I did wiht Veggie Garden.
I asked the publisher to provide me the cards with blank spaces for the text so when used in the game you can apply the clienttranslate function and type the original text in a placed div on the card. This can be tricky as you have to leave enough space for translations and sometimes they dont fit well but at the same time is the most usable option for non English speakers.
Re: How to get client locale language?
Posted: 28 August 2017, 16:43
by Victoria_La
quietmint wrote:BGA is doing this (in ly_studio.js):
Code: Select all
var lang = dojo.config.locale.substr(0, 2); // "en"
No that is browser locale, I was looking for the language set as preferred language via preferences
Re: How to get client locale language?
Posted: 28 August 2017, 19:39
by quietmint
No, it matches the language selected in the Preferences page. Try it. I set my language preference on the site to French and dojo.config.locale became "fr", even though browser language is unchanged.
Re: How to get client locale language?
Posted: 30 August 2017, 00:26
by Victoria_La
quietmint wrote:No, it matches the language selected in the Preferences page. Try it. I set my language preference on the site to French and dojo.config.locale became "fr", even though browser language is unchanged.
Cool thanks! I think I like idea of Morgalad to wipe the text and write over too