Package org.olat.core.util

Examples of org.olat.core.util.SortedProperties


      if (props == null || !resolveRecursively) {
        InputStream is = null;
        try {
          // Start with an empty property object
          // Use a sorted properties object that saves the keys sorted alphabetically to disk
          props = new SortedProperties();
          //
          // 1) Try to load the bundle from a configured source path
          // This is also used to load the overlay properties
          File baseDir = I18nModule.getPropertyFilesBaseDir(locale, bundleName);
          if (baseDir != null) {
View Full Code Here


    File transToolBrasatoLanguagesDirI18n = new File(transToolBrasatoLanguagesDir, i18nDirRelPath);
    File newPropertiesFile = new File(transToolBrasatoLanguagesDirI18n, I18nModule.LOCAL_STRINGS_FILE_PREFIX + localeKey
        + I18nModule.LOCAL_STRINGS_FILE_POSTFIX);
    // Prepare property file
    // Use a sorted properties object that saves the keys sorted alphabetically to disk
    Properties newProperties = new SortedProperties();
    if (StringHelper.containsNonWhitespace(languageInEnglish)) {
      newProperties.setProperty("this.language.in.english", languageInEnglish);
    }
    if (StringHelper.containsNonWhitespace(languageTranslated)) {
      newProperties.setProperty("this.language.translated", languageTranslated);
    }
    if (StringHelper.containsNonWhitespace(authors)) {
      newProperties.setProperty("this.language.translator.names", authors);
    }

    OutputStream fileStream = null;
    try {
      // create necessary directories
      File directory = newPropertiesFile.getParentFile();
      if (!directory.exists()) directory.mkdirs();
      // write to file file now
      fileStream = new FileOutputStream(newPropertiesFile);
      newProperties.store(fileStream, null);
      fileStream.flush();
    } catch (FileNotFoundException e) {
      throw new OLATRuntimeException("Could not create new language file::" + newPropertiesFile.getAbsolutePath(), e);
    } catch (IOException e) {
      throw new OLATRuntimeException("Could not create new language file::" + newPropertiesFile.getAbsolutePath()
View Full Code Here

TOP

Related Classes of org.olat.core.util.SortedProperties

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.