Exemplo n.º 1
0
 protected void prepareDevToolTests() {
   // create test fixure in devtools.source
   // Roman: you can't check in a 'default' package (illegal package name in java)
   Locale testLocale = i18nMgr.getLocaleOrDefault("de");
   // key 1
   String key = "key.to.move";
   I18nItem i18nItem = i18nMgr.getI18nItem(testSourceBundle, key, testLocale);
   i18nMgr.saveOrUpdateI18nItem(i18nItem, "I have to go");
   i18nMgr.setAnnotation(i18nItem, "an annotation");
   i18nMgr.setKeyPriority(testSourceBundle, key, 100);
   // key 2
   key = "key.to.stay2";
   i18nItem = i18nMgr.getI18nItem(testSourceBundle, key, testLocale);
   i18nMgr.saveOrUpdateI18nItem(i18nItem, "hello $:key.to.move");
 }
Exemplo n.º 2
0
 @Test
 public void testRenameLanguageTask() {
   if (I18nModule.isTransToolEnabled()) {
     prepareDevToolTests();
     // create source
     Locale xxLocale = new Locale("xx");
     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);
     assertFalse(targetProp.isEmpty());
   }
 }