• Post Reply Bookmark Topic Watch Topic
  • New Topic

Support of languages in Java 7

 
askhat assylov
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello all,

I have used this site to find asnwers of some of my problems faced in using java.

This is the first time when i can't find an answer and creating a topic to get it from Java Ranch. The company is releasing a new version of a product which is written on Java 7. And the first potencial issue is that, core product programmers are talking that Java 7 doesn't support Kazakh (KK, Kk) Locale. I was referred to oracle site regarding this http://www.oracle.com/technetwork/java/javase/javase7locales-334809.html.
This is cruatial to us to support Kazakh languages in app to store it in DB and represent from GUI.

Could you please advice if Java 7 really do not support Kazakh locale and why and some proposal solution to make it support.

thanks in advance!
 
Omkar Shetkar
Ranch Hand
Posts: 86
1
IntelliJ IDE Java Ubuntu
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Java 7 and 8 doesn't provide support for Kazakh locale. Reason provided for this is
Believe it or not, supporting a locale and its data requires a lot of investigation, such as the most popular date format or translation of a country name in that language. It's getting more difficult for smaller countries/regions. Sometimes even political ramifications come in.


This can be found here.

To resolve this, Java provides a provision for developers to introduce a new locale through Service Provider Interface(SPI)s.
More details on how to implement it can be found here.
 
Paul Clapham
Sheriff
Posts: 21886
36
Eclipse IDE Firefox Browser MySQL Database
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's true, Java is way behind in supporting locales for the world. But, what services would you need from a Kazakh locale? Let me point out that Java supports Unicode 6, which includes all characters you need to display Kazakh and to store it in a database. The link which Omkar posted (the one about locale-sensitive services) happens to outline what a locale actually does for you; is anything on that page crucial for your application? If so, perhaps you can use ICU4J, which supports Kazakh according to my quick web search.
 
askhat assylov
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you guys for the responce. I suspect we will be required to represent date/time in rigth format and money on local value. Off course becides Kazakh letters in product name and desc.

There is one more issue how to put Kazakh letters in XML. Usually in XML when we define National text we put something like <text locale='en'>some text</text>
 
Campbell Ritchie
Marshal
Posts: 52580
119
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can't help any more myself, but

Welcome to the Ranch
 
Omkar Shetkar
Ranch Hand
Posts: 86
1
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is one more issue how to put Kazakh letters in XML. Usually in XML when we define National text we put something like <text locale='en'>some text</text>

If I understood correctly, you wish to write different language chars into a XML file.
There are multiple ways:
- if you want to write encoded chars as it is to the file, probably you can look into APIs like java.io.OutputStreamWriter.OutputStreamWriter(OutputStream, Charset).
- if you want to write unicode representation of the chars to the file, then you can explore the Java tool native2ascii .
 
Paul Clapham
Sheriff
Posts: 21886
36
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
XML also supports Unicode, in fact it's based on Unicode. So XML automatically supports every character you need to write the Kazakh language in an XML document. Just be sure to use a suitable encoding, like Omkar suggested. UTF-8 or UTF-16 would be suitable, for example. You shouldn't have to do any special processing at all since both Java and XML are Unicode-based.

However if your application requires you to specify the language of a text node in an XML document then it's perfectly reasonable to write something like this:



However it's unnecessary to do that unless your application actually needs to know the language in which the text is written.

 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!