I want to change the application content from English to Spanish/ French as per the selection. Do we have any build-in libraries for the same. I am new to this multilanguage part, so please help me with this.
You just need to create an additional folder like values-fr (for French) and provide strings.xml with respective values.
here you can find detailed guide:
https://developer.android.com/guide/topics/resources/localization
Create strings.xml(fr) and strings.xml(es) with your translated strings in the respective language.
Use this library to set the language in your app, it manages all the overhead of Configuration Context and other boilerplate code
https://github.com/YarikSOffice/lingver.
This how you create multiple language resources
In android studio
Res-> New -> Android Resource File->
Name the file strings.xml -> Resoure Type Should be value
Select Locale From Available Qualifiers
Select Language and Set region to be any
Click Ok
i have a e-ccommerce app is ltr and english languge...i want translate to persian and rtl
Add android:supportsRtl="true" to AndoridManifest.xml and then, you'll need to create another Strings.xml in order to translate the app to Persian or any languages.
Create values-fa in /res directory of your project and then, copy-paste the Strings.xml into the values-fa directory.
Then you'll be able to translate those words in Persian in order to show in the app later. However, Android Studio has Edit Translation for these situations which if you did like I mentioned, click on Open Editor:
Then translating the strings will be pretty easy.
Read: https://developer.android.com/training/basics/supporting-devices/languages
I’m trying to edit my android strings.xml file with arabic translations. However, I’m having issues. For example, I have something like this:
<string name="test">اختبار</string>
When I type something like %1$s to add a placeholder, the string with the placeholder is also mixed up.
What’s the right approach to do this? Thanks
Placeholders (ascii) in BiDi strings are tricky. If you know that this %1$s will eventually be substituted by a name in Arabic, it's manageable; but if the substitution can be English or mixed text, you need a long and careful QA to check all special cases.
Don't try to edit Arabic text in Android Studio text editor for file res/values-ar/strings.xml; use the Translations Editor instead.
The official guide https://developer.android.com/studio/write/translations-editor.html describes the this editor in great detail, but one little trick that it misses is the use of View/BiDi Text Direction menu. To work with Arabic strings, you want to set it to Right-to-Left.
This will not effect the Arabic column in your Editor, and not even the way the translation is displayed in the text box at the bottom:
But when you click the ... button for translation, you will get the translation in RTL:
Now you can understand how your placeholder(s) will look when replaced with actual data.
I have my strings stored in different .xml(s). Now, I need to do some translations for them and I was wondering if it is possible to open the Translation Editor for those xml. I tried but it only appears on the strings.xml
Your help will be greatly appreciated.
This is old, but I figured something out that may be helpful for anyone looking.
When you open the Translations Editor for a module, it will show all strings in the res folder, not just the "strings.xml" file. So if you have other .xml files with strings, they will be listed.
The Android Studio UI only allows the Translation Editor to be opened from the "strings.xml" file. So if you have a module that has strings files without any xml file named "strings.xml" just create a blank "strings.xml" file in that res folder and use that to open the Translations Editor - it will list all strings.
If I understand this correctly, you don't need to open separate files in translation editor.
Open your something.xml file
Alt + Enter on any item -> Override resource in other configuration
Select Locale and press the button ">>"
Choose locale needed.
This will create localization file for your something.xml file.
something.xml -> copy all innards -> paste into localization file.
If you remove all values from localization file, and than open your main strings.xml file with editor, you will find there the words from something.xml untranslated. If you won't, you will find similar values for original and new locale.
When you open in editor your strings.xml, Studio puts there all string resources from the current module, despite you put your strings in multiple files. Maybe this is not as handy, as it would be with opening files one by one, but this still good, if you just need to make sure you didn't miss any string to be translated.
Open any layout
Find this panel by image panel
Click on earth icon
Click "Edit translations"
I have pretty big translation database, almost 1k positions on every single language. And every module has its own prefix, so my string files look like this: prefix_strings_hitory.xml, prefix_strings_news.xml, prefix_strings_coutries.xml etc. Android Studio translation editor can't handle properly translations with files different than strings.xml.
That's how am I doing this:
1.In every module create empty file strings.xml:
<?xml version="1.0" encoding="utf-8"?>
<resources>
</resources>
Thanks to this you can open editor easy.
2.Now assume you want to have file named values/abc_strings_main_activity.xml, create it.
3.When we need german translation, you have to manualy make a copy of your original (default) file: values-de/abc_strings_main_activity.xml. If you let Translation Editor copy your file, it would create values-de/strings.xml instead and put your strings there.
4.Now when you use Translation Editor, it would be properly saving your string in correct files and positions.
5.When I make a copy of my file, I always use file with empty tags body, e.g.
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="abc__button_1"></string>
<string name="abc__tile"></string>
<string name="abc__share"></string>
</resources>
Thanks to it, I can see empty (not translated) cells in Translation Editor
I'm using Android Studio 2.3.3
Opening the "translation editor" window I've realized that all entries from different resource file (strings.xml, otherTranslationFile.xml and so on...) are listed.
In the example I've used a prefix "c_" to better sort and recognize that specific entries
Im trying to build aosp for my devkit, and i'd like to know where
should i look to for :
to changing font size of texts
in settings section ( i've replaced
droid fonts with another one but the
new font kind large) or global font
setting.
to change position of texts in
settings section ( usually all texts
are
in left side, i want to try and put it in right side for example).
the language locale names that
showed in settings/language &
keyboards.. where are they stored .
i looked into LocalePicker.java but
could not figure it out.
For example i want to change a locale name from english to it's native
language (In some android builds i've seen arabic locale was in english, and
some other builds it was shown in native arabic العربية).