@Test public void testLocalize() { final RegexLocale locale = new RegexLocale(new Local(new WorkdirPrefixer().normalize("../i18n/src/main/resources"))); assertEquals("Download failed", locale.localize("Download failed", "Status")); locale.setDefault("fr"); assertEquals("Échec du téléchargement", locale.localize("Download failed", "Status")); }
@Override public String localize(final String key, final String table) { final Key lookup = new Key(table, key); if(!cache.contains(lookup)) { if(!tables.contains(table)) { try { this.load(table); } catch(IOException e) { log.warn(String.format("Failure loading properties from %s.strings. %s", table, e.getMessage())); } finally { tables.add(table); } } } if(cache.contains(lookup)) { return cache.get(lookup); } return key; }
RegexLocale implements Locale { @Override public String localize(final String key, final String table) { final Key lookup = new Key(table, key); if(!cache.contains(lookup)) { if(!tables.contains(table)) { try { this.load(table); } catch(IOException e) { log.warn(String.format("Failure loading properties from %s.strings. %s", table, e.getMessage())); } finally { tables.add(table); } } } if(cache.contains(lookup)) { return cache.get(lookup); } return key; } }
RegexLocale implements Locale { @Override public String localize(final String key, final String table) { final Key lookup = new Key(table, key); if(!cache.contains(lookup)) { if(!tables.contains(table)) { try { this.load(table); } catch(IOException e) { log.warn(String.format("Failure loading properties from %s.strings. %s", table, e.getMessage())); } finally { tables.add(table); } } } if(cache.contains(lookup)) { return cache.get(lookup); } return key; } RegexLocale();  RegexLocale(final Local resources); }
RegexLocale implements Locale { @Override public String localize(final String key, final String table) { final Key lookup = new Key(table, key); if(!cache.contains(lookup)) { if(!tables.contains(table)) { try { this.load(table); } catch(IOException e) { log.warn(String.format("Failure loading properties from %s.strings. %s", table, e.getMessage())); } finally { tables.add(table); } } } if(cache.contains(lookup)) { return cache.get(lookup); } return key; } RegexLocale();  RegexLocale(final Local resources); @Override void setDefault(final String language); @Override String localize(final String key, final String table); }
RegexLocale implements Locale { @Override public String localize(final String key, final String table) { final Key lookup = new Key(table, key); if(!cache.contains(lookup)) { if(!tables.contains(table)) { try { this.load(table); } catch(IOException e) { log.warn(String.format("Failure loading properties from %s.strings. %s", table, e.getMessage())); } finally { tables.add(table); } } } if(cache.contains(lookup)) { return cache.get(lookup); } return key; } RegexLocale();  RegexLocale(final Local resources); @Override void setDefault(final String language); @Override String localize(final String key, final String table);  }