Java swing multilanguage app - java

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)

Related

CMUsphinx support for other languages

currently I am using Sphinx4 in a java desktop application to just to match some speech/words against the xxx.gram file. I have not installed sphinx in my system rather I'm just using sphinx4.jar in my project's classpath. And its working fine till now.
Now, I want to use it with Spanish, Portuguese, and Chinese languages. how could I do that? I don't want to install Sphinx. Is there any .jar file or light weighted code or services (even if other than sphinx) available for the same?
You can download Spanish model here:
http://sourceforge.net/projects/cmusphinx/files/Acoustic%20and%20Language%20Models/Spanish%20Voxforge/voxforge-es-0.1.1.tar.gz/download
Portuguese and Chinese are not supported. If you need them you can build models from your audio, see for details
http://cmusphinx.sourceforge.net/wiki/tutorialam
To make data collection easier you can use audiobooks.

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 associate a file with a program in java

Take notepad for example. You can open a file with notepad (right click and open with, or double clicking on the file if it is already associated with notepad) and it will display the contents of a file. I want to be able to open an xml file with the program that I am writing so that it can do some parsing and give a desired output. What sort of ways are there to do this in java? Do I have to ask for an argument to be passed into the program when it is opened? Would this be easier in C++ or some other language? If you need any further information please let me know -- this was the best way I could come up with to discribe my situation, which may be why my google searches have come up empty. Thank you in advance for your help!
You can associate an extension with a java jar and the file name will be passed as args[0] It doesn't get much simpler than that. I suggest you try it with a "hello world" program. ;)
display the contents of a file ..What sort of ways are there to do this in java?
Install/launch the app. using Java Web Start.
Java Web Start (JWS) is the Oracle Corporation technology used to launch rich client (Swing, AWT, SWT) desktop applications directly from a network or internet link. It offers 'one click' installation for platforms that support Java.
JWS provides many appealing features including, but not limited to, splash screens, desktop integration, file associations, automatic update (including lazy downloads and programmatic control of updates), partitioning of natives & other resource downloads by platform, architecture or Java version, configuration of run-time environment (minimum J2SE version, run-time options, RAM etc.), easy management of common resources using extensions..
Here is a demo. of the JNLP API file services (an API available to JWS apps.) that registers an interest (claims an association with) in the .zzz file-type in the launch file. Associations can also be done programmatically using the IntegrationService of the JNLP API.

How do I translate a page in java with lot of text,without using resource bundle?

I have a web page with lots of text.Is there any means through which I can translate it,without using resource bundle(which involves using properties files,requiring key value pairs for all words.)?
Thanks for your precious time.
An alternative is to create separate views for each language. So a "mypage_en_US.html" for the US-english version and a "mypage_en_GB.html" for the british-english version. This gives you total control over the text and layout but has the drawback of possible code duplication if there is any logic in your view.
Wicket uses pretty clean views which should hardly contain any logic so this works pretty well there.
Just be innovative here. If you are getting shitty copy pase work. Write a program to convert the properties file and then use that properties file using google translate api, but yeah end of the day you will have to go with properties file.
I belive there would be other way too using google translate api again, would love to hear that myself too
Depends on your web framework.
For example, Wicket can apply I18N on webpages in two ways :
- using I18N files and resourcesbundles, with placeholders where required in the page
- by having totally separate pages, one for each language. The page template itself is postfixed with the locale, much like property files : HomePage_en.html, HomePage_fr.html, etc.
Other web frameworks may have similar features. If you're using raw JSP/Servlets, I'm afraid you're pretty much on your own.
But it's totally possible to implement your own templating system. For example, you could use a set of Freemarker templates, and load the one that matches the desired locale.

Android App Development in multiple languages

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 ;)

Categories

Resources