Android Question App icon name

Jordi Casas Armengol

Member
Licensed User
Longtime User
Hello!
I want to translate app name (a different app name for each language). So I created the folder "res\values-en\string.xml" and I added "<string name="app_name">Hello</string>" for each language. I also added "SetApplicationAttribute(android:label,"@string/app_name")" to manifest editor.

Once I install the app I can see the message "Do you want to install "Hello"?" on my phone where "hello" is changed to "Bonjour" when I change android language to French.

At this point all seems to work great but once the app is installed to phone I see the icon has the name "B4A Example" instead of "Hello" or "Bonjour". So I edited AndroidManifest.xml and I changed:

B4X:
android:name=".main"
android:label="B4A Example"

to:

B4X:
android:name=".main"
android:label="@string/app_name"

and now all it works but I need to set the file AndroidManifest.xml to "read only" because every time I compile the app it changes line "android:label="@string/app_name"" to "android:label="B4A Example""

I think the icon on phone is getting the "android:label" from main activity instead of app name.

Is this the correct way to get the app icon name?

Thanks!
 

DonManfred

Expert
Licensed User
Longtime User
change
B4X:
#Region  Project Attributes
    #ApplicationLabel: B4A Example
to
B4X:
#Region  Project Attributes
    #ApplicationLabel: MyAppName
in your main activity
 
Upvote 0

Jordi Casas Armengol

Member
Licensed User
Longtime User
Dear DonManfred,
I commented that line because if I set a name there I get allways the same app name. I mean setting "#ApplicationLabel: MyAppName" when french users install the app they get "MyAppName" instead of "MyFrenchAppName".
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
You can use a different build-configuration to build a french version of your app (it must have an own packagename then too)

B4X:
#Region  Project Attributes
#If French
    #ApplicationLabel: MyFrenchAppName
#end if
#If Release
    #ApplicationLabel: MyAppName
#end if

BUT as i said you need to build (and even publish on google) a second app for this with its own packagename.

I think you cannot change the label at runtime and replace them with localized values.
And i think i did not see any app on google-play who did this.
The app always came with ONE name. The name the author specified (here MyAppName)
 
Upvote 0
Top