use of com.agiletec.aps.system.services.i18n.II18nManager in project entando-core by entando.
the class LocaleStringFinderAction method getLocaleStrings.
public List<String> getLocaleStrings() {
List<String> labelKeys = new ArrayList<String>();
try {
II18nManager i18nManager = this.getI18nManager();
String text = this.getText();
String searchOption = this.getSearchOption();
if (null == text || text.trim().length() == 0) {
labelKeys.addAll(i18nManager.getLabelGroups().keySet());
} else if (searchOption == null || searchOption.length() == 0 || searchOption.equals("all")) {
labelKeys = i18nManager.searchLabelsKey(text, false, false, null);
} else if (searchOption.equals("labelkey")) {
labelKeys = i18nManager.searchLabelsKey(text, true, false, null);
} else {
labelKeys = i18nManager.searchLabelsKey(text, false, true, searchOption);
}
if (null != labelKeys) {
Collections.sort(labelKeys);
}
} catch (Exception e) {
_logger.error("error in getLocaleStrings", e);
}
return labelKeys;
}
use of com.agiletec.aps.system.services.i18n.II18nManager in project entando-core by entando.
the class I18nTag method extractLabel.
private String extractLabel(Lang currentLang) throws ApsSystemException {
String label = null;
II18nManager i18nManager = (II18nManager) ApsWebApplicationUtils.getBean(SystemConstants.I18N_MANAGER, this.pageContext);
try {
String key = this.getKey();
String langCode = this.getLang();
Map<String, String> params = this.getParameters();
if (StringUtils.isNotEmpty(langCode) && !currentLang.getCode().equalsIgnoreCase(langCode)) {
label = i18nManager.renderLabel(key, langCode, false, params);
}
if (label == null) {
label = i18nManager.renderLabel(key, currentLang.getCode(), true, params);
}
} catch (Throwable t) {
_logger.error("Error getting label", t);
throw new ApsSystemException("Error getting label", t);
}
return label;
}
use of com.agiletec.aps.system.services.i18n.II18nManager in project entando-core by entando.
the class TestApplicationContext method testGetServices.
public void testGetServices() {
ConfigInterface configManager = (ConfigInterface) this.getService(SystemConstants.BASE_CONFIG_MANAGER);
assertNotNull(configManager);
ICacheInfoManager cacheInfoManager = (ICacheInfoManager) this.getService(SystemConstants.CACHE_INFO_MANAGER);
assertNotNull(cacheInfoManager);
ILangManager langManager = (ILangManager) this.getService(SystemConstants.LANGUAGE_MANAGER);
assertNotNull(langManager);
IWidgetTypeManager showletTypeManager = (IWidgetTypeManager) this.getService(SystemConstants.WIDGET_TYPE_MANAGER);
assertNotNull(showletTypeManager);
IPageModelManager pageModelManager = (IPageModelManager) this.getService(SystemConstants.PAGE_MODEL_MANAGER);
assertNotNull(pageModelManager);
IPageManager pageManager = (IPageManager) this.getService(SystemConstants.PAGE_MANAGER);
assertNotNull(pageManager);
IRoleManager roleManager = (IRoleManager) this.getService(SystemConstants.ROLE_MANAGER);
assertNotNull(roleManager);
IUserManager userManager = (IUserManager) this.getService(SystemConstants.USER_MANAGER);
assertNotNull(userManager);
IURLManager urlManager = (IURLManager) this.getService(SystemConstants.URL_MANAGER);
assertNotNull(urlManager);
II18nManager i18nManager = (II18nManager) this.getService(SystemConstants.I18N_MANAGER);
assertNotNull(i18nManager);
// ControllerManager controller = (ControllerManager) this.getService(SystemConstants.CONTROLLER_MANAGER);
// assertNotNull(controller);
IKeyGeneratorManager keyGeneratorManager = (IKeyGeneratorManager) this.getService(SystemConstants.KEY_GENERATOR_MANAGER);
assertNotNull(keyGeneratorManager);
ICategoryManager categoryManager = (ICategoryManager) this.getService(SystemConstants.CATEGORY_MANAGER);
assertNotNull(categoryManager);
}
Aggregations