[Major] Fixed and renamed I18n* classes
This commit is contained in:
parent
b1ff39501b
commit
faf9df3556
|
@ -0,0 +1,21 @@
|
|||
package li.strolch.agent;
|
||||
|
||||
import java.util.Locale;
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
public class I18nAgent {
|
||||
private static final String BUNDLE = "strolch-agent";
|
||||
|
||||
public static final ResourceBundle i18nAgent = ResourceBundle.getBundle(BUNDLE);
|
||||
|
||||
public static ResourceBundle getBundle(Locale locale) {
|
||||
return ResourceBundle.getBundle(BUNDLE, locale);
|
||||
}
|
||||
|
||||
public static String i18n(Locale locale, String key) {
|
||||
ResourceBundle bundle = ResourceBundle.getBundle(BUNDLE, locale);
|
||||
if (bundle.containsKey(key))
|
||||
return bundle.getString(key);
|
||||
return key;
|
||||
}
|
||||
}
|
|
@ -1,7 +0,0 @@
|
|||
package li.strolch.agent;
|
||||
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
public class I18nAgentBundle {
|
||||
public static final ResourceBundle i18nAgentBundle = ResourceBundle.getBundle("strolch-agent");
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
package li.strolch.execution.service;
|
||||
|
||||
import static li.strolch.service.I18nServiceBundle.i18nServiceBundle;
|
||||
import static li.strolch.service.I18nService.i18nService;
|
||||
|
||||
import li.strolch.execution.ExecutionHandler;
|
||||
import li.strolch.execution.ExecutionHandlerState;
|
||||
|
@ -34,7 +34,7 @@ public class StartActivityExecutionService extends AbstractService<LocatorArgume
|
|||
if (executionHandlerState != ExecutionHandlerState.Running)
|
||||
return new StrolchRootElementResult(ServiceResultState.WARNING,
|
||||
"ExecutionHandler is not running, can not start new jobs!")
|
||||
.i18n(i18nServiceBundle, "execution.handler.invalidState", "state", executionHandlerState);
|
||||
.i18n(i18nService, "execution.handler.invalidState", "state", executionHandlerState);
|
||||
|
||||
executionHandler.addForExecution(realm, arg.locator);
|
||||
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
package li.strolch.service;
|
||||
|
||||
import java.util.Locale;
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
public class I18nService {
|
||||
private static final String BUNDLE = "strolch-service";
|
||||
|
||||
public static final ResourceBundle i18nService = ResourceBundle.getBundle(BUNDLE);
|
||||
|
||||
public static ResourceBundle getBundle(Locale locale) {
|
||||
return ResourceBundle.getBundle(BUNDLE, locale);
|
||||
}
|
||||
|
||||
public static String i18n(Locale locale, String key) {
|
||||
ResourceBundle bundle = ResourceBundle.getBundle(BUNDLE, locale);
|
||||
if (bundle.containsKey(key))
|
||||
return bundle.getString(key);
|
||||
return key;
|
||||
}
|
||||
}
|
|
@ -1,7 +0,0 @@
|
|||
package li.strolch.service;
|
||||
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
public class I18nServiceBundle {
|
||||
public static final ResourceBundle i18nServiceBundle = ResourceBundle.getBundle("strolch-service");
|
||||
}
|
|
@ -1,14 +0,0 @@
|
|||
package li.strolch.utils;
|
||||
|
||||
import java.util.Locale;
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
public class I18nStrolchUtilsBundle {
|
||||
|
||||
public static String i18n(Locale locale, String key) {
|
||||
ResourceBundle bundle = ResourceBundle.getBundle("strolch-utils", locale);
|
||||
if (bundle.containsKey(key))
|
||||
return bundle.getString(key);
|
||||
return key;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
package li.strolch.utils;
|
||||
|
||||
import java.util.Locale;
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
public class I18nUtils {
|
||||
private static final String BUNDLE = "strolch-utils";
|
||||
|
||||
public static final ResourceBundle i18nUtils = ResourceBundle.getBundle(BUNDLE);
|
||||
|
||||
public static ResourceBundle getBundle(Locale locale) {
|
||||
return ResourceBundle.getBundle(BUNDLE, locale);
|
||||
}
|
||||
|
||||
public static String i18n(Locale locale, String key) {
|
||||
ResourceBundle bundle = ResourceBundle.getBundle(BUNDLE, locale);
|
||||
if (bundle.containsKey(key))
|
||||
return bundle.getString(key);
|
||||
return key;
|
||||
}
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
package li.strolch.utils.time;
|
||||
|
||||
import static li.strolch.utils.I18nStrolchUtilsBundle.i18n;
|
||||
import static li.strolch.utils.I18nUtils.i18n;
|
||||
|
||||
import java.time.Duration;
|
||||
import java.time.Period;
|
||||
|
|
Loading…
Reference in New Issue