Example #1
0
  private void write(String name, I18nName n) throws IOException, XMLStreamException {
    if (n == null) {
      n = new I18nName();
    }

    write(name, n.getName());
    for (Map.Entry<String, String> entry : n.getTranslations().entrySet()) {
      write(name + "_" + entry.getKey(), entry.getValue());
    }
  }
Example #2
0
  private void write(String fieldName, List<I18nName> iNames)
      throws IOException, XMLStreamException {
    List<String> names = new ArrayList<>(iNames.size());
    HashMultimap<String, String> translations = HashMultimap.create();

    for (I18nName name : iNames) {
      if (name.getName() != null) {
        names.add(name.getName());
      }

      for (Map.Entry<String, String> entry : name.getTranslations().entrySet()) {
        String language = entry.getKey();
        String translation = entry.getValue();
        translations.put(language, translation);
      }
    }

    writeList(fieldName, names, "");

    for (String language : translations.keySet()) {
      writeList(fieldName, translations.get(language), "_" + language);
    }
  }