Reputation: 32243
How can I make my app to ignore certains configurations, for example, the device's language (forcint the app to use default strings)
For better understanding thats the concret problem:
I have a Android Library project with some strings in the strings.xml file
That library have the strings in english, german, french and spanish.
I want use the library in an app but this app only supports english and german so I'd like to ignore the strings provided by the library project in french and spanish in order to avoid a partial traduction
Is that possible without magical workarrounds?
Thanks
Upvotes: 0
Views: 36
Reputation: 15798
You can get the system Locale using this code
Locale.getDefault().getLanguage();
You can check if it's French or Spanish then you can enforce your own locale either English or German
Locale locale = new Locale("en");
Locale.setDefault(locale);
Configuration config = new Configuration();
config.locale = locale;
getBaseContext().getResources().updateConfiguration(config,
getBaseContext().getResources().getDisplayMetrics());
some of the code taken from Set Locale programmatically
Upvotes: 1
Reputation: 7652
When you publish your app to the Market, you can select which markets to ship to.
Upvotes: 0