Dmitriano
Dmitriano

Reputation: 2018

Android does not display translated app name

Mainfest:

<application android:name="org.qtproject.qt.android.bindings.QtApplication"
    android:label="@string/app_name"
    ...
    <activity android:name="net.mynamespace.MainActivity"
        android:configChanges="orientation|uiMode|screenLayout|screenSize|smallestScreenSize|layoutDirection|locale|fontScale|keyboard|keyboardHidden|navigation|mcc|mnc|density"
        android:label="@string/app_name"
        ...

res directory contains Russian translation:

values/strings.xml
values-ru/strings.xml

values/strings.xml content:

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <string name="app_name">English App Name</string>
</resources>

values-ru/strings.xml content:

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <string name="app_name">Russian App Name</string>
</resources>

but devices with Russian language still display English app name.

What can be wrong?

Tried values-b+ru but it did not help.

If I copy values-ru/strings.xml to values/strings.xml the app name is displayed in Russian.

Did a quick Google search, but with no success:

  1. How can I translate my Android app name?
  2. Support different languages and cultures
  3. Using resources for localization
  4. What is the list of supported languages/locales on Android?

Upvotes: 0

Views: 175

Answers (1)

Sergey010
Sergey010

Reputation: 36

it helped me that I commented out this line in the android/build.gragle file:

defaultConfig {
    //resConfig "en"        //this one
    minSdkVersion = qtMinSdkVersion
    targetSdkVersion = qtTargetSdkVersion
{

And I also created two additional folders, in addition to the already existing android/res/values:

  • android/res/values-en

  • android/res/values-ru

In each of the three folders, I put a strings.xml file to make it look like this:

  • android/res/values/strings.xml
  • android/res/values-en/strings.xml
  • android/res/values-ru/strings.xml

Each file must contain the name of the application corresponding to the language described by two characters in the name of the folder in which it is located.

Upvotes: 2

Related Questions