how to localize app name shown in the launcher?
For example, "Play Store", in Chinese is "Play εεΊ". Thanks.
I tried to modify android\app\src\main\AndroidManifest.xml
like this:
android:label="@string/app_name"
And create files
values-zh/strings.xml
values-en/strings.xml
Example:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">App name in different language</string>
</resources>
But, the app name changes only when the system language changed. Is this a common problem (or known bug?) in Android?
In windows, when the app language changes, the app name will change immediately.
So, what I really want is, when the language changes in my app, the app name in the launcher will also change, ignoring the system language.
On Android application's android:label
in AndroidManifest.xml
is a fixed resource referrer and it's bind to the system language.
So as you saw you can use only configuration qualifier names (values-en, -zh, -large, -land, etc.), according to Providing Alternative Resources.
android\app\src\main\res
values
if it does not exist, create one, this folder would be for the default locale (language).strings.xml
inside the values
folder with the following code:<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="appName">your_app_name</string>
</resources>
NOTE: If the file already exists, then just add the appName
key to it which is just this line:
<string name="appName">your_app_name</string>
appName
with your app name for the default locale (language).values
folder and its contained strings.xml
file for each locale, for example if your default locale is English (en)
and you want to add Arabic (ar)
and Spanish (es)
then you will have the following folder structure for the res
folder:ββββ ...
ββββvalues
β ββββ ...
β ββββ strings.xml
β ββββ ...
ββββvalues-ar
β ββββ ...
β ββββ strings.xml
β ββββ ...
ββββvalues-es
β ββββ ...
β ββββ strings.xml
β ββββ ...
ββββ ...
NOTE: You don't have to copy all the keys and values inside the strings.xml
file, if you have another keys that you don't want to localize them, then you can ignore them for each locale and just include the keys you want to localize, e.g. in this case appName
.
values
folder and change the value of the key appName
inside the strings.xml
file.AndroidManifest
file in the following path: android\app\src\main\AndroidManifest.xml
and change the value of android:label
inside the application
tag to be android:label="@string/appName"
.CFBundleName
which is the launcher name of the app.If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With