I have seen many apps which will ask language settings when you open the app first time,it will load particular language whole time.but in my case i need to support different languages at the same time,the user can have more than 2 language songs and it should support the meta data of 4 languages(English, Korean,Japanese,Chinese) at the same time .how ever I am getting meta data from the server or local song.so I use something like that for Korean language.(in this case it won't support,Chinese)
String songnametemp = json.getString(0)//from server
String songname=`songnametemp.getBytes("iso-8859-1"), "euc-kr")`//changing to korean
TextView songtext=(TextView)findViewbyID(R.id.song);
songtext.setText(songname)
the problem is that I can't hard code for each and every language, i would not know which language(META-DATA) songs are playing from server. is there any better way to do it?
In My lollipop device it support koreans and hindi language,but my kikat does not the support both .I think each new version they are supporting more languages.
In Windows this is handled by system library called Uniscribe, on Apple systems by ATSUI, and on Linux systems by Pango. Android is based on Linux
but unfortunately Google seem to have removed the parts for handling complex scripts. (A rather strange decision since most Android devices
are for communications including text.) Complex scripts work fine on other mobile devices using a Linux based operating system like the Nokia N9 and N900
.in android There is no way to identify which language Unicode you song meta data has,if you the know language you can encode to specific language like what you did above.
Or you can give the setting in preference"to choose language " when you launch the app first time.but however if you want support all language at the same time.
You have to encode in server only ,so you can support all languages at the same time.
When I run into this issue and have control of the data stored on the server, I convert everything to Unicode, e.g. UTF-8, before storage. This way the conversion is only done once and there is no need for downstream applications to handle anything other than say UTF-8. A major benefit is your use case of displaying multiple languages together side by side which can now happen transparently.
I don`t understand well what you trying to do , but for support multi-language in android for
- static values , just use values like that "values-en" , "values-ar"
- server values , make your web services handle language
"example.com/en/getdata"
"example.com/ar/getdata"
and in your values add link as language
Related
I'm trying to create an app in a different language (in particular Tamil). I've just used Tamil text in the places where I'd use strings and the text renders correctly for newer device simulators (I've tested on API 16 and above). However, when I try running on a simulator with API 10, then I just get rectangles in place of characters. How can I get the text to render correctly on these older devices too?
Did you put it in correct res folder? If your app is supporting multiple language, you must have multiple 'values-xx' in your res folder. For example, if your app supports telugu, you need to create 'values-te' folder with strings.xml inside that folder and put your tamil translation in that file. And you also need to have proper font to render. You can check on your device settings > languages and input > language. See if there any preferred language that you're looking for. If not, you need to provide your own fonts in your app.
You can refer your issue here, and also Android Documentation on how to properly handle multiple languages.
Our client application has means of updating a "language file" from a server occasionally. Yet it seems quite a challenge to support it on android..
I tried using inflate( XmlPullParser, ... ) but later found it doesn't support non-binary XML files.
The following are given:
Our app uses #string/resource_id resources to support languages. Basically it supports English, but the requirement is to provide language resources dynamically. That is, if we need to support Greek, or provide a change to the Greek language texts, we should be able to provide that on runtime.
So, on runtime our app connects a service and downloads an XML file, with syntax similar to string.xml in the current language.
What remains is how to change the text resources in the application in a sane manner (not one by one..)
I tried using inflate(with the XmlPullParser parameter) but it seems to be intended for use with binary pre-compiled XML files. To use that it would require to binarize the XML before hand, and that would be less compatible, not to say that aapt.exe tool is less documented, especially in my case.
So, any idea?
Don't know if it can be done everywhere in Android but instead of using native resources reference, maybe you can use the Java Properties class and using the device locale configuration to retrieve the wanted strings programmatically?
Many times I've seen Android apps that have a list of languages displayed and I can tap on any of this language and download it for this specific app (GO Weather widget has this functionality).
I'm interested in how is this implemented and what is the best way to load languages dynamically in Android apps? Adding 100 string.xml resources in app project is not a solution and besides if I want to provide some kind of "funny holiday language" pack or add a new language I would need to upload the project to Google Play again and again...
Thanks!
While it's possible to use Expansion Files to add on to your app, they are limited in some ways. The main problem for you would be that you can only have a limited number of expansion files. If you wanted 100 languages, your only option would be to load them all in the expansion file, and download the whole thing. While that might not be a problem, since a list of translated strings probably isn't that large, you may want to go a different route.
The best option I see for downloading separate language add-ons is to forgo using strings.xml altogether. Just use a simple CSV file to hold your strings, mapping names to strings. When your program starts, read it in to a string array/map/whatever, and you have all your strings at the ready. This way, if you want to add a language, it's as easy as downloading a text file and saving it to your data directory.
Also, you can keep a file listing all the available languages on the same server, so you don't have to update the app if you want to add seasonal or limited-time-only languages, like you mentioned. Just read in the file to get the list.
Note, you'll need somewhere to host the files, but that's hardly a barrier in this day and age.
I have some customers who have volunteered to translate my app's strings into their native languages. Of course they will not be using the Eclipse Android environment to do this, so what Windows-based tool/editor would be appropriate for them to use to work on the XML files that I send them?
I've been following your strategy as well for quite some time. Whenever a volunteer wanted to translate the app, he got the XML file containing all the strings, translated it and sent it back to me.
But people who are not very familiar with computers tend to fail at that task: I often received the XML files back as Microsoft Word documents (.doc) or they translated the XML keys (which become the strings' IDs later) as well.
Therefore I recommend you to use some convenient tool for collaborative translation such as Transifex, crowdin or Get Localization.
You can even use a small website I've set up mainly for myself that offers Android translation as well if you don't want to pay for those services. It's not beautiful, but it should do everything you need.
I use the Notepad++ editor for manipulate xmls, it is very easy to use this application.
If you are looking for an automatic translation tool. I had created one and is available here.
I also created an android string translator and prepared a short video to explain how it works. This video can be opened at the indicated link from screencast. The link links to the location of the Excel file that runs the translation code. The file is code signed, free and ready to go.
https://app.screencast.com/3175zvrfOg6dZ?conversation=DJjUGfR9NPJLPAxLv3Hg5F&tab=Details
`
In Android Studio I developed nine hundred key string pairs relevant to my application.
Android encapsulates each of these strings in a particular format.
Android provides for different languages by retaining a key value and a translated value as part of a unique string. A list of strings needs to exist in the app, for all required languages.
The Program translated 907 strings into twelve different languages. These languages are English, Arabic, Bengali, Chinese, French, Hindi, Indonesian, Japanese, Korean, Portuguese, Russian, Spanish. The total count of strings is close to 11000.
This would be a formidable task if done manually and so a computerized process makes it easier.
These languages are now all set up in my android application.
An android user can choose one of eleven languages to use the application. The translations are based on the visual basic routines created in Microsoft excel. The program backcheck the translated words back into English. The translations do not always carry the intending meaning when backchecked.
For example, when the program translates the English string, False, into Bengali, the program produces a Bengali string. When the program backchecks the Bengali string to English, the result is the English word, lie. There is a connection to the original meaning.
I concluded that the program would be useable in another language. The user would need to pay attention these variations in nuance.
I am planning to internationalize my Android app such that the user can choose the language that he wants. However, I will be providing an xml file for the translated words from my server when a client wants to switch from the default language.
What is the best way of incorporating this internationalization methodology in Android?
First thing, from what I recall, it would be difficult to load language specific xml from server. Android design allows you to package these string into xml file and load them from that file stored in res folder. Dynamic loading from server may be harder and not recommended.
You can read up in detail about Android's guidelines for that here.
I would also recommend using a professional translating company, it worked well for us but YMMV.