5 Replies Latest reply on Nov 5, 2009 6:34 AM by 843810

    Internationalization for Hebrew language


      I made an application, internationalized to be used with some different languages.
      Til now I internationalized it only for languages that have Latin letters (ISO/IEC 10646-1)
      and in this way it is working fine...

      Recently I had a request to put it in Hebrew language, that doesn't use Latin characters.

      Reading the documentation, I implemented the localization for the Hebrew language in the
      follow way:
      Someone wrote the words in Hebrew characters inside a property file (file_iw_IL.properties) ,
      afterwards I transformed the Hebrew characters in the UTF-16 mode "\uxxxx", using the
      native2ascii tool that come with jdk ....

      But when the application for the Hebrew language run, it didn't work...

      I should like to know if the procedure that I did for Hebrew
      internationalization is right and, if is not, I would like to know what is the right precedure
      to make internationalization for languages that don't have Latin characters.

      thank you in advance for a kind help

        • 1. Re: Internationalization for Hebrew language
          No one answer me so I try again for some help, explain better my problem.

          I use this class to get strings in different languages:
          public class SupplierOfInternationalizedStrings {
              Locale localUsedIt;
              Locale localUsedEn;
              Locale localUsedHe;
              Locale localizedCurrencyFormat;
              Locale localUsedHere;
              public SupplierOfInternationalizedStrings() { // constructor
                  localUsedIt = new Locale("it", "IT"); // specifica il file appartenente alla famiglia
                  localUsedEn = new Locale("en", "US"); // specifica il file appartenente alla famiglia
                  localUsedHe = new Locale("he", "HE"); // specifica il file appartenente alla famiglia
              } // constructor
              void setInternationalizationCountry(String langToUse) {
                  if (langToUse.compareToIgnoreCase("Italiano") == 0) {
                      localUsedHere = localUsedIt;
                      localizedCurrencyFormat = new Locale("it", "IT");
                  } else if (langToUse.compareToIgnoreCase("English")  == 0) {
                      localUsedHere = localUsedEn;
                      localizedCurrencyFormat = new Locale("iw", "IL");
                  } else if (langToUse.compareToIgnoreCase("Hebrew")== 0) {
                      localUsedHere = localUsedHe;
                      localizedCurrencyFormat = new Locale("iw", "IL");
                 System.out.println("linguaggio impostato = " + localUsedHere);
              } // initializeInternationalization() 
              public String getInternationalString(String keyForTheWord) {
                  ResourceBundle resourceBund = ResourceBundle.getBundle("properiesFile", // il nome del file .properties... la famiglia dei files
                  String word = resourceBund.getString(keyForTheWord);
                  return word;
              } // getStringForMedidentStartClass()
          } // class SupplierOfInternationalizedStrings
          Of course I have a file.property iw_IL - Hebrew (Israel) where for each key there is a value wrote with hebrew characters

          the hebrew file property look in this way:
          keyForLabel1= ה עברית מילה שתימ \n
          keyForLabel2=ספה עברית מילה שתימ 
          The class SupplierOfInternationalizedStrings works for the translation in english and in other languages that use latins letters ..,
          but when it is setted for be used with the Hebrew language ( localUsedHere = localUsedHe)
          the metod getInternationalString() don't return Hebrew words.

          This didn't worry me, because I read in the documentation that properies file cannot
          read characters that are different from latine... and I also learned that in this case it need to convert the letters
          in Unicode format...

          I made this work putting the hebrew words in an .rtf file and, using native2ascii utility
          with the command native2ascii -encoding UTF8 file.rtf textdoc.txt, I got the unicode format.

          Now the file property for Hebrew language looks in this way:
          keyForLabel1     =       \u00d4  \u00e2\u00d1\u00e8\u00d9\u00ea... 
          keyForLabel2     =       \u00e1\u00e4\u00d4  \u00e2\u00d1.....
          At this point I expected the translation in Hebrew comes good... but instead I still I cannot get the Hebrew words..

          I should like to know why the elaboration still doesn't works
          and I would have too some help in order to do the program works good.

          thank you


          • 2. Re: Internationalization for Hebrew language
            You didn't say what "doesn't work" means in your first post and you didn't say what it means in your second post either. How about explaining what you expected to see, where you expected to see it, and what you saw instead? (Hint: you didn't say whether you were using a Java application or a web application or an applet or what.) And if you saw error messages, what were they? Just the general basic things that people would need to know.
            • 3. Re: Internationalization for Hebrew language
              thank you for answering me

              I precise better..

              - saying "it doesn't" work I simply mean that I don't get the Hebrew translation
              - I talk about a stand alone java application
              - after I wrote in the file property with the Unicode I expected to get strings translated in Hebrew character in the same way I get the string in the English language
              - I don't get error messages but when I set the class to use Hebrew language I get again English words...


              • 4. Re: Internationalization for Hebrew language
                localUsedHe = new Locale("he", "HE");
                I don't think this is correct. Usually you pass a language code and a country code to the Locale constructor. There's no country whose abbreviation is "HE", is there?
                • 5. Re: Internationalization for Hebrew language
                  I thank you very much for your good advice.

                  You are right : the right format is:
                   localUsedHe = new Locale("iw", "IL"); 
                  now it works