How to get client locale language?

Game development with Board Game Arena Studio
Post Reply
User avatar
Victoria_La
Posts: 620
Joined: 28 December 2015, 20:55

How to get client locale language?

Post 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
User avatar
quietmint
Posts: 265
Joined: 31 July 2017, 00:28

Re: How to get client locale language?

Post by quietmint »

BGA is doing this (in ly_studio.js):

Code: Select all

var lang = dojo.config.locale.substr(0, 2); // "en"
User avatar
Morgalad
Posts: 108
Joined: 17 January 2017, 20:46
Contact:

Re: How to get client locale language?

Post 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.
Cheers...
Morgalad

Developer of: Incan Gold , Takara Island , Taluva and Veggie Garden
User avatar
Victoria_La
Posts: 620
Joined: 28 December 2015, 20:55

Re: How to get client locale language?

Post 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
User avatar
quietmint
Posts: 265
Joined: 31 July 2017, 00:28

Re: How to get client locale language?

Post 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.
User avatar
Victoria_La
Posts: 620
Joined: 28 December 2015, 20:55

Re: How to get client locale language?

Post 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
Post Reply

Return to “Developers”