J Jordi Casas Armengol Member Licensed User Longtime User Oct 22, 2014 #1 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: Code: Copy android:name=".main" android:label="B4A Example" to: Code: Copy 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!
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: Code: Copy android:name=".main" android:label="B4A Example" to: Code: Copy 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 Oct 22, 2014 #2 change Code: Copy #Region Project Attributes #ApplicationLabel: B4A Example to Code: Copy #Region Project Attributes #ApplicationLabel: MyAppName in your main activity Upvote 0
change Code: Copy #Region Project Attributes #ApplicationLabel: B4A Example to Code: Copy #Region Project Attributes #ApplicationLabel: MyAppName in your main activity
J Jordi Casas Armengol Member Licensed User Longtime User Oct 22, 2014 #3 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
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".
DonManfred Expert Licensed User Longtime User Oct 22, 2014 #4 You can use a different build-configuration to build a french version of your app (it must have an own packagename then too) Code: Copy #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
You can use a different build-configuration to build a french version of your app (it must have an own packagename then too) Code: Copy #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)
Erel B4X founder Staff member Licensed User Longtime User Oct 23, 2014 #5 It is actually possible: http://www.b4x.com/android/forum/threads/how-translate-app-label.24737/#post-143267 Upvote 0
It is actually possible: http://www.b4x.com/android/forum/threads/how-translate-app-label.24737/#post-143267