Android Question App Name localize?

corwin42

Expert
Licensed User
Longtime User
Yes:

Use the following Attribute format:

B4X:
#ApplicationLabel: @string/app_label

And create a resource folder with values subfolders for every language and place a strings.xml file with following contents:

B4X:
<?xml version="1.0" encoding="utf-8"?>
<resources>
   <string name="app_label">GreatApp</string>
   </string>
</resources>
 
Upvote 0

ilan

Expert
Licensed User
Longtime User
Note that you can use CreateResource instead of creating the files:
B4X:
CreateResource(values-fr, strings.xml,
<resources>
  <string name="app_label">GreatApp In French</string>
</resources>
)
CreateResource(values-en, strings.xml,
<resources>
  <string name="app_label">GreatApp In English</string>
</resources>
)

Thanks for your advice but i dont understand where i put this lines and do i have to create the folder resource (and put to read only?)

Another question if i change the phone language after installing the app will the name of the app also change automatically ?
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
where i put this lines
Manifest editor.

do i have to create the folder resource (and put to read only?)
No (and no).

Another question if i change the phone language after installing the app will the name of the app also change automatically ?
You will need to test it. I think that it will change automatically but I'm not sure.
 
Upvote 0

ilan

Expert
Licensed User
Longtime User
Note that you can use CreateResource instead of creating the files:
B4X:
CreateResource(values-fr, strings.xml,
<resources>
  <string name="app_label">GreatApp In French</string>
</resources>
)
CreateResource(values-en, strings.xml,
<resources>
  <string name="app_label">GreatApp In English</string>
</resources>
)

this is working well but i forgot 1 thing. what will happen if the language of the device is something else then any language set in manifest?
dont in need to set an ELSE argument? or maybe set app_label before the check language to a X app name and then make the language check?

thanx, ilan
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
if the language of the device is something else then any language set in manifest?
I guess english is the "default" language
 
Upvote 0

ilan

Expert
Licensed User
Longtime User
default is the strings.xml in the folder values

sorry but i dont understand

before i put the label of my app in Main Activity like this:

B4X:
#ApplicationLabel: My Great App

now what i do is:

B4X:
#ApplicationLabel: @string/app_label

and in Manifest i put:

B4X:
CreateResource(values-fr, strings.xml,
<resources>
  <string name="app_label">GreatApp In French</string>
</resources>
)
CreateResource(values-de, strings.xml,
<resources>
  <string name="app_label">GreatApp In Deutsch</string>
</resources>
)

so as you can see i have only a name for German and French what will happen if the device language is russian?

what will be the app name under the logo? since i dont create resource for russian what will be choosed? i have nowhere put any name of the app so
there is no default value.

i was thinking of putting app_label=MyGreatApp before the createresource in manifest and like this if no language match to the device language the already set name will be used.

i never used a localized app name on any android device.

EDIT: maybe i could do it in main screen like this:

B4X:
#ApplicationLabel: My Great App
#ApplicationLabel: @string/app_label

so first i set the name to "My Great App" (default name) and if the device language is anything like in manifest it will change to that language
would this work?
 
Upvote 0

LucaMs

Expert
Licensed User
Longtime User
what will happen if the language of the device is something else then any language set in manifest?

so as you can see i have only a name for German and French what will happen if the device language is russian?

Try with a simple app for test and change the language of the device ;)


But... what is the purpose? Will Google Play display the localized name (and will use it for searching?). I don't think so.

Also:
Whatsapp in italian is... Whatsapp
Pokemon go in italian is... Pokemon go
...
:)
 
Last edited:
Upvote 0

tigrot

Well-Known Member
Licensed User
Longtime User
I don't know exactly, but since the store identifies the App from the full package name, which can be different from the displayed name, I think that the name is simply a label which can be localized. Let's try. I have only English and Italian monolanguage apps.
 
Upvote 0

ilan

Expert
Licensed User
Longtime User
But... what is the purpose? Will Google Play display the localized name (and will use it for searching?). I don't think so.

localize name has nothing to do with the store. (you can set the store name for your app differently then you app name on your device and also in multi language from the dev console)

localize name is the App Name that will appear under your App Logo on your device

example (device language is set to ENGLISH - THIS IS HOW IT LOOKS ON MY DEVICE):

eng.png


if i change my device language to russian then it looks like this:

rus.png


so everythings works fine BUT if i change now the device language to a language that is not set in manifest like japanese then Android will show the App package name instead:

anotherlang.png


since i cannot add all language to the manifest i need to have a default Name for the App that needs to be set in manifest.

ok so i can also confirm that this will NOT work:

B4X:
#ApplicationLabel: My Great App
#ApplicationLabel: @string/app_label

so i have to add in the Manifest an ELSE argument but i dont know how. Can someone please help me?

thanks, ilan
 
Upvote 0

ilan

Expert
Licensed User
Longtime User
ok i found a solution i just create another Resource with values "" and what will happen is if the device language is anything different then any language i have set in manifest it will choose it.

this is how it looks (First CreateResource is the DEFAULT App name):

B4X:
'App Name Language
CreateResource(values, strings.xml,
<resources>
  <string name="app_label">Call Recorder</string>
</resources>
)
CreateResource(values-en, strings.xml,
<resources>
  <string name="app_label">Call Recorder</string>
</resources>
)
CreateResource(values-de, strings.xml,
<resources>
  <string name="app_label">Call Recorder</string>
</resources>
)
CreateResource(values-ru, strings.xml,
<resources>
  <string name="app_label">Запись вызовов</string>
</resources>
)
CreateResource(values-ja, strings.xml,
<resources>
  <string name="app_label">コールレコーダー</string>
</resources>
)
CreateResource(values-ko, strings.xml,
<resources>
  <string name="app_label">통화 기록기</string>
</resources>
)
CreateResource(values-fr, strings.xml,
<resources>
  <string name="app_label">Enregistreur d appel</string>
</resources>
)
CreateResource(values-es, strings.xml,
<resources>
  <string name="app_label">Grabadora de llamadas</string>
</resources>
)
CreateResource(values-it, strings.xml,
<resources>
  <string name="app_label">Call Recorder</string>
</resources>
)
CreateResource(values-pt, strings.xml,
<resources>
  <string name="app_label">Gravador de chamadas</string>
</resources>
)
CreateResource(values-tr, strings.xml,
<resources>
  <string name="app_label">Arama Kaydedici</string>
</resources>
)
CreateResource(values-he, strings.xml,
<resources>
  <string name="app_label">מקליט שיחות</string>
</resources>
)
CreateResource(values-iw, strings.xml,
<resources>
  <string name="app_label">מקליט שיחות</string>
</resources>
)
CreateResource(values-ar, strings.xml,
<resources>
  <string name="app_label">مسجل المكالمات</string>
</resources>
)
CreateResource(values-zh, strings.xml,
<resources>
  <string name="app_label">通话录音器</string>
</resources>
)
 
Upvote 0
Top