예제 #1
0
 /** Test method i18nManager.searchForAvailableLanguages() */
 @Test
 public void testSearchForAvailableLanguages() {
   if (I18nModule.isTransToolEnabled()) {
     // Try to load i18n files and a jar from the testdata dir
     File testDataDir =
         new File(
             I18nModule.getTransToolApplicationLanguagesSrcDir(),
             "/../../test/java/org/olat/core/util/i18n/junittestdata/");
     assertTrue(testDataDir.exists());
     Set<String> foundLanguages = i18nMgr.searchForAvailableLanguages(testDataDir);
     // Set must contain some LocalStrings file:
     assertTrue(foundLanguages.contains("de"));
     assertTrue(foundLanguages.contains("en"));
     assertTrue(foundLanguages.contains("pt_BR"));
     // Set must contain some LocaleStrings from the jar package
     assertTrue(foundLanguages.contains("fr"));
     assertTrue(foundLanguages.contains("zh_CN"));
     // Final check
     assertEquals(6, foundLanguages.size());
   } else {
     Set<String> foundLanguages = I18nModule.getAvailableLanguageKeys();
     // Set must contain some LocaleStrings from the jar package
     assertTrue(foundLanguages.contains("fr"));
     assertTrue(foundLanguages.contains("zh_CN"));
   }
 }
예제 #2
0
 @Test
 public void testMoveLanguageTask() {
   if (I18nModule.isTransToolEnabled()) {
     prepareDevToolTests();
     String srcPath =
         I18nModule.getTransToolApplicationLanguagesSrcDir().getAbsolutePath()
             + "/../../test/java/org/olat/core/util/i18n/junittestdata/devtools";
     String targetPath = srcPath + "/../movetarget";
     // only copy: target should exist
     Locale mvLocale = i18nMgr.getLocaleOrDefault("de");
     // test before move
     Properties sourceProperties =
         i18nMgr.getPropertiesWithoutResolvingRecursively(mvLocale, testSourceBundle);
     assertFalse(sourceProperties.isEmpty());
     Properties moveProperties =
         i18nMgr.getPropertiesWithoutResolvingRecursively(mvLocale, testMoveTargetBundle);
     assertTrue(moveProperties.isEmpty());
     // copy
     tDMgr.moveLanguageTask(mvLocale, srcPath, targetPath, false);
     // test after copy
     sourceProperties =
         i18nMgr.getPropertiesWithoutResolvingRecursively(mvLocale, testSourceBundle);
     assertFalse(sourceProperties.isEmpty());
     moveProperties =
         i18nMgr.getPropertiesWithoutResolvingRecursively(mvLocale, testMoveTargetBundle);
     assertFalse(moveProperties.isEmpty());
     // move
     tDMgr.moveLanguageTask(mvLocale, srcPath, targetPath, true);
     // test after move
     sourceProperties =
         i18nMgr.getPropertiesWithoutResolvingRecursively(mvLocale, testSourceBundle);
     assertTrue(sourceProperties.isEmpty());
     moveProperties =
         i18nMgr.getPropertiesWithoutResolvingRecursively(mvLocale, testMoveTargetBundle);
     assertFalse(moveProperties.isEmpty());
   }
 }