Translation tool - android

am wondering if is possible to use a feature on my app that can translate the app to other languages so the user can select through a list of languages so as he can read the app even if he doesnt speak English, thanks a lot

If you use the framework's localization facilities, this will happen automatically based on the user's language setting on their device
http://developer.android.com/guide/topics/resources/localization.html
Basically, instead of using string literals in your code (ie. txt.setText("Something") or android:text="Something"), you create these in your strings.xml file and use the automatically created reference id's.
res/values/strings.xml:
<string name="something">Something</string>
Then, you create alternate res/values folders for the other languages you support and create a similar strings.xml file there.
res/values-es/strings.xml
<string name="something">Algo</string>
Then your layouts and codes would have txt.setText(R.string.something) or android:text="#string/something".
You can do the same thing for drawable, layout, menu, etc.

"to use a feature on my app that can translate the app to other languages"
I do not think such feature exist from Google. But if you write the app according Google's localization guide then you can use our Nativer app, which is designed exactly for that. It takes you language resources - translates with a machine and then let's the crowd to correct it. All these happens in runtime - so you do not need to bother when the language translation finished by the crowd. You can find further info here transround.com
Peter

Related

Can I use Google Translator to enable multi language in Android app?

I'm working on an Android app. I need to make it available in many languages.
Can we use Google Translate Plugin or translate API to get this work ?
Please check this link : https://www.w3schools.com/howto/tryit.asp?filename=tryhow_google_translate
You can see there's a drop down to get all the language list.
Can I use something like this in my Android app ?
If I can't use a this method, what's the best way to enable multi-language feature in an Android app ?
Every android app has a resource value "strings" (a list of values for string variables) to provide different languages.
<resources>
<string name="home_act_bottom_bar_home_item">Shop</string>
<string name="home_act_bottom_bar_cont_item">Contacts</string>
<string name="home_act_bottom_bar_cart_item">Cart</string>
</resources>
The application must have a new string res file for each language. When the application is launched, the OS detects current system language which was chosen by user in android settings and then try to find this language in res files. If the file we need exists (for example Russian) it will be used, if not - the system will start application with default strings res file(often English). You certainly may use different web-services to translate you "Strings" after application was launched, but it will need time, will make user experience worth (user will have to wait for translation and UI update), will make your code very complex. I suggest you to translate your App beforehand, and put translations to according string res files, it will make your app fast and code not so complex.
You can read official docs here: https://developer.android.com/training/basics/supporting-devices/languages

Multiple Language Support Android APP

I am very new for developing the multi-language oriented Android APP. This is the first time i am going to support my app in multi-support language app. I need some clarification for developing the multi-language support app. Already i have some ideas before initiate the development.
Single APK with Localization like will make the multiple String.xml and include it in inside of the app and based the member selection of language its automatically invokes and works.
All language strings values will retain in app server (back-end) and will raise the Rest-API request and get those values and change it inside of the entire app (all screens) if member click and change the language inside of the app.
Main concern is if anything needs to change in future then Idea2 is best way. We will just change in back-end side it will be appeared in client side. But if we are going Idea1 and wants to change then we need to put the new build only.
Which one is best approach and recommended way to develop?
You will need to create different String.xml depending the languages you want to target as JDenais says, in my app i have the following
for example the first arab string consist in the same as Strings.xml but with all in arab, now, you only need to call one string in your xml files and it will just select where to grab depending on the phone language. Or in default the language from where the app was downloaded by google play, in fact, they are all the same strings.xml , so you dont need to specify which one you want to pull the translated text from, just replicate your main strings.xml in your other strings.xml and then the phone will decide where to pull the data.
Also please read the official doc on how to accomplish this https://developer.android.com/training/basics/supporting-devices/languages
Also please check the language ISO Codes here
What is the list of supported languages/locales on Android?
All your texts should be packaged in the APK in different String.xml files. Forget about receiving texts from a backend. It would be a lot of extra work for limited gain and with added risks of failure.
The framework takes care of selecting the appropriate string.xml file and offers support for needed use cases like plurals.
right click the values folder and choose new-> values resource file -> locale -> choose the language you want and name it strings.
copy the strings from the original string file to the new file and change them to the new language just the strings
make sure that the view xml files have their text set as "#string/the_name of the string" not hard coded

