class XlsImExporter {

  public static void exportXls(final FileMatcher fileMatcher,
                               final Charset propertyFileEncoding,
                               final File xlsFile) {
    final Set<File> propertyFiles= fileMatcher.findMatchingFiles();
    LOGGER.log(Level.INFO, "Exporting the following files to XLS(X): {}", propertyFiles);

    final ResourceBundleContentHelper fbcHelper= new ResourceBundleContentHelper(fileMatcher.getRoot());
    final Map<String, Map<Language, File>> bundleNameToFilesMap= fbcHelper.toBundleNameToFilesMap(propertyFiles);

    final XlsFile xlsFileObject= new XlsFile(xlsFile);

    bundleNameToFilesMap.entrySet().forEach((entry) -> {
      final String bundleName= entry.getKey();
      final Map<Language, File> bundleTranslations= entry.getValue();

      final ResourceBundleContent resourceBundleContent= ResourceBundleContent.forName(bundleName)
        .fromFiles(bundleTranslations, propertyFileEncoding !=null ? propertyFileEncoding : UTF_8);

      resourceBundleContent.getContent().asMap().entrySet().forEach((e) -> {
        final String propertyKey= e.getKey();
        final Collection<Translation> translations= e.getValue();

        xlsFileObject.setValue(new I18nBundleKey(bundleName, propertyKey), translations);
      });
    });

    xlsFileObject.save();
  }

}