Author: sshyrkov
Date: Mon Jun 4 17:20:50 2007
New Revision: 17456
URL: https://svndev.jahia.net/websvn/listing.php?sc=3D1&rev=3D17456&repname=
=3Djahia
Log:
JAHIA-1964: Ajax File Manager - message is localized in a wrong language.
Language parameter added to the URL for message resources
Modified:
trunk/core/src/java/org/jahia/taglibs/ajax/ZimbraInclude.java
Modified: trunk/core/src/java/org/jahia/taglibs/ajax/ZimbraInclude.java
URL: https://svndev.jahia.net/websvn/diff.php?path=3D/trunk/core/src/java/o=
rg/jahia/taglibs/ajax/ZimbraInclude.java&rev=3D17456&repname=3Djahia
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/core/src/java/org/jahia/taglibs/ajax/ZimbraInclude.java (original)
+++ trunk/core/src/java/org/jahia/taglibs/ajax/ZimbraInclude.java Mon Jun =
4 17:20:50 2007
@@ -17,14 +17,17 @@
*/
package org.jahia.taglibs.ajax;
=
+import org.apache.commons.lang.StringUtils;
import org.jahia.bin.Jahia;
import org.jahia.bin.filters.zimbra.SetHeaderFilter;
+import org.jahia.params.ProcessingContext;
=
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.jsp.JspWriter;
import javax.servlet.jsp.tagext.TagSupport;
import java.io.IOException;
+import java.util.Locale;
=
/**
* Simple Tag that should be called in the header of the HTML page. It pri=
nts out all the imports and
@@ -67,14 +70,16 @@
// servlet that serves the messages from server-side propertie=
s files.
buff.append("<script type=3D\"text/javascript\" src=3D\"");
buff.append(toolKitPath);
- buff.append("/msgs/I18nMsg,AjxMsg.js\"></script>\n");
- buff.append("<style type=3D\"text/css\">\n" +
+ buff.append("/msgs/I18nMsg,AjxMsg.js");
+ appendLocale(buff); =
+ buff.append("\"></script>\n");
+ buff.append("<style type=3D\"text/css\">\n" +
" <!--\n" +
" @import url( ").append(toolKitPath).append("/common/i=
mg/hiRes/dwtimgs.css );\n" +
" -->\n" +
"</style>\n");
- buff.append("<!-- ComplexTree CSS -->\n");
- buff.append("<style type=3D\"text/css\">\n" +
+ buff.append("<!-- ComplexTree CSS -->\n");
+ buff.append("<style type=3D\"text/css\">\n" +
" <!--\n" +
" @import url( ").append(complexTreePath).append("/cTre=
e.css );\n" +
" -->\n" +
@@ -100,4 +105,24 @@
}
return SKIP_BODY;
}
+ =
+ /**
+ * Appends session locale information to the I18N resources URL.
+ * @param buff the URL buffer
+ */
+ private void appendLocale(StringBuffer buff) {
+ final HttpServletRequest request =3D (HttpServletRequest)
pageContext
+ .getRequest();
+ if (request.getSession(false) !=3D null) {
+ Locale locale =3D (Locale)
request.getSession(false).getAttribute(
+ ProcessingContext.SESSION_LOCALE);
+ if (locale !=3D null) {
+
buff.append("?language=3D").append(locale.getLanguage());
+ if (StringUtils.isNotEmpty(locale.getCountry()))
+
buff.append("&country=3D").append(locale.getCountry());
+ if (StringUtils.isNotEmpty(locale.getVariant()))
+
buff.append("&variant=3D").append(locale.getVariant());
+ }
+ }
+ }
}
_______________________________________________
cvs_list mailing list
[email protected]
http://lists.jahia.org/cgi-bin/mailman/listinfo/cvs_list