Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Actually the situation is like that. Imagine I have this scenario: some chinese open the application. He has the mobile phone set with ch locale. The application default is xx as language, meaning I have 2 language files values/strings.xml (spanish for eg as default) and another language values-en/strings.xml for english. The default will make no sense for him, so english will be the most appropiate for his understanding, even if he does not understand it very good. So at the app start I open language settings (android language settings), where any selection will set the app in spanish unless he select english. I am forcing him to change the phone locale in english basically, just to use my app. Overall the concept of android is wrong, because i need to be able to see an application in any language I want without changing device language.</p> <hr> <p>What I have done: - I created in values folder one more string_xx.xml file. Now, for a translation string name = "txtTranslation" I have in string_xx file "en_txtTranslation" key. R.java loads them all and in my app, based on a global var selectedLanguage = xx, I attach the write string using this code: </p> <pre><code>public String translate(String text) { String appLanguage = UtilsCentral.getUserLanguage(getApplicationContext()); if (appLanguage != "") { return getString(getResources().getIdentifier(appLanguage + "_" + text, "string", this.getPackageName())); } else { return getString(getResources().getIdentifier(text, "string", this.getPackageName())); } } </code></pre> <p>Indeed, at activity on create i need to set all views with .text = tarnslate("txtTranslation")</p> <p>Note: UtilsCentral.getUserLanguage(getApplicationContext()) returns app language (user selection)</p> <p>Conclusion, there is more unuseful work, but lets me do what i need, and what i believe is normal.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload