Change ApplicationLabel

klaus

Expert
Licensed User
Longtime User
I'm not sure if it's possible.
But why not having the same application and load the language files according to the selected language ?

Best regards.
 
Upvote 0

Johnmcenroy

Active Member
Licensed User
Longtime User
Thanks for reply Klaus. I have a lot of languages inside my one app package but i wanted also that the name of my application was in Hindi for example if user uses Hindi and so on. I looked at some applications installed on my phone - when i change device's language i see the name of this application in this language.
 
Upvote 0

RiverRaid

Active Member
Licensed User
Longtime User
Hi!

you can add a strings.xml file in the res/values folder and put your default app-name there.
B4X:
<string name="app_name">MyApp</string>

and set the file to read only. for lets say, german translation create a folder named values-de in the res folder, place a strings.xml file with:
B4X:
<string name="app_name">MeineApp</string>
and set it to read only.

In the manifest editor search for the following code:
B4X:
SetApplicationAttribute(android:label,"$LABEL$")
and replace it by
B4X:
SetApplicationAttribute(android:label,"@strings/app_name")


I hope i wrote it correct, at the time I have no acess to my PC, it was written from my memory..

Edit: This works as well with other strings/names in the manifest editor (eg name of shortcuts, dream services etc..)
 
Last edited:
Upvote 0

Johnmcenroy

Active Member
Licensed User
Longtime User
Thank you very much :)

Hi!

you can add a strings.xml file in the res/values folder and put your default app-name there.
B4X:
<string name="app_name">MyApp</string>

and set the file to read only. for lets say, german translation create a folder named values-de in the res folder, place a strings.xml file with:
B4X:
<string name="app_name">MeineApp</string>
and set it to read only.

In the manifest editor search for the following code:
B4X:
SetApplicationAttribute(android:label,"$LABEL$")
and replace it by
B4X:
SetApplicationAttribute(android:label,"@strings/app_name")


I hope i wrote it correct, at the time I have no acess to my PC, it was written from my memory..

Edit: This works as well with other strings/names in the manifest editor (eg name of shortcuts, dream services etc..)
 
Upvote 0

RiverRaid

Active Member
Licensed User
Longtime User
Sorry.. I made a mistake..
Its not
B4X:
...@strings/app_name...
. The correct is
B4X:
...@string/app_name
.

Sorry
 
Upvote 0

chrjak

Active Member
Licensed User
Longtime User
Parsing code. 0.03
Compiling code. 0.10
Compiling layouts code. 0.01
Generating R file. Error
res\values\strings.xml:1: error: Invalid start tag string
res\values-de\strings.xml:1: error: Invalid start tag string

What did I wrong? In both strings there is one line with the name!?

Regards
 
Upvote 0

chrjak

Active Member
Licensed User
Longtime User
sure
<string name="app_name">Messerae+</string>

the location is objects/res/values-de/
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
i would suggest to change the content to
<?xml version="1.0" encoding="UTF-8"?>
<resources>
<string name="app_name">Messerae+</string>
</resources>
 
Upvote 0

chrjak

Active Member
Licensed User
Longtime User
Thanks so much. but there is one problem....
now when i install the app the right name is shown. but on my home its the old one. !?

btw. do i have to remove the label setting hashtag in activity?
 
Upvote 0

asales

Well-Known Member
Licensed User
Longtime User
[EDIT: Solved! See the next post #18]

I have the same problem (see the project attach).

The name of the application ("My Application" in english and "Meu Aplicativo" in portuguese) is showing correctly in the list of applications, but in the screen is show "B4A Example".

I want to show "My Application" in the label is language of the device is english and "Meu Aplicativo" if language is portuguese.

Thanks in advance for any tip.
 

Attachments

  • applicationlabel1.zip
    8.4 KB · Views: 171
Last edited:
Upvote 0
Top