Package org.olat.core.util.i18n.devtools

Examples of org.olat.core.util.i18n.devtools.TranslationDevManager


//    tDMgr.sortKeysTask(false);   
//  }
 
 
  public void testGetLostTranslationsFromBranch() {
    TranslationDevManager tDMgr = TranslationDevManager.getInstance();
    String[] referenceLanguages = new String[]{"de", "en"};
    // Path to olat and core dir from the other branch where to lookup for missing translations
    String pathToOlatBranch = "/Volumes/flow/workspace/olat3_60_branch/webapp/WEB-INF/src/";
    String pathToCoreBranch = "/Volumes/flow/workspace/olatcore_60_branch/src/main/java/";
    // Uncomment to run this test. Fix pathes above
View Full Code Here


    //tDMgr.getLostTranslationsFromBranch(false, referenceLanguages, pathToOlatBranch, pathToCoreBranch );
  }
 
 
  public void testRemoveDeletedKeysTest() {
    TranslationDevManager tDMgr = TranslationDevManager.getInstance();
    // set languages that is used as reference: all keys there are the keys should not to be deleted
    String[] referenceLanguages = new String[]{"de", "en"};
    // set the languages that should be cleaned up
    Set<String> targetLanguages = I18nModule.getTranslatableLanguageKeys();
    //Set<String> targetLanguages = new HashSet<String>();
    //targetLanguages.add("en");
    tDMgr.removeDeletedKeys(false, referenceLanguages, targetLanguages);   
  }
View Full Code Here

      Properties sourcePropResolved = i18nMgr.getResolvedProperties(testLocale, testSourceBundle);
      Properties sourceProp = i18nMgr.getPropertiesWithoutResolvingRecursively(testLocale, testSourceBundle);
      String matchString = sourceProp.getProperty(ktm);
      assertTrue(sourcePropResolved.getProperty("key.to.stay2").indexOf(matchString) != -1);
     
      TranslationDevManager tDMgr = TranslationDevManager.getInstance();
      tDMgr.moveKeyToOtherBundle(testSourceBundle, testTargetBundle, ktm);
      sourceProp = i18nMgr.getPropertiesWithoutResolvingRecursively(testLocale, testSourceBundle);
      Properties targetProp = i18nMgr.getPropertiesWithoutResolvingRecursively(testLocale, testTargetBundle);
      assertNull(sourceProp.getProperty(ktm));
      assertNotNull(targetProp.getProperty(ktm));
      Properties sourceMetaProp = i18nMgr.getPropertiesWithoutResolvingRecursively(null, testSourceBundle);
      Properties targetMetaProp = i18nMgr.getPropertiesWithoutResolvingRecursively(null, testTargetBundle);
      assertNull(sourceMetaProp.getProperty(ktm + I18nManager.METADATA_ANNOTATION_POSTFIX));
      assertNull(sourceMetaProp.getProperty(ktm + I18nManager.METADATA_KEY_PRIORITY_POSTFIX));
      assertTrue(targetMetaProp.containsKey(ktm + I18nManager.METADATA_ANNOTATION_POSTFIX));
      assertEquals("100", targetMetaProp.getProperty(ktm + I18nManager.METADATA_KEY_PRIORITY_POSTFIX));
      //check for changed references in value
      //if correctly done, should still be resolvable
      assertTrue(sourcePropResolved.getProperty("key.to.stay2").indexOf(matchString)!=-1);
      tDMgr.logToFile("moveKey");
    }
  }
View Full Code Here

    if (WebappHelper.getBrasatoSourcePath() != null) {
      prepareDevToolTests();
      I18nManager i18nMgr = I18nManager.getInstance();
      String testSourceBundle = "org.olat.core.util.i18n.junittestdata.devtools.source";
      String testTargetBundle = "org.olat.core.util.i18n.junittestdata.devtools.target";
      TranslationDevManager tDMgr = TranslationDevManager.getInstance();
      tDMgr.movePackageTask(testSourceBundle, testTargetBundle);
      i18nMgr.clearCaches();
      Properties sourceProp = i18nMgr.getPropertiesWithoutResolvingRecursively(null, testSourceBundle);
      assertTrue(sourceProp.isEmpty());
      Properties targetProp = i18nMgr.getPropertiesWithoutResolvingRecursively(null, testTargetBundle);
      assertFalse(targetProp.isEmpty());   
      tDMgr.logToFile("movePackage");
    }
  }
