-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Mark,

On 1/14/20 2:45 PM, ma...@apache.org wrote:
> This is an automated email from the ASF dual-hosted git
> repository.
> 
> markt pushed a commit to branch master in repository
> https://gitbox.apache.org/repos/asf/tomcat.git
> 
> 
> The following commit(s) were added to refs/heads/master by this
> push: new a8bf66c  Fix
> https://bz.apache.org/bugzilla/show_bug.cgi?id=64000 i18n use
> client a8bf66c is described below
> 
> commit a8bf66c534dc3ca7ba358f00f858af5142a3f59b Author: Mark Thomas
> <ma...@apache.org> AuthorDate: Tue Jan 14 19:45:03 2020 +0000
> 
> Fix https://bz.apache.org/bugzilla/show_bug.cgi?id=64000 i18n use
> client
> 
> Ensure that the example web application uses the client locale
> rather than the server locale where it provides i18n support --- 
> .../examples/WEB-INF/classes/CookieExample.java    | 21
> ++++++++++----------- .../WEB-INF/classes/RequestHeaderExample.java
> |  6 +++--- .../WEB-INF/classes/RequestInfoExample.java        | 16
> ++++++++-------- .../WEB-INF/classes/RequestParamExample.java
> | 18 +++++++++--------- 
> .../examples/WEB-INF/classes/SessionExample.java   | 22
> +++++++++++----------- 5 files changed, 41 insertions(+), 42
> deletions(-)
> 
> diff --git a/webapps/examples/WEB-INF/classes/CookieExample.java
> b/webapps/examples/WEB-INF/classes/CookieExample.java index
> 50808bf..b91b52d 100644 ---
> a/webapps/examples/WEB-INF/classes/CookieExample.java +++
> b/webapps/examples/WEB-INF/classes/CookieExample.java @@ -39,13
> +39,12 @@ public class CookieExample extends HttpServlet {
> 
> private static final long serialVersionUID = 1L;
> 
> -    private static final ResourceBundle RB =
> ResourceBundle.getBundle("LocalStrings"); - @Override public void
> doGet(HttpServletRequest request, HttpServletResponse response) 
> throws IOException, ServletException { +        ResourceBundle rb =
> ResourceBundle.getBundle("LocalStrings",request.getLocale());

This is a good initial step, but it's not great. What a "real" web
application needs is what amounts to content-negotiation.

Since the client can send Accept-Lang: ru, fr, en, request.getLocale()
will get just the first of those (or the preferred one?). But if we
don't have e.g. "ru" locale, we should really fall-back to "fr", then
"en", etc.

I know it's more code, but it's what must be done in order to
implement things properly. Unfortunately, ResourceBundle doesn't ave a
way to get the available locales: you have to ask for each one in turn.

I'm happy to volunteer for the effort. I just wanted to get the
conversation started.

- -chris
-----BEGIN PGP SIGNATURE-----
Comment: Using GnuPG with Thunderbird - https://www.enigmail.net/

iQIzBAEBCAAdFiEEMmKgYcQvxMe7tcJcHPApP6U8pFgFAl4eRLIACgkQHPApP6U8
pFhYVQ/7B7s0BX8917YAQqZs3DmlxZ6fE5/m/Y+l/pwvdDwVpzie6GxD5b0n/FS7
XGBtM8FcR+dxOraM6J7pq1+bLNZIlrCZt3c26KHtaqXMAVU6UOAiHsvOMjd8+GtW
fnKQqPuE2IYiGkD59qlqypUnQBjopXHwbuQdkn96iawnqHaHwdXV+7i/o8FtXX9A
Ew2nkKPFHNM5tnG4UQ+rMj/i2yCuAf33zZoJS6Qw19ksyFWX1XhYzTY+f+DVRuMS
om+Jimysrth7nvytsaTxhLKSADpBhr8aBC4bOF/Ia6duf5qLzi/jDRPmBDM63hpG
bzHX9MF8c9j0vwTuCs/Xi95PbQlreJn/6JM02Xv9hGRhXWas1pqR3k3ZdeJ3vMK3
W3GU+t2k9wQErH5J/RNN95vHBJWhOvsVcKGJO8QZ79662WwonmiJtklZIvzQbt3R
xDGBudNfZcBXw+uAdrXXQ/zKJTQf9v8Zp1FJe1pUaS2gf5sOwE4Z2wNzSDSWYPgG
KT5DTlUAEnkM/fa5KE22oxitpAKK/yuLoujrDombgqTqkdz68ZObWqt6fWCvb68b
KWT4VLIJz26Q4gD1jMiGIvsEX9Pz/DJqrxf4h/8rG+gtnlry+yQJ+fqaPr3kEBcF
P8/+N+o4ulvxUtIfArnjkdVgeN2nWmCxh4TbhAIsCwE181ZT8dQ=
=iiLA
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to