Class I18N


  • public class I18N
    extends java.lang.Object
    I18N is entity that supports internationalized applications. Its structure contains a Map of all values registred in an xml file. For instance, if you want to define values for Portguese language whose ISO 639 code is pt, then create a xml file with the path <source patch</resources/i18n/pt.xml. contaning the following format:
     <resources>
            <string name="hello_world">Olá mundo!</string>
     </resources>
     
    Then initialize values on the MainWindow Constructor an get hello_world value as follow:
         public class App extends MainWindow {
         public App() {
             I18N.initialize();
         }
    
         @Override
         public void initUI() {
                    I18N.pt.get("hello_world");
         }
     
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static I18N none  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      static I18N getDefault()
      Returns I18N for the device default language.
      static I18N getI18N​(java.lang.String iso639Code)
      Returns an instance of I18N for the specified ISO 639 code.
      java.lang.String getValue​(java.lang.String name)
      Returns value for a defined key for this I18N instance.
      static void initialize()
      Deprecated.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • none

        public static I18N none
    • Method Detail

      • initialize

        @Deprecated
        public static void initialize()
        Deprecated.
        No longer required, maps are loaded on demand. Will be removed in next major release.
      • getI18N

        public static I18N getI18N​(java.lang.String iso639Code)
        Returns an instance of I18N for the specified ISO 639 code.
        Parameters:
        iso639Code -
        Returns:
      • getValue

        public java.lang.String getValue​(java.lang.String name)
        Returns value for a defined key for this I18N instance.
        Parameters:
        name -
        Returns:
      • getDefault

        public static I18N getDefault()
        Returns I18N for the device default language. If there is no xml file for this language, this function will return an I18N instance with values defined in <source path>/resources/i18n/default.xml
        Returns:
        the default I18N instance