View Full Code Here

    if (WebappHelper.getBrasatoSourcePath() != null) {
      prepareDevToolTests();
      I18nManager i18nMgr = I18nManager.getInstance();
      String testSourceBundle = "org.olat.core.util.i18n.junittestdata.devtools.source";
      String testTargetBundle = "org.olat.core.util.i18n.junittestdata.devtools.target";
      TranslationDevManager tDMgr = TranslationDevManager.getInstance();
      tDMgr.movePackageByMovingSingleKeysTask(testSourceBundle, testTargetBundle);
      i18nMgr.clearCaches();
      Properties sourceProp = i18nMgr.getPropertiesWithoutResolvingRecursively(null, testSourceBundle);
      assertTrue(sourceProp.isEmpty());
      Properties targetProp = i18nMgr.getPropertiesWithoutResolvingRecursively(null, testTargetBundle);
      assertFalse(targetProp.isEmpty());   
      tDMgr.logToFile("movePackageSingle");
    }
  }
View Full Code Here

    if (WebappHelper.getBrasatoSourcePath() != null) {
      prepareDevToolTests();
      I18nManager i18nMgr = I18nManager.getInstance();
      String testSourceBundle = "org.olat.core.util.i18n.junittestdata.devtools.source";
      String testTargetBundle = "org.olat.core.util.i18n.junittestdata.devtools.target";
      TranslationDevManager tDMgr = TranslationDevManager.getInstance();
      tDMgr.mergePackageTask(testSourceBundle, testTargetBundle);
      i18nMgr.clearCaches();
      assertTrue(i18nMgr.getPropertiesWithoutResolvingRecursively(null, testSourceBundle).isEmpty());
      //TODO: manipulate source/target first, merge and check if all is in target!
      //try to merge existing key
    }
View Full Code Here

 
  public void testRenameLanguageTask(){
    if (WebappHelper.getBrasatoSourcePath() != null) {
      prepareDevToolTests();
      I18nManager i18nMgr = I18nManager.getInstance();
      TranslationDevManager tDMgr = TranslationDevManager.getInstance();
      // create source
      Locale xxLocale = new Locale("xx");   
      String testSourceBundle =  "org.olat.core.util.i18n.junittestdata.devtools.source";
      String key = "key.to.move";
      I18nItem i18nItem = i18nMgr.getI18nItem(testSourceBundle, key, xxLocale);
      i18nMgr.saveOrUpdateI18nItem(i18nItem, "I have to go");
      i18nMgr.setAnnotation(i18nItem, "an annotation");
      i18nMgr.setKeyPriority(testSourceBundle, key, 100);
      // copy to target
      Locale yyLocale = new Locale("yy");   
      tDMgr.renameLanguageTask(xxLocale, yyLocale);
      i18nMgr.clearCaches();
      // test
      Properties deletedProperties = i18nMgr.getPropertiesWithoutResolvingRecursively(xxLocale, testSourceBundle);
      assertTrue(deletedProperties.isEmpty());   
      Properties targetProp = i18nMgr.getPropertiesWithoutResolvingRecursively(yyLocale, testSourceBundle);
View Full Code Here

    }
  }
 
  //TODO: RH: remove this or really test for correct finding?!
  public void testGetDouplicateKeys(){
    TranslationDevManager tDMgr = TranslationDevManager.getInstance();
    tDMgr.getDouplicateKeys();   
  }
View Full Code Here

    tDMgr.getDouplicateKeys();   
  }
 
//TODO: RH: remove this or really test for correct finding?!
  public void testGetDouplicateValues(){
    TranslationDevManager tDMgr = TranslationDevManager.getInstance();
    tDMgr.getDouplicateValues();   
  }
View Full Code Here

 
  public void testMoveLanguageTask(){
    if (WebappHelper.getBrasatoSourcePath() != null) {
      prepareDevToolTests();
      I18nManager i18nMgr = I18nManager.getInstance();
      TranslationDevManager tDMgr = TranslationDevManager.getInstance();
      String srcPath = WebappHelper.getSourcePath() + "/../test/java/org/olat/core/util/i18n/junittestdata/devtools/source";
      String targetPath = srcPath + "/../target";
      //only copy: target should exist
      Locale mvLocale = i18nMgr.getLocaleOrDefault("de");
      String testTargetBundle =  "org.olat.core.util.i18n.junittestdata.devtools.target";
      // test before move
      Properties targetProperties = i18nMgr.getPropertiesWithoutResolvingRecursively(mvLocale, testTargetBundle);
      assertTrue(!targetProperties.isEmpty());
      tDMgr.moveLanguageTask(mvLocale, srcPath, targetPath, false);
      // test after move
      targetProperties = i18nMgr.getPropertiesWithoutResolvingRecursively(mvLocale, testTargetBundle);
      assertTrue(!targetProperties.isEmpty());
      //move language: source should NOT exist
      tDMgr.moveLanguageTask(mvLocale, srcPath, targetPath, true);
      String testSourceBundle =  "org.olat.core.util.i18n.junittestdata.devtools.source";
      Properties sourceProperties = i18nMgr.getPropertiesWithoutResolvingRecursively(mvLocale, testSourceBundle);
      assertTrue(sourceProperties.isEmpty());
    }
  }
View Full Code Here

TOP

Related Classes of org.olat.core.util.i18n.devtools.TranslationDevManager

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.