Esempio n. 1
0
 public String toString(Locale loc, String dftVal) {
   String dv = (dftVal != null) ? dftVal : this.dft;
   if ((loc != null) && (this.pkg != null)) {
     return this.toString(I18N.getI18N(this.pkg, loc), dv);
   } else {
     return I18N.decodeNewLine(dv);
   }
 }
Esempio n. 2
0
  /** ** Debug/Testing entry point ** @param argv The command-line args */
  public static void main(String argv[]) {
    RTConfig.setCommandLineArgs(argv);

    if (RTConfig.hasProperty(ARG_PACKAGE)) {
      String pkg = RTConfig.getString(ARG_PACKAGE, "org.opengts.util");
      String loc = RTConfig.getString(ARG_LOCALE, "en");
      String key = RTConfig.getString(ARG_KEY, "");
      Locale locale = I18N.getLocale(loc);
      Print.sysPrintln("Package: " + pkg);
      Print.sysPrintln("Locale : " + locale + " [" + loc + "]");
      Print.sysPrintln("Key    : " + key);
      I18N i18n = I18N.getI18N(pkg, locale);
      if (i18n != null) {
        Print.sysPrintln("String : " + i18n.getString(key, "Undefined"));
      } else {
        Print.sysPrintln("Package resource not found");
      }
      System.exit(0);
    }

    if (RTConfig.hasProperty("test")) {
      I18N i18n = getI18N(I18N.class, null);
      i18n.printKeyValues();
      String m3 =
          i18n.getString(
              "m.m3",
              "{0}",
              new Object() {
                public String toString() {
                  return mainStr;
                }
              });
      String m2 = i18n.getString("m.m2", "How Now Brown {0}", m3);
      String m1 = i18n.getString("m.m1", "Message: \\n{0}", m2);
      Print.sysPrintln(m1);
      mainStr = "Horse";
      Print.sysPrintln(m1);
    }
  }
Esempio n. 3
0
 /**
  * ** Returns an I18N instance based on the specified package name and Locale ** @param pkg The
  * resource package ** @param loc The Locale resource from with the localized text is loaded
  */
 public static I18N getI18N(Package pkg, Locale loc) {
   return I18N.getI18N(pkg.getName(), loc);
 }
Esempio n. 4
0
 /**
  * ** Returns an I18N instance based on the specified package name and Locale ** @param pkgClz The
  * class from which the class package is derived ** @param loc The Locale resource from with the
  * localized text is loaded
  */
 public static I18N getI18N(Class pkgClz, Locale loc) {
   return I18N.getI18N(pkgClz.getPackage().getName(), loc);
 }
Esempio n. 5
0
 /* table description */
 public static String getTableDescription(Locale loc) {
   I18N i18n = I18N.getI18N(GroupList.class, loc);
   return i18n.getString(
       "GroupList.description",
       "This table defines " + "the authorized Groups that can be accessed by a given User.");
 }
Esempio n. 6
0
 /* table description */
 public static String getTableDescription(Locale loc) {
   I18N i18n = I18N.getI18N(StatusCode.class, loc);
   return i18n.getString(
       "StatusCode.description",
       "This table defines " + "Device specific StatusCode descriptions.");
 }
Esempio n. 7
0
 /* table description */
 public static String getTableDescription(Locale loc) {
   I18N i18n = I18N.getI18N(AccountString.class, loc);
   return i18n.getString(
       "AccountString.description",
       "This table defines " + "Account specific customized String key/values.");
 }
Esempio n. 8
0
 /* table description */
 public static String getTableDescription(Locale loc) {
   I18N i18n = I18N.getI18N(RoleAcl.class, loc);
   return i18n.getString(
       "RoleAcl.description", "This table defines " + "Role specific Access Control permissions.");
 }