You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by bu...@apache.org on 2003/04/25 01:47:17 UTC
DO NOT REPLY [Bug 19299] New: -
The tag locale function does not specify the country of a locale to lang
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=19299>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND
INSERTED IN THE BUG DATABASE.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=19299
The <html:html> tag locale function does not specify the country of a locale to lang
Summary: The <html:html> tag locale function does not specify the
country of a locale to lang
Product: Struts
Version: Nightly Build
Platform: All
OS/Version: All
Status: NEW
Severity: Normal
Priority: Other
Component: Custom Tags
AssignedTo: struts-dev@jakarta.apache.org
ReportedBy: chlee@femh.org.tw
In the HtmlTag, the locale function does not specify the country part of a
locale to lang. It could cause problems suggesting client browser to choose a
correct language set while Tranditional Chinese web page was used. Following are
the suggestion to correct it.
// Use the current Locale to set our language preferences
Locale currentLocale = this.getCurrentLocale();
String lang = currentLocale.getLanguage();
String country = currentLocale.getCountry().toLowerCase();
// Does the locale have a language?
boolean validLanguage = ((lang != null) && (lang.length() > 0));
boolean validCountry = ((country !=null) && (country.length() > 0));
if (this.xhtml) {
this.pageContext.setAttribute(Globals.XHTML_KEY, "true",
PageContext.PAGE_SCOPE);
sb.append(" xmlns=\"http://www.w3.org/1999/xhtml\"");
}
if ((this.locale || this.xhtml) && validLanguage) {
sb.append(" lang=\"");
sb.append(lang);
if (validCountry) {
sb.append("-");
sb.append(country);
}
sb.append("\"");
}
if (this.xhtml && validLanguage) {
sb.append(" xml:lang=\"");
sb.append(lang);
if (validCountry) {
sb.append("-");
sb.append(country);
}
sb.append("\"");
}
sb.append(">");
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-dev-help@jakarta.apache.org