You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by angelochen <an...@yahoo.com.hk> on 2012/04/11 16:52:49 UTC
setting japanese locale in a service
hi,
in tapestry 5.3, i enabled the 'jp' and it works, but in a service if i do a
locale.setLocale(Locale.JAPANESE) in a PageLinkTransformer, it does not work
in the page, still shows English, but if i did Locale.CHINESE, it works. any
idea why? simplified code as follow:
public class SampleTransformer implements PageRenderLinkTransformer {
@Inject
private ContextValueEncoder contextValueEncoder;
@Inject
private Response response;
@Inject
private ThreadLocale locale;
// for outgoing link
public Link transformPageRenderLink(Link link,
PageRenderRequestParameters pageRenderRequestParameters) {
}
// for incoming links
public PageRenderRequestParameters decodePageRenderRequest(Request
request) {
// locale.setLocale(Locale.CHINESE); // this works
locale.setLocale(Locale.JAPANESE); // this does not work
return new PageRenderRequestParameters("sample/list",
new URLEventContext(contextValueEncoder, new
String[]{inf.get("code"), pageNo}), false);
}
return null;
}
}
--
View this message in context: http://tapestry.1045711.n5.nabble.com/setting-japanese-locale-in-a-service-tp5633103p5633103.html
Sent from the Tapestry - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: setting japanese locale in a service
Posted by Lance Java <la...@googlemail.com>.
Saying that your locale is "jp" is not really valid, you either specify
your language OR you specify your language/country (eg either "ja" or
"ja_JP) but never just the country as some countries speak multiple
languages.
en_GB and en_US will both default to "en" if a more specific message bundle
can not be found
Tapestry uses java's ResourceBundle under the hood (
http://docs.oracle.com/javase/1.4.2/docs/api/java/util/ResourceBundle.html)
Re: setting japanese locale in a service
Posted by angelochen <an...@yahoo.com.hk>.
thanks for the reply.
what's the difference of Local.JAPAN and Local.JAPANESE. does Local.JApAN
work for localhost:8080/jp ?
Lance Java wrote
>
> Locale.JAPANESE = "ja"
> You will need to supply an app_ja.properties.
> This will also work for Local.JAPAN (ja_JP)
>
> Cheers,
> Lance.
>
> On Wednesday, 11 April 2012, angelochen <angelochen960@.com> wrote:
>> i did:
>>
>> configuration.add("tapestry.supported-locales", "en,zh,ru,jp");
>>
>> a little confusion is, the doc says 'ja' not 'jp', but even 'ja' does not
>> work.
>>
>> to clear this question a little bit, i supply an app_jp.properties, and
> when
>> i do a localhost:8080/jp, it works.
>> the place it is not working is in a url rewrite where I do a
>> locale.setLocale(Locale.JAPANESE) and this does not show the page in
>> Japanese, if it is Locale.CHINESE it works.
>>
>> --
>> View this message in context:
> http://tapestry.1045711.n5.nabble.com/setting-japanese-locale-in-a-service-tp5633103p5633263.html
>> Sent from the Tapestry - User mailing list archive at Nabble.com.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@.apache
>> For additional commands, e-mail: users-help@.apache
>>
>>
>
--
View this message in context: http://tapestry.1045711.n5.nabble.com/setting-japanese-locale-in-a-service-tp5633103p5635315.html
Sent from the Tapestry - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: setting japanese locale in a service
Posted by Lance Java <la...@googlemail.com>.
Locale.JAPANESE = "ja"
You will need to supply an app_ja.properties.
This will also work for Local.JAPAN (ja_JP)
Cheers,
Lance.
On Wednesday, 11 April 2012, angelochen <an...@yahoo.com.hk> wrote:
> i did:
>
> configuration.add("tapestry.supported-locales", "en,zh,ru,jp");
>
> a little confusion is, the doc says 'ja' not 'jp', but even 'ja' does not
> work.
>
> to clear this question a little bit, i supply an app_jp.properties, and
when
> i do a localhost:8080/jp, it works.
> the place it is not working is in a url rewrite where I do a
> locale.setLocale(Locale.JAPANESE) and this does not show the page in
> Japanese, if it is Locale.CHINESE it works.
>
> --
> View this message in context:
http://tapestry.1045711.n5.nabble.com/setting-japanese-locale-in-a-service-tp5633103p5633263.html
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
Re: setting japanese locale in a service
Posted by angelochen <an...@yahoo.com.hk>.
i did:
configuration.add("tapestry.supported-locales", "en,zh,ru,jp");
a little confusion is, the doc says 'ja' not 'jp', but even 'ja' does not
work.
to clear this question a little bit, i supply an app_jp.properties, and when
i do a localhost:8080/jp, it works.
the place it is not working is in a url rewrite where I do a
locale.setLocale(Locale.JAPANESE) and this does not show the page in
Japanese, if it is Locale.CHINESE it works.
--
View this message in context: http://tapestry.1045711.n5.nabble.com/setting-japanese-locale-in-a-service-tp5633103p5633263.html
Sent from the Tapestry - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: setting japanese locale in a service
Posted by Lance Java <la...@googlemail.com>.
Have you added jp to the list of supported locales?
http://tapestry.apache.org/configuration.html#Configuration-tapestry.supportedlocales