@Test public void reusesKey() { assert Translator.get("key1").equals("Hello"); assert Translator.get("key2").equals("World"); assert Translator.get("key3").equals("Hello"); assert Translator.get("key4").equals("\"Hello the World!\""); assert Translator.get("key5").equals("\"Hello the $[key0]!\""); assert Translator.get("key6").equals("-\"Hello the World!\"-\"Hello the $[key0]!\"-$[key7]-"); }
public static String get(String key, String... paramValues) { if (dictionaryBundle.containsKey(key)) return MessageFormat.format(dictionaryBundle.getString(key), (Object[]) paramValues); if (languagesBundle.containsKey(key)) return languagesBundle.getString(key); return key; }
Translator { public static String get(String key, String... paramValues) { if (dictionaryBundle.containsKey(key)) return MessageFormat.format(dictionaryBundle.getString(key), (Object[]) paramValues); if (languagesBundle.containsKey(key)) return languagesBundle.getString(key); return key; } }
Translator { public static String get(String key, String... paramValues) { if (dictionaryBundle.containsKey(key)) return MessageFormat.format(dictionaryBundle.getString(key), (Object[]) paramValues); if (languagesBundle.containsKey(key)) return languagesBundle.getString(key); return key; } private  Translator(); }
Translator { public static String get(String key, String... paramValues) { if (dictionaryBundle.containsKey(key)) return MessageFormat.format(dictionaryBundle.getString(key), (Object[]) paramValues); if (languagesBundle.containsKey(key)) return languagesBundle.getString(key); return key; } private  Translator(); static void init(ResourceBundle dictionaryBundle, ResourceBundle languagesBundle, List<Locale> availableLanguages); static void test(); static List<Locale> getAvailableLanguages(); static boolean hasValue(String key, boolean useDefaultLanguage); static String get(String key, String... paramValues); }
Translator { public static String get(String key, String... paramValues) { if (dictionaryBundle.containsKey(key)) return MessageFormat.format(dictionaryBundle.getString(key), (Object[]) paramValues); if (languagesBundle.containsKey(key)) return languagesBundle.getString(key); return key; } private  Translator(); static void init(ResourceBundle dictionaryBundle, ResourceBundle languagesBundle, List<Locale> availableLanguages); static void test(); static List<Locale> getAvailableLanguages(); static boolean hasValue(String key, boolean useDefaultLanguage); static String get(String key, String... paramValues);  }