You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@roller.apache.org by "Miles Huang (JIRA)" <no...@atlassian.com> on 2007/05/15 15:32:55 UTC
[Roller-JIRA] Created: (ROL-1413) i18n locale determine problems of
roller ui and rendering system
i18n locale determine problems of roller ui and rendering system
----------------------------------------------------------------
Key: ROL-1413
URL: http://opensource.atlassian.com/projects/roller/browse/ROL-1413
Project: Roller
Issue Type: Bug
Components: User Interface - General
Environment: Any
Reporter: Miles Huang
Assignee: Roller Unassigned
Roller uses many ways to implement i18n messages.
Consider following locales:
Locale.getDefaultLocale(),
request.getLocale(),
RollerSession.getRollerSession(request).getAuthenticatedUser().getLocale()
More cumbersome, current codes use different locales to get i18n message, which leads to different languages even on a single page.
For a real web site for global users, it's quit common that all these locales have different values.
In detail, following java classes and JSP pages have problem on i18n locale determine algorithm:
The MessageUtilities.java: Use JVM default locale blindly, leave user preferred locale unchecked.
The UtilitiesModel: Its formatDate methods use JVM default locale blindly.
The StrutsCharEncodingFilter.java and taglibs.jsp: new Locale(String) will construct a locale instance which has only language part without country part, passing a '_' delimited locale string to the construtor , eg. new Locale("en_US"), is buggy. Everywhere there are getLocaleInstance() methods which do the right thing.
The taglibs.jsp: Change JSTL fmt locale to authenticated user's locale only, leaves struts MessageResource locale setting along.
The WeblogTemplateFormAction, BasePageModel, CommentServlet, SearchResultsModel, SearchResultsFeedModel, SearchResultsPager, SearchResultsFeedPager: Use a static ResourceBundle instance for all requests, does every one speaking same language? ;-)
The StrutsUtil: single localeBeans and timeZoneBeans for the whole world.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/roller/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
[Roller-JIRA] Updated: (ROL-1413) i18n locale determine problems of
roller ui and rendering system
Posted by "Miles Huang (JIRA)" <no...@atlassian.com>.
[ http://opensource.atlassian.com/projects/roller/browse/ROL-1413?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Miles Huang updated ROL-1413:
-----------------------------
Attachment: i18n.patch
A patch file is attached here to address these problems. Many files have been touched. Sorry for it. But I'm sure there are more files than these that have i18n problems. I'd like to dig more into it as soon as these critical ones are resolved.
> i18n locale determine problems of roller ui and rendering system
> ----------------------------------------------------------------
>
> Key: ROL-1413
> URL: http://opensource.atlassian.com/projects/roller/browse/ROL-1413
> Project: Roller
> Issue Type: Bug
> Components: User Interface - General
> Environment: Any
> Reporter: Miles Huang
> Assignee: Roller Unassigned
> Attachments: i18n.patch
>
>
> Roller uses many ways to implement i18n messages.
> Consider following locales:
> Locale.getDefaultLocale(),
> request.getLocale(),
> RollerSession.getRollerSession(request).getAuthenticatedUser().getLocale()
> More cumbersome, current codes use different locales to get i18n message, which leads to different languages even on a single page.
> For a real web site for global users, it's quit common that all these locales have different values.
> In detail, following java classes and JSP pages have problem on i18n locale determine algorithm:
> The MessageUtilities.java: Use JVM default locale blindly, leave user preferred locale unchecked.
> The UtilitiesModel: Its formatDate methods use JVM default locale blindly.
> The StrutsCharEncodingFilter.java and taglibs.jsp: new Locale(String) will construct a locale instance which has only language part without country part, passing a '_' delimited locale string to the construtor , eg. new Locale("en_US"), is buggy. Everywhere there are getLocaleInstance() methods which do the right thing.
> The taglibs.jsp: Change JSTL fmt locale to authenticated user's locale only, leaves struts MessageResource locale setting along.
> The WeblogTemplateFormAction, BasePageModel, CommentServlet, SearchResultsModel, SearchResultsFeedModel, SearchResultsPager, SearchResultsFeedPager: Use a static ResourceBundle instance for all requests, does every one speaking same language? ;-)
> The StrutsUtil: single localeBeans and timeZoneBeans for the whole world.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/roller/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
[Roller-JIRA] Commented: (ROL-1413) i18n locale determine problems
of roller ui and rendering system
Posted by "Allen Gilliland (JIRA)" <no...@atlassian.com>.
[ http://opensource.atlassian.com/projects/roller/browse/ROL-1413?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_13777 ]
Allen Gilliland commented on ROL-1413:
--------------------------------------
A first attempt at some fixes for this issue have been committed at trunk revision 541035.
The commit note is as follows ...
initial fix for ROL-1337 and ROL-1413 which aim to improve and consistify the i18n situation in Roller. this commit attempts to simplify and unify the strategy for dealing with i18n message strings primarily in places used for weblog rendering.
The main changes here include ...
1. changing the static MessageUtilites class into an instantiable I18nMessages class which is tied to a specific locale.
2. updating places in the code which used to use the old MessageUtilities class
to make use of the new I18nMessages class and do so using the most appropriate locale possible.
> i18n locale determine problems of roller ui and rendering system
> ----------------------------------------------------------------
>
> Key: ROL-1413
> URL: http://opensource.atlassian.com/projects/roller/browse/ROL-1413
> Project: Roller
> Issue Type: Bug
> Components: User Interface - General
> Environment: Any
> Reporter: Miles Huang
> Assignee: Roller Unassigned
> Attachments: i18n.patch
>
>
> Roller uses many ways to implement i18n messages.
> Consider following locales:
> Locale.getDefaultLocale(),
> request.getLocale(),
> RollerSession.getRollerSession(request).getAuthenticatedUser().getLocale()
> More cumbersome, current codes use different locales to get i18n message, which leads to different languages even on a single page.
> For a real web site for global users, it's quit common that all these locales have different values.
> In detail, following java classes and JSP pages have problem on i18n locale determine algorithm:
> The MessageUtilities.java: Use JVM default locale blindly, leave user preferred locale unchecked.
> The UtilitiesModel: Its formatDate methods use JVM default locale blindly.
> The StrutsCharEncodingFilter.java and taglibs.jsp: new Locale(String) will construct a locale instance which has only language part without country part, passing a '_' delimited locale string to the construtor , eg. new Locale("en_US"), is buggy. Everywhere there are getLocaleInstance() methods which do the right thing.
> The taglibs.jsp: Change JSTL fmt locale to authenticated user's locale only, leaves struts MessageResource locale setting along.
> The WeblogTemplateFormAction, BasePageModel, CommentServlet, SearchResultsModel, SearchResultsFeedModel, SearchResultsPager, SearchResultsFeedPager: Use a static ResourceBundle instance for all requests, does every one speaking same language? ;-)
> The StrutsUtil: single localeBeans and timeZoneBeans for the whole world.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/roller/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
[Roller-JIRA] Commented: (ROL-1413) i18n locale determine problems
of roller ui and rendering system
Posted by "Allen Gilliland (JIRA)" <no...@atlassian.com>.
[ http://opensource.atlassian.com/projects/roller/browse/ROL-1413?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_13774 ]
Allen Gilliland commented on ROL-1413:
--------------------------------------
I took a look at this patch and while it does improve a number of things I'm not convinced that it really solves the problem in the ideal way. In particular i'm too keen on using TLS for things, especially not for providing shared access to something like a locale key. Instead I would prefer to see an approach where any component which is dealing with data which will be displayed to the user is properly aware of how to take locale and timeZone into account in it's operations.
So, as an alternative to the submitted patch I have some code which does roughly the same thing but in a slightly different fashion. The major change is that instead of having the MessageUtilities class remain static it will provide a static factory which will dispense immutable instances which are tied to a specific locale. The idea here being that any class which wants to do messaging can ask for access to a MessageUtilities instance, but it must supply a locale that the messages will be in.
Once this is done we can begin touching up the rest of the code to properly get an instance of the MessageUtilities class in the locale that should be used.
I'll be committing some of this code pretty soon, so please feel free to review and offer feedback.
Side Note: a number of the classes & jsps originally listed have already been EOLed as part of the struts1 -> struts2 migration and therefore are no longer of concern. The new struts2 ui does i18n solely using browser language preferences, which is the most consistent approach.
> i18n locale determine problems of roller ui and rendering system
> ----------------------------------------------------------------
>
> Key: ROL-1413
> URL: http://opensource.atlassian.com/projects/roller/browse/ROL-1413
> Project: Roller
> Issue Type: Bug
> Components: User Interface - General
> Environment: Any
> Reporter: Miles Huang
> Assignee: Roller Unassigned
> Attachments: i18n.patch
>
>
> Roller uses many ways to implement i18n messages.
> Consider following locales:
> Locale.getDefaultLocale(),
> request.getLocale(),
> RollerSession.getRollerSession(request).getAuthenticatedUser().getLocale()
> More cumbersome, current codes use different locales to get i18n message, which leads to different languages even on a single page.
> For a real web site for global users, it's quit common that all these locales have different values.
> In detail, following java classes and JSP pages have problem on i18n locale determine algorithm:
> The MessageUtilities.java: Use JVM default locale blindly, leave user preferred locale unchecked.
> The UtilitiesModel: Its formatDate methods use JVM default locale blindly.
> The StrutsCharEncodingFilter.java and taglibs.jsp: new Locale(String) will construct a locale instance which has only language part without country part, passing a '_' delimited locale string to the construtor , eg. new Locale("en_US"), is buggy. Everywhere there are getLocaleInstance() methods which do the right thing.
> The taglibs.jsp: Change JSTL fmt locale to authenticated user's locale only, leaves struts MessageResource locale setting along.
> The WeblogTemplateFormAction, BasePageModel, CommentServlet, SearchResultsModel, SearchResultsFeedModel, SearchResultsPager, SearchResultsFeedPager: Use a static ResourceBundle instance for all requests, does every one speaking same language? ;-)
> The StrutsUtil: single localeBeans and timeZoneBeans for the whole world.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/roller/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira