Hi Geoff. A bit of an old thread now, but am also looking for a way to clear/reset persistent locale.
Did you/anyone come up with a solution? /magnus On Sat, Nov 24, 2012 at 3:57 AM, Geoff Callender < geoff.callender.jumpst...@gmail.com> wrote: > Once I have gone to a specific locale I can't get back to the default > locale in a way that leaves locale out of the URL. > > eg. from > http://localhost:8080/myapp/mypage > to > http://localhost:8080/myapp/en_GB/mypage > and back to > http://localhost:8080/myapp/mypage > > I have tried LocalizationSetter#setLocaleFromLocaleName("") but the locale > won't change because it isn't supported. > So I tried adding "" to the SUPPORTED_LOCALES, and that gave me an invalid > URL: > > http://localhost:8080/myapp//mypage > > Exactly the same effect using Locale.ROOT, because Locale.ROOT.toString() > is "" and Locale.ROOT.getDisplayName() is "". > > The source of the problem seems to be that locale starts off as null in > ThreadLocaleImpl and PersistentLocaleImpl but it's not possible to set it > back to null. > > What have I missed? > > On 20/11/2012, at 12:55 AM, Ivan Khalopik wrote: > > > I don't understand your question. > > But if you change locale using PersistentLocale service it will be > > persisted in URL and be changed for next page request. The new localale > > should also be configured in "tapestry.supported-locales" symbol. > > If you want to chnge locale just for this request you can use > > ThreadLocale#setLocale(...) method. > > If you need both variants with safety and advantage of finding the > closest > > supported locale use LocalizationSetter#setLocaleFromLocaleName("en") > > > > All message catalogs will be accessed by tapestry with right choose. Just > > use .properties for default locale, _ro.properties to override properties > > for ro locale, _en.properties for en locale. > > If you want to change locale to default (not ro) use Locale.ROOT constant > > for java 6, and new Locale("") for older versions. > > > > On Mon, Nov 19, 2012 at 3:10 PM, o3005659 <o3005...@rtrtr.com> wrote: > > > >> I have made localization ro and en. Ro is by default, however I didn't > >> extend > >> my property files with_ro extension, but I simply put > >> thisispropertyfile.properties. Now I have implemented for English > >> > >> public String onActionFromGoEnglish() > >> { > >> persistentLocale.set(new Locale("en")); > >> return null; > >> } > >> > >> however, I don't know how to access property files that have no _ro > >> extension in example when user switches from en to ro. What to points my > >> persistenLocale then? > >> > >> > >> > >> -- > >> View this message in context: > >> > http://tapestry.1045711.n5.nabble.com/Changing-to-default-localization-without-extension-for-the-language-tp5718092.html > >> Sent from the Tapestry - User mailing list archive at Nabble.com. > >> > >> --------------------------------------------------------------------- > >> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > >> For additional commands, e-mail: users-h...@tapestry.apache.org > >> > >> > > > > > > -- > > BR > > Ivan > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > For additional commands, e-mail: users-h...@tapestry.apache.org > >