I am working on an android app in which the user can change the language of the app from within the the app iteself using the following code:
Locale.setDefault(locale);
Resources resources = context.getResources();
Configuration configuration = resources.getConfiguration();
configuration.locale = locale;
resources.updateConfiguration(configuration, resources.getDisplayMetrics());
It works correctly with my local string resources, ie the language specific string resource is called when the App Locale
is changed. Now, the actual problem:
I am using Google Play Games Api in my app. I have added language specific translations to the Developer Console. When I make requests to the server, it gives responses in the default language of the phone system. It does not consider the App specific
locale, which is set by the user (using the above code). But when I change the default system language, the Api recognizes that giving responses in that language. I have googled a lot, but can't find any way of telling the Games Api that 'Hey, I want the response in a different language (Set by my app)'.
Is there a way of doing this? I am stuck here. Any help would be appreciated!
You can set your own translations for game details, including the display name, game description, and graphic assets. You can also specify your own translations for achievements and leaderboards that are associated with your game.
To add your own translations for game details:
For more information on adding translations for achievements and leaderboards, see the achievements and leaderboards game concepts.
When displaying game detail, leaderboard, and achievement strings, Google Play games services uses the game-supported language that is closest to the user-requested language. For example, if the user's device language preference is set to French (Canada) (fr-CA), but the game supports only English (United States) (en-US) and French (France) (fr-FR), Google Play games services will select the fr-FR strings to display since this is the closest matching language.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.