use of com.agiletec.aps.system.services.lang.Lang in project entando-core by entando.
the class TestLinkResolverManager method setUp.
@Override
public void setUp() throws Exception {
try {
super.setUp();
_reqCtx = this.getRequestContext();
Lang lang = new Lang();
lang.setCode("it");
lang.setDescr("italiano");
_reqCtx.addExtraParam(SystemConstants.EXTRAPAR_CURRENT_LANG, lang);
this.init();
} catch (Throwable t) {
throw new Exception(t);
}
}
use of com.agiletec.aps.system.services.lang.Lang in project entando-core by entando.
the class I18nFrontEndInterceptor method intercept.
@Override
public String intercept(ActionInvocation invocation) throws Exception {
HttpServletRequest request = ServletActionContext.getRequest();
RequestContext reqCtx = (RequestContext) request.getAttribute(RequestContext.REQCTX);
if (null != reqCtx) {
Lang currentLang = (Lang) reqCtx.getExtraParam(SystemConstants.EXTRAPAR_CURRENT_LANG);
Locale locale = new Locale(currentLang.getCode(), "");
invocation.getInvocationContext().setLocale(locale);
}
return invocation.invoke();
}
use of com.agiletec.aps.system.services.lang.Lang in project entando-core by entando.
the class FrontServletActionRedirectResult method execute.
@Override
public void execute(ActionInvocation invocation) throws Exception {
try {
this._actionName = this.conditionalParse(this._actionName, invocation);
if (this._namespace == null) {
this._namespace = invocation.getProxy().getNamespace();
} else {
this._namespace = this.conditionalParse(this._namespace, invocation);
}
if (this._method == null) {
this._method = "";
} else {
this._method = this.conditionalParse(this._method, invocation);
}
String anchorDest = null;
Map<String, String> redirectParams = new HashMap<String, String>();
ResultConfig resultConfig = invocation.getProxy().getConfig().getResults().get(invocation.getResultCode());
if (resultConfig != null) {
this.extractResultParams(redirectParams, resultConfig, invocation);
anchorDest = this.extractAnchorDest(resultConfig, invocation);
}
HttpServletRequest request = ServletActionContext.getRequest();
RequestContext reqCtx = (RequestContext) request.getAttribute(RequestContext.REQCTX);
this.extractInternalServletParams(redirectParams, reqCtx);
IURLManager urlManager = (IURLManager) ApsWebApplicationUtils.getBean(SystemConstants.URL_MANAGER, request);
Page currentPage = (Page) reqCtx.getExtraParam(SystemConstants.EXTRAPAR_CURRENT_PAGE);
Lang currentLang = (Lang) reqCtx.getExtraParam(SystemConstants.EXTRAPAR_CURRENT_LANG);
String url = urlManager.createURL(currentPage, currentLang, redirectParams, false, request);
if (null != anchorDest) {
url += "#" + anchorDest;
}
this.setLocation(url);
} catch (Throwable t) {
_logger.error("error in execute", t);
}
super.execute(invocation);
}
use of com.agiletec.aps.system.services.lang.Lang in project entando-core by entando.
the class ApiServiceAction method checkDescriptions.
private void checkDescriptions() {
this.setDescriptions(new ApsProperties());
Iterator<Lang> langsIter = this.getLangManager().getLangs().iterator();
while (langsIter.hasNext()) {
Lang lang = (Lang) langsIter.next();
String titleKey = "lang_" + lang.getCode();
String title = this.getRequest().getParameter(titleKey);
if (null == title || title.trim().length() == 0) {
String[] args = { lang.getDescr() };
this.addFieldError(titleKey, this.getText("error.service.new.insertDescription", args));
} else {
this.getDescriptions().put(lang.getCode(), title.trim());
}
}
}
use of com.agiletec.aps.system.services.lang.Lang in project entando-core by entando.
the class RowContentListViewerWidgetAction method isMultilanguageParamValued.
private boolean isMultilanguageParamValued(String prefix) {
ApsProperties config = this.getWidget().getConfig();
if (null == config) {
return false;
}
for (int i = 0; i < this.getLangs().size(); i++) {
Lang lang = this.getLangs().get(i);
String paramValue = config.getProperty(prefix + lang.getCode());
if (null != paramValue && paramValue.trim().length() > 0) {
return true;
}
}
return false;
}
Aggregations