Re: Wicket localization in stateful pages

2013-11-17 Thread meduolis
Thanks for help,

I used this example to make localization work as I wanted:
http://www.wicket-library.com/wicket-examples-6.0.x/pub/?0

It does not reload page after setting new locale, so no new page version is
created and when you navigate back, using browser, locale stays the same.
Also I had to update all components to use dynamic models.




--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Back-button-issue-when-localizing-in-stateful-pages-tp4662260p4662461.html
Sent from the Users forum mailing list archive at Nabble.com.

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



Re: Wicket localization in stateful pages

2013-11-13 Thread Martin Grigorov
 So I tried to pass it using page parameters. Also, I have updated dynamic
label model to LoadableDetachableModel.

This is an option for you. See
http://www.wicket-library.com/wicket-examples-6.0.x/mappers/en_US
There are three links (EN, DE and BG). The demo uses LocaleFirstMapper to
set the locale in the session depending on the current url.


On Mon, Nov 11, 2013 at 7:02 PM, meduolis meduol...@gmail.com wrote:

 Storing it in page will not work as it will reset each time I call
 setResponsePage.
 Storing it in data base will not work also, because locale will became
 global for all visitors.
 So I tried to pass it using page parameters. Also, I have updated dynamic
 label model to LoadableDetachableModel.

 This time I got different result, but still, not what I expected.

 Back action restores locale from page parameter one step behind the value
 stored in session,
 so I got different values each time I go back.
 Attaching updated version, if there is still someone who will to help me:
 versionLocale.zip
 
 http://apache-wicket.1842946.n4.nabble.com/file/n4662326/versionLocale.zip
 



 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/Back-button-issue-when-localizing-in-stateful-pages-tp4662260p4662326.html
 Sent from the Users forum mailing list archive at Nabble.com.

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




Re: Wicket localization in stateful pages

2013-11-12 Thread Martin Grigorov
On Mon, Nov 11, 2013 at 7:02 PM, meduolis meduol...@gmail.com wrote:

 Storing it in page will not work as it will reset each time I call
 setResponsePage.
 Storing it in data base will not work also, because locale will became
 global for all visitors.
 So I tried to pass it using page parameters. Also, I have updated dynamic
 label model to LoadableDetachableModel.

 This time I got different result, but still, not what I expected.


What is actually the expected behavior ?
Please describe the full use case.



 Back action restores locale from page parameter one step behind the value
 stored in session,
 so I got different values each time I go back.
 Attaching updated version, if there is still someone who will to help me:
 versionLocale.zip
 
 http://apache-wicket.1842946.n4.nabble.com/file/n4662326/versionLocale.zip
 



 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/Back-button-issue-when-localizing-in-stateful-pages-tp4662260p4662326.html
 Sent from the Users forum mailing list archive at Nabble.com.

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




Re: Wicket localization in stateful pages

2013-11-12 Thread meduolis
Those are screenshots taken from quickstart project I have provided:

1. (0 page version) We enter the page. Default locale is EN.
Everything are localized in english because locale is correct for all
components
http://apache-wicket.1842946.n4.nabble.com/file/n4662342/1-enterTheSite.jpg 

2. (1 page version) Click to DE to sitch to german language.
Everything are localized in german because locale is correct for all
components
http://apache-wicket.1842946.n4.nabble.com/file/n4662342/2-changeTOGerman.jpg 

3. (0 page version) Click browser back button once.
Only No Model label got localized to english. Other stuff stays with
german locale
http://apache-wicket.1842946.n4.nabble.com/file/n4662342/3-browserBackCLickeOnce.jpg
 

What I expect on step 3:
Expected: *all components got localized to en_EN locale;*
Actual: No Model got localized to en_EN, but With model and
{wicket:message} stays in german.



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Back-button-issue-when-localizing-in-stateful-pages-tp4662260p4662342.html
Sent from the Users forum mailing list archive at Nabble.com.

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



Re: Wicket localization in stateful pages

2013-11-11 Thread Sven Meier

The back-button brings you back to the previous state of the component tree.

If your page is depending on external state (e.g. session or database 
content) for rendering, it will of course show the most recent data 
wherever you have told it so (by using a model).


Regards
Sven

On 11/10/2013 05:44 PM, meduolis wrote:

