When i used Adobe flash/Air to compile to Android,
i could use custom app names according to the user language
adding in the .XML (descriptor) file, something like this:
<text xml:lang="en">Hello World</text>
<text xml:lang="es">Hola Mundo</text>
How could i achieve something similar on Haxe/Openfl?
Is there something i can use in the project.xml?
Do you know how you would do this for a normal Android application? This is one APK with multiple languages included, right?
Yes, a multilanguage app…
But i’m not sure how to do that directly on Android…
i guess it should be something in the AndroidManifest.xml, maybe?
Check this http://stackoverflow.com/questions/29491453/android-how-to-change-app-name-on-phones-language
String wich is displayed at the home screen is located in the strings.xml (string name=“app_name”)
Or in short in your manifest file:
And for each language file add:
<string name="app_name">Your app name</string>
so, that would be the android way…
what would be the way to achieve that from openfl?
At the moment, you could do this by overriding your AndroidManifest.xml template
Create the directory “templates/android/template”
In the folder, create a copy of the Lime “AndroidManifest.xml” (this one): https://github.com/openfl/lime/blob/master/templates/android/template/AndroidManifest.xml
In your project, use
<template path="templates" />, with the path to your new “templates” directory (you can also call it something else if you want)
Now when you build it should use your file. In fact, it should copy other files you place in your Android template folder, including strings.xml
If you get a working solution, I’d love to hear how you set it up, I’d like to improve support for localization built-in in the future.
Well, i’ll try hehe, thanks for your help singmajesty!
I’m trying to do the same thing with app name and template feature seems not working for me.
I need something like this, but files are not being copied:
<template path="res/values" rename="app/src/main/res/values" />
At the same time individual files are working fine:
<template path="res_free/values/strings.xml" rename="app/src/main/res/values/strings.xml" />
I’m using latest version of openfl/lime at the moment.
Any help with that?