//
// STAGE #1: add locale
//
{
IEditableSupport editableSupport = support.getEditable();
IEditableSource editableSource = editableSupport.getEditableSources().get(0);
// check initial locales
{
LocaleInfo[] locales = editableSource.getLocales();
assertEquals(1, locales.length);
assertEquals("(default)", locales[0].getTitle());
}
// add locales
{
editableSource.addLocale(new LocaleInfo(new Locale("it")), LocaleInfo.DEFAULT);
editableSource.addLocale(new LocaleInfo(new Locale("fr")), null);
}
// check new locales
{
LocaleInfo[] locales = editableSource.getLocales();
assertEquals(3, locales.length);
assertEquals("(default)", locales[0].getTitle());
assertEquals("fr", locales[1].getTitle());
assertEquals("it", locales[2].getTitle());
}
// apply commands
support.applyEditable(editableSupport);
// checks
{
// *.properties: default
{
String newProperties = getFileContentSrc("test/client/MyConstants.properties");
assertTrue(newProperties.contains("rootPanel_title=My title"));
}
// *.properties: fr
{
String newProperties = getFileContentSrc("test/client/MyConstants_fr.properties");
assertFalse(newProperties.contains("rootPanel_title=My title"));
}
// *.properties: it
{
String newProperties = getFileContentSrc("test/client/MyConstants_it.properties");
assertTrue(newProperties.contains("rootPanel_title=My title"));
}
// module
{
String module = getFileContentSrc("test/Module.gwt.xml");
assertTrue(module.contains("<extend-property name=\"locale\" values=\"fr,it\"/>"));
}
}
}
//
// STAGE #2: remove locale
//
{
IEditableSupport editableSupport = support.getEditable();
IEditableSource editableSource = editableSupport.getEditableSources().get(0);
// remove locales
{
editableSource.removeLocale(new LocaleInfo(new Locale("it")));
editableSource.removeLocale(new LocaleInfo(new Locale("fr")));
support.applyEditable(editableSupport);
}
// check new locales
{
LocaleInfo[] locales = editableSource.getLocales();
assertEquals(1, locales.length);
assertEquals("(default)", locales[0].getTitle());
}
// checks
{