@Test public void testGetLocalesFR() { String json = localService.getJsonTranslation("fr", "pes"); assertThat(json, notNullValue()); String json_notif = localService.getJsonTranslation("fr", "pes_notification"); assertThat(json_notif, notNullValue()); }
public String getJsonTranslation(String lng, String ns) { ByteArrayOutputStream bos = new ByteArrayOutputStream(); try { ClassPathResource resource = new ClassPathResource("/locales/" + lng + "/" + ns + ".json"); FileCopyUtils.copy(resource.getInputStream(), bos); } catch (Exception e) { LOGGER.error("Unable to load json translation file: {}", e); } String jsonString = bos.toString(); jsons.put(lng + "_" + ns, jsonString); return jsonString; }
LocalesService { public String getJsonTranslation(String lng, String ns) { ByteArrayOutputStream bos = new ByteArrayOutputStream(); try { ClassPathResource resource = new ClassPathResource("/locales/" + lng + "/" + ns + ".json"); FileCopyUtils.copy(resource.getInputStream(), bos); } catch (Exception e) { LOGGER.error("Unable to load json translation file: {}", e); } String jsonString = bos.toString(); jsons.put(lng + "_" + ns, jsonString); return jsonString; } }
LocalesService { public String getJsonTranslation(String lng, String ns) { ByteArrayOutputStream bos = new ByteArrayOutputStream(); try { ClassPathResource resource = new ClassPathResource("/locales/" + lng + "/" + ns + ".json"); FileCopyUtils.copy(resource.getInputStream(), bos); } catch (Exception e) { LOGGER.error("Unable to load json translation file: {}", e); } String jsonString = bos.toString(); jsons.put(lng + "_" + ns, jsonString); return jsonString; }  }
LocalesService { public String getJsonTranslation(String lng, String ns) { ByteArrayOutputStream bos = new ByteArrayOutputStream(); try { ClassPathResource resource = new ClassPathResource("/locales/" + lng + "/" + ns + ".json"); FileCopyUtils.copy(resource.getInputStream(), bos); } catch (Exception e) { LOGGER.error("Unable to load json translation file: {}", e); } String jsonString = bos.toString(); jsons.put(lng + "_" + ns, jsonString); return jsonString; }  String getJsonTranslation(String lng, String ns); String getMessage(String lng, String ns, String path); String getMessage(String lng, String ns, String path, Map<String, String> variables); }
LocalesService { public String getJsonTranslation(String lng, String ns) { ByteArrayOutputStream bos = new ByteArrayOutputStream(); try { ClassPathResource resource = new ClassPathResource("/locales/" + lng + "/" + ns + ".json"); FileCopyUtils.copy(resource.getInputStream(), bos); } catch (Exception e) { LOGGER.error("Unable to load json translation file: {}", e); } String jsonString = bos.toString(); jsons.put(lng + "_" + ns, jsonString); return jsonString; }  String getJsonTranslation(String lng, String ns); String getMessage(String lng, String ns, String path); String getMessage(String lng, String ns, String path, Map<String, String> variables);  }