@Override
  protected void formOK(UserRequest ureq) {
    if (importKeys.isVisible() && importKeys.getSelectedKeys().size() > 0) {
      Collection<String> importLangKeys = importKeys.getSelectedKeys();
      Set<String> alreadyInstalledLangs = new HashSet<String>();
      for (String langKey : importLangKeys) {
        if (I18nModule.getAvailableLanguageKeys().contains(langKey)) {
          alreadyInstalledLangs.add(langKey);
        }
      }
      if (I18nModule.isTransToolEnabled()) {
        // In translation mode importing will copy the language package
        // over an existing language or create a new language
        File tmpJar = importFile.getUploadFile();
        I18nManager.getInstance().copyLanguagesFromJar(tmpJar, importLangKeys);
        logAudit("Uploaded languages from jar::" + importFile.getUploadFileName(), null);
        showInfo("configuration.management.package.import.success", importLangKeys.toString());

      } else {
        // In language adaption mode: import is copied to user managed i18n package space in
        // olatdata
        if (alreadyInstalledLangs.size() == importLangKeys.size()) {
          showError("configuration.management.package.import.failure.installed");
          return;
        }
        // Ok, contains at least one language, copy to lang pack dir
        importFile.moveUploadFileTo(I18nModule.LANG_PACKS_DIRECTORY);
        logAudit("Uploaded language pack::" + importFile.getUploadFileName(), null);

        if (alreadyInstalledLangs.size() > 0) {
          getWindowControl()
              .setWarning(
                  getTranslator()
                      .translate(
                          "configuration.management.package.import.success.with.existing",
                          new String[] {
                            importLangKeys.toString(), alreadyInstalledLangs.toString()
                          }));
        } else {
          showInfo("configuration.management.package.import.success", importLangKeys.toString());
        }
      }
      // Reset i18n system
      I18nModule.reInitializeAndFlushCache();
      fireEvent(ureq, Event.DONE_EVENT);
    }
  }
 @Override
 protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
   // A title, displayed in fieldset
   setFormTitle("configuration.management.package.import.title");
   if (I18nModule.isTransToolEnabled()) {
     setFormDescription("configuration.management.package.import.description.transserver");
   } else {
     setFormDescription("configuration.management.package.import.description");
   }
   //
   // The import file upload
   importFile =
       uifactory.addFileElement("configuration.management.package.import.file", formLayout);
   importFile.setLabel("configuration.management.package.import.file", null);
   importFile.setMandatory(true, "configuration.management.package.import.file.error.mandatory");
   // Limit to jar files and set upload limit to 50 MB
   importFile.setMaxUploadSizeKB(
       50000, "configuration.management.package.import.file.error.size", null);
   Set<String> mimeTypes = new HashSet<String>();
   mimeTypes.add("application/java-archive");
   mimeTypes.add("application/x-jar");
   mimeTypes.add("application/x-java-jar");
   importFile.limitToMimeType(
       mimeTypes, "configuration.management.package.import.file.error.type", null);
   importFile.addActionListener(FormEvent.ONCHANGE); // trigger auto-upload	
   //
   // Add checkboxes for the found languages - hide so far
   String[] langKeys = new String[] {};
   importKeys =
       uifactory.addCheckboxesVertical(
           "configuration.management.package.import.select", flc, langKeys, langKeys, 1);
   importKeys.setVisible(false);
   //
   // Add cancel and submit in button group layout
   FormLayoutContainer buttonGroupLayout =
       FormLayoutContainer.createButtonLayout("buttonGroupLayout", getTranslator());
   formLayout.add(buttonGroupLayout);
   cancelButton = uifactory.addFormLink("cancel", buttonGroupLayout, Link.BUTTON);
   uifactory.addFormSubmitButton("configuration.management.package.import", buttonGroupLayout);
 }