Create Android app in multiple languages

I have submitted an Android app to Google Play and I see that I can create different descriptions for each language it supports. My question is: can I create a different APK for each language? Alternatively, how can I detect the user's preferred language, so that I can automatically activate that language for the user in the app?
Here is the official tutorial for localizing your app. :)
You can create a different apk for each language ( split-apk ) - but I would not recommend this. Better use the platform function for this and put your strings file in the right path ( values- ) - after this everything is automagically done
no just use the /res/values/strings.xml
for example to choose english language create a folder in same directory of values and call it values-en, for frensh values-fr and so on. the default language of the app is under values/
And if (for some reason) you still need to know witch is the devices language use
Locale.getDefault().getDisplayLanguage();

Using strings from #android:string

I am a bit noob in Android and recently I found out that I can use the predefined string that Android provides as #android:string/cancel or #android:string/ok. At first I thought it was a good idea to use them because is a way to reuse code, but now I am not so sure about that.
What if somebody with a device configured with a language that I don't support install my app?
I assume that the app will use a default language, probably english, but those string from #android:string will get translated to the user's language, so he will end up with a mix of languages.
It this true? What do you think about use #android:string?
Thanks!
EDIT: Apparently my question hasn't been understood properly. I am NOT asking about how to support different languages. My question is about the convenience of use strings defined on #string:android, if it is correct to use them or can be lead to undesirable situation like a mix up of languages in the same application.
To ensure that your strings are appearing properly on devices configured with different languages, you'll want to create different values directories for different languages. For example, your default string values would be kept under values/strings.xml and French string values would be kept under values-fr/strings.xml.
The Android Developer website gives you plenty of information for supporting different languages in your application. http://developer.android.com/training/basics/supporting-devices/languages.html
The android: values (strings, icons, themes, etc.) will differ between devices and Android versions. If you want to use them, it's safest to copy them into your project. So for strings, you wouldn't have to worry about partial translation.
In the ressource folder of your app (res), ther is a folder "values" in it, and in this folder is the string ressource xml (strings.xml).
Usually, your app selects the strings from this file.
But you can add other value folders like this: Just create a new folder and name it "values-countryCode", for example "values-ch" for Switzerland ;)
Your app automaticly chooses the right string ressource, depending on your device's langague settings. If the langague of your device isn't available, it just takes the sting ressource of the default "values" folder.
A list if the country-codes is here.
Further information can be found here.
Hope I helped, and this is what you're looking for!

Localizing Titanium Android application

I have a completed Titanium Android application (that the developer was not me).
I want to localize it but both the strings and the UI are hard coded in the source code.
The application built in javascript.
The UI is also important because we also want a right-to-left version of the app.
Need to mention that I'm pretty new to the Titanium environment.
What is the best approach to this task?
You would need to take the source code and find all the hard coded strings and move them to the il8n/ folder's string.xml file. You would need to create one of these files in the appropriate language directory with the string that corresponds to the particular hard coded value you want to represent.
For example:
var mystring = L('hi_text');
In Titanium, this code would go to the language folder (of the device's setting, i.e. English or en folder) and look for an entry like this:
il8n/en folder:
<string name="hi_text">Hello</string>
If the device was in Spanish language mode, that same code would then look to the il8n/es folder:
<string name="hi_text">Hola<string>
That would allow you to switch the language, but changing the UI would likely be a significant change to the source code. In the app.js file, you may attempt to detect the language of the device and branch to completely different logic for the screens. You could also do this in the particular screen javascript files as well, where you call one creation function for each different language. You will likely be changing the architecture of the application if it didn't already have that requirement built-in.
Here is the official document :
https://developer.appcelerator.com/question/125732/localization-not-working

Categories

Resources