code: private void writeTargetI18nFile(SlingI18nMap i18nMap, File targetfile, OutputFormat selectedOutputFormat) throws IOException, JSONException {
      if (selectedOutputFormat == OutputFormat.XML) {
        FileUtils.fileWrite(targetfile, CharEncoding.UTF_8, i18nMap.getI18nXmlString());
      }
      else if (selectedOutputFormat == OutputFormat.PROPERTIES) {
        FileUtils.fileWrite(targetfile, CharEncoding.ISO_8859_1, i18nMap.getI18nPropertiesString());
      }
      else {
        FileUtils.fileWrite(targetfile, CharEncoding.UTF_8, i18nMap.getI18nJsonString());
      }
      buildContext.refresh(targetfile);
    }
docs: Writes mappings to file in Sling compatible JSON format.
  @param i18nMap mappings
  @param targetfile target file
  @param selectedOutputFormat Output format
  @throws IOException
  @throws JSONException