@Test void importJsonTest() throws IOException { I18nJsonConverter jsonConverter = new I18nJsonConverter(); File file = new File(TEST_DIR, JSON_FILE); jsonConverter.importTranslations(new FileReader(file)); Dictionary dictionary = jsonConverter.getDictionary(); assertEquals(3, dictionary.getKeys().size()); assertEquals("", dictionary.getTranslation("de", "merlin.excel.validation_error.display_all")); assertEquals("Almeno una lista non è valida. Modifichi la sua scelta altrimenti il voto verrà considerato nullo.", dictionary.getTranslation("it", "merlin.excel.validation_error.error_column_headname")); file = new File(OUT_DIR, JSON_FILE); try (Writer writer = new FileWriter(file)) { jsonConverter.write(writer); } jsonConverter = new I18nJsonConverter(); jsonConverter.importTranslations(new FileReader(file)); dictionary = jsonConverter.getDictionary(); assertEquals(3, dictionary.getKeys().size()); assertEquals("", dictionary.getTranslation("de", "merlin.excel.validation_error.display_all")); assertEquals("Almeno una lista non è valida. Modifichi la sua scelta altrimenti il voto verrà considerato nullo.", dictionary.getTranslation("it", "merlin.excel.validation_error.error_column_headname")); }
private void importJson(String content, File file) throws IOException { log.info("Importing json translations: " + file.getAbsolutePath()); I18nJsonConverter jsonConverter = new I18nJsonConverter(dictionary); try (Reader reader = new StringReader(content)) { jsonConverter.importTranslations(reader); } }
I18nConverter { private void importJson(String content, File file) throws IOException { log.info("Importing json translations: " + file.getAbsolutePath()); I18nJsonConverter jsonConverter = new I18nJsonConverter(dictionary); try (Reader reader = new StringReader(content)) { jsonConverter.importTranslations(reader); } } }
I18nConverter { private void importJson(String content, File file) throws IOException { log.info("Importing json translations: " + file.getAbsolutePath()); I18nJsonConverter jsonConverter = new I18nJsonConverter(dictionary); try (Reader reader = new StringReader(content)) { jsonConverter.importTranslations(reader); } } I18nConverter(Dictionary dictionary); }
I18nConverter { private void importJson(String content, File file) throws IOException { log.info("Importing json translations: " + file.getAbsolutePath()); I18nJsonConverter jsonConverter = new I18nJsonConverter(dictionary); try (Reader reader = new StringReader(content)) { jsonConverter.importTranslations(reader); } } I18nConverter(Dictionary dictionary); void importTranslations(File file); Dictionary getDictionary(); Map<File, File> getImportedFiles(); }
I18nConverter { private void importJson(String content, File file) throws IOException { log.info("Importing json translations: " + file.getAbsolutePath()); I18nJsonConverter jsonConverter = new I18nJsonConverter(dictionary); try (Reader reader = new StringReader(content)) { jsonConverter.importTranslations(reader); } } I18nConverter(Dictionary dictionary); void importTranslations(File file); Dictionary getDictionary(); Map<File, File> getImportedFiles();  }