Exactly, I am really confused now. As I understand from your answer - this is
expected behavior.
I thought that back action should behave exactly the same when you
navigating the site using wicket controls.
Should I override back action somehow and do it myself?



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Back-button-issue-when-localizing-in-stateful-pages-tp4662260p4662262.html
Sent from the Users forum mailing list archive at Nabble.com.

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




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



Re: Wicket localization in stateful pages

2013-11-11 Thread Martin Grigorov
Hi,

As Sven explained 2. new Label(contentNoModel,
resolveLocalizedContent()); doesn't use dynamic model (a model that will
re-calculate its object/value on each request). It initializes the value of
the label at construction time and from there on this value doesn't change.
See
https://cwiki.apache.org/confluence/display/WICKET/Working+with+Wicket+models#WorkingwithWicketmodels-DynamicModels


On Mon, Nov 11, 2013 at 10:01 AM, Sven Meier s...@meiers.net wrote:

 The back-button brings you back to the previous state of the component
 tree.

 If your page is depending on external state (e.g. session or database
 content) for rendering, it will of course show the most recent data
 wherever you have told it so (by using a model).

 Regards
 Sven


 On 11/10/2013 05:44 PM, meduolis wrote:

 Exactly, I am really confused now. As I understand from your answer -
 this is
 expected behavior.
 I thought that back action should behave exactly the same when you
 navigating the site using wicket controls.
 Should I override back action somehow and do it myself?



 --
 View this message in context: http://apache-wicket.1842946.
 n4.nabble.com/Back-button-issue-when-localizing-in-stateful-pages-
 tp4662260p4662262.html
 Sent from the Users forum mailing list archive at Nabble.com.

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



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




Re: Wicket localization in stateful pages

2013-11-11 Thread meduolis
Hi Martin,

so, if I want browser back action to show the same result, I have to
choose between components with static models or components with dynamic
models only? Because if I use different types I will get different results
when backing to older page version? 
I am really not getting the thing here :). Shouldn't it be consistent?



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Back-button-issue-when-localizing-in-stateful-pages-tp4662260p4662319.html
Sent from the Users forum mailing list archive at Nabble.com.

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



Re: Wicket localization in stateful pages

2013-11-11 Thread Martin Grigorov
Hi meduolis,

I hope you know what http session is.
It doesn't matter how you get to a page (via a normal (forward) link or via
back button), when you read an attribute value from the session it will be
the same.

In your case the dynamic models use the session's locale to decide which
i18n resource bundle to use.


On Mon, Nov 11, 2013 at 4:49 PM, meduolis meduol...@gmail.com wrote:

 Hi Martin,

 so, if I want browser back action to show the same result, I have to
 choose between components with static models or components with dynamic
 models only? Because if I use different types I will get different results
 when backing to older page version?
 I am really not getting the thing here :). Shouldn't it be consistent?



 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/Back-button-issue-when-localizing-in-stateful-pages-tp4662260p4662319.html
 Sent from the Users forum mailing list archive at Nabble.com.

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




Re: Wicket localization in stateful pages

2013-11-11 Thread meduolis
So, back button does not restore locale value in session?

Ok, I will be more specific:

*action 1.* I click link switchLanguageToEN; (VERSION 1) (both labels (with
static and dynamic models) updates to english);
*action 2.* I click link switchLanguageToDE; (VERSION 2)(... updates to
german);
*action 3.* I click back in browser; (VERSION 1) (label with static model
updates to english, dynamic - stays german).

debug result:
Static model: getSession().getLocale() == en EN (locale restored from
version 1)
Dynamic model: getSession().getLocale() == de DE (locale taken from version
2)

My last question related to this topic (sorry for that spam):

1. Is there a way to restore locale for dynamic models when navigating
between page versions?





--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Back-button-issue-when-localizing-in-stateful-pages-tp4662260p4662323.html
Sent from the Users forum mailing list archive at Nabble.com.

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



Re: Wicket localization in stateful pages

2013-11-11 Thread Sven Meier

Is there a way to restore locale for dynamic models when navigating between 
page versions?


Whenever the locale is changed, put it in the session and store it in the page 
too.
Override #getLocale() and return whatever is stored as the page's locale.

Sven


On 11/11/2013 04:24 PM, meduolis wrote:

So, back button does not restore locale value in session?

