Android App Development in multiple languages - java

I am developing one Android application in three languages named English,Spanish and German.First I completed development in English and wish to complete it in other two languages. Here my question is:
Can I use the same code of Android project(which is in english) in the other two languages with different package names in the same project ?.
Please help me with the sample code/links.

of course you can. Follow these steps
make sure all of your strings through the application are listed as a resource in yourAppFolder/res/values/strings.xml and that you use strings in your app only via getString(R.string.myString1) and NEVER via hard-coded strings in your activities
create a new folder for each language you want to localize your app with the following syntax: for germany, values-de
copy the strings.xml file in the new folder you just created
translate each string in the file into your desired language
Now android OS will use the proper language based on the device's locale.
I bet that you don't fulfill requirement #1 and that will be the most of your work to do. At least that was happened to me in my first real android app ;)

Related

Java swing multilanguage app

I am developing a point of sale desktop app in English for forms.
I want to add Arabic language: the user can switch from one language to another.
What is the easiest way to do this?
Java supports internationalization out of the box, please see Internationalization tutorial. Roughly, you should
Move all UI-related messages to separate *.properties files
Create separate *.properties file for every supported language
Resolve required messages file by Locale (language)

What's proper technique for naming packages in an Android Application?

Specifically, what's the proper etiquette/conventions and terms for the different directories in Android Studio app folder?
Within that directory there are three more directories including java, but within Java are four layers of directories labelled com.test.cad.breadcrumbs, where breadcrumbs is the name of the application. Originally, test was set because I was just learning Android Studio, but now that it's actually an app, what should it be refactored to? Is it a package name? Can someone clarify terminology?
For example - why is the first directory called com? Or cad?
Image of File Structure
It's well explained at Oracle documentation:
Naming a Package
Thanks to #CommonsWare in the comments my question was answered.
Essentially, reverse domain name convention is used for the base of the package name. So if I'm "apple.com" then I use "com.apple". It must be likely to be unique at the moment and unlikely to have a collision in the future.
After this base, any java package name is up to you.

Deploying an android application internationally

Hello there fellow Android developers. I am looking for some feedback. I am about to do a major international deployment of an android application. Something I need to worry about is language settings. What I have done right now is used the default language setting specific /res/values- setting where you have multiple folders called values-en, values-es, values-pt, things like that. So what I am wondering the following.
When my android default strings.xml is in English, will the way I am handling language be sufficient. It works here in development and probably deployed from the US store. But when deployed from other stores will the device think, I am from the Spanish store so the default strings.xml file should be in Spanish, or will it know, I am Spanish store so I will use values-es?
Anyways I would like feedback from someone who has deployed like this before please. It seems to be a question that is pretty guessable, however I am wanting to confirm with other developers what their experiences have been.
Thanks,
Anthony
If your read this page, it stated :
To add support for more languages, create additional values
directories inside res/ that include a hyphen and the ISO country code
at the end of the directory name. For example, values-es/ is the
directory containing simple resourcess for the Locales with the
language code "es". Android loads the appropriate resources according
to the locale settings of the device at run time.
Add the string values for each locale into the appropriate file.
At runtime, the Android system uses the appropriate set of string
resources based on the locale currently set for the user's device.
The language folder that is used is based on the user's selected language, not anything relating to where they are. You can test what each language looks like in your app by changing your device to a different language.
From my experience, the selected language resource is based on the selected language on device, so no matter which store your app is downloaded from, if the device language setting is english, values-en will be selected.
But you don't need to worry about it, as long as you have i18n files for all language you want your application to be translated to, the device will do the rest of the work for you.

How to support different languages with dynamic web data on Android?

I have an application that pulls information from a web server and displays it. I know that Android has some nice language features where you can put multiple strings.xml files inside the project for specific languages. Is there a way to convert the text from the server (which is in english) to whatever local the user has set on their device?
Thanks
Yes, but that's usually done at the server-side with some kind of translation api. Even on Android, when an app needs content that hasn't already been pre-translated, it goes through a server for the translation.
For instance, you could use Google Translate's api (which is not free)
http://code.google.com/apis/language/translate/overview.html
Or you could install some open source solution on your own server and use that remotely as well.

Making a redistributable component or library for Android

I'm just starting out on Android and Java programming, coming in from a C++ background. I was wondering - whats the best way to go about making a library/UI widget/component that I can license to third-party developers?
In C++ I'd ship the customers my headers and *.a files, but I don't know the equivalent in Java.
Are there any good resources or links about this, maybe even from general Java development standpoint.
you can define activities/services that are available for any other application running on android:
"A central feature of Android is that one application can make use of elements of other applications (provided those applications permit it). For example, if your application needs to display a scrolling list of images and another application has developed a suitable scroller and made it available to others, you can call upon that scroller to do the work, rather than develop your own. "
http://developer.android.com/guide/topics/fundamentals.html
Activities and services have some use but there is a whole class of functionality (fancy table viewer for sql) that isn't covered. You can do jars but I don't think you can have android resources in that file. The work around would be to have a Jar and require the user to copy and paste some text into the apps resource directory. You can look at the admob.com android SDK for an example of this.
Not sure about how Android handles this, but the typical distribution of Java code is a .jar file. A .jar is basically a zip file containing all of the compiled .class files in a Java project. There might also be resource/text/etc. files within the .jar. There is no concept of a header file in Java, so all you need are the .class files, and possibly a manifest file to provide some additional meta info about the .jar.
http://java.sun.com/docs/books/tutorial/deployment/jar/
(This is just a general Java answer, it may or may not apply to Android)

Categories

Resources