I am trying to get a resource string variables in file string.xml in the res folder in the android directory for libgdx from the core java class files.
If you want to translate for multiple languages i will tell you that the best way to do it is not using the string.xml file from android.
What i did is. Inside the folder Assets in the android project i create a folder with the name String -> Inside this folder i create the string i will use in my app.
Then to load the string i will use I18NBundle. For example:
I18NBundle languageStrings = I18NBundle.createBundle(Gdx.files.internal("strings/strings"), locale);
String hello = languageString.get("hello");
This will work for Desktop, Android, iOS and GWT. So it better option than using the android res folder.
You can check more of this in the wiki of libgdx Libgdx wiki
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With