Ok, I will be more specific:

*action 1.* I click link switchLanguageToEN; (VERSION 1) (both labels (with
static and dynamic models) updates to english);
*action 2.* I click link switchLanguageToDE; (VERSION 2)(... updates to
german);
*action 3.* I click back in browser; (VERSION 1) (label with static model
updates to english, dynamic - stays german).

debug result:
Static model: getSession().getLocale() == en EN (locale restored from
version 1)
Dynamic model: getSession().getLocale() == de DE (locale taken from version
2)

My last question related to this topic (sorry for that spam):

1. Is there a way to restore locale for dynamic models when navigating
between page versions?





--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Back-button-issue-when-localizing-in-stateful-pages-tp4662260p4662323.html
Sent from the Users forum mailing list archive at Nabble.com.

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




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



Re: Wicket localization in stateful pages

2013-11-11 Thread meduolis
Storing it in page will not work as it will reset each time I call
setResponsePage.
Storing it in data base will not work also, because locale will became
global for all visitors.
So I tried to pass it using page parameters. Also, I have updated dynamic
label model to LoadableDetachableModel.

This time I got different result, but still, not what I expected.

Back action restores locale from page parameter one step behind the value
stored in session,
so I got different values each time I go back.
Attaching updated version, if there is still someone who will to help me:
versionLocale.zip
http://apache-wicket.1842946.n4.nabble.com/file/n4662326/versionLocale.zip  



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Back-button-issue-when-localizing-in-stateful-pages-tp4662260p4662326.html
Sent from the Users forum mailing list archive at Nabble.com.

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



Wicket localization in stateful pages

2013-11-10 Thread meduolis
I have noticed that localization does not work for wicket when pages
versioning happens.

Let say I have three components in my page:
1. wicket:message key=localizedResouceKey /
2. new Label(contentNoModel, resolveLocalizedContent());
3. new Label(contentWithModel , new Model() { getObect() {return
resolveLocalizedContent()}});

and also I have two links, which allows me to switch between two locales;

So, I enter the page and click between locale links many times. Then I click
back button several times.

Components 1. and 3. never gets localized, only component 2. which does not
use model got localized.

It looks like when older page version loads model does not update with new
locale value.

Is this a bug or expected behavior?

Quickstart project where we can reproduce specified behavior:
versionLocale.zip
http://apache-wicket.1842946.n4.nabble.com/file/n4662260/versionLocale.zip  






--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Wicket-localization-in-stateful-pages-tp4662260.html
Sent from the Users forum mailing list archive at Nabble.com.

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



Re: Wicket localization in stateful pages

2013-11-10 Thread Sven Meier

Hi,

your quickstart works fine:

When you press the back button, the locale in the session stays on its 
last selection. Thus the dynamic localization in 1 and 3 stays on the 
current locale, while 2 show the previous locale, which was selected 
when the component was constructed.


Regards
Sven

On 11/10/2013 01:22 PM, meduolis wrote:

I have noticed that localization does not work for wicket when pages
versioning happens.

Let say I have three components in my page:
1. wicket:message key=localizedResouceKey /
2. new Label(contentNoModel, resolveLocalizedContent());
3. new Label(contentWithModel , new Model() { getObect() {return
resolveLocalizedContent()}});

and also I have two links, which allows me to switch between two locales;

So, I enter the page and click between locale links many times. Then I click
back button several times.

Components 1. and 3. never gets localized, only component 2. which does not
use model got localized.

It looks like when older page version loads model does not update with new
locale value.

Is this a bug or expected behavior?

Quickstart project where we can reproduce specified behavior:
versionLocale.zip
http://apache-wicket.1842946.n4.nabble.com/file/n4662260/versionLocale.zip






--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Wicket-localization-in-stateful-pages-tp4662260.html
Sent from the Users forum mailing list archive at Nabble.com.

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




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



Re: Wicket localization in stateful pages

2013-11-10 Thread meduolis
Exactly, I am really confused now. As I understand from your answer - this is
expected behavior. 
I thought that back action should behave exactly the same when you
navigating the site using wicket controls.
Should I override back action somehow and do it myself?



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Back-button-issue-when-localizing-in-stateful-pages-tp4662260p4662262.html
Sent from the Users forum mailing list archive at Nabble.com.

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