Re: Basic l10n / i18n question: must page be re-rendered?

2011-08-26 Thread Alexandros Karypidis

Hi again,

Just to add to this that the following will work for pages with parameters:

@Override
protected void onSelectionChanged(Locale newSelection) {
super.onSelectionChanged(newSelection);
// the following tells wicket to instantiate a new page using 
the current page's class
getRequestCycle().setResponsePage(getPage().getClass(), 
getPage.getParameters());

}


On 23/8/2011 10:41 μμ, Alexandros Karypidis wrote:

Hi Gregor,

I've found a way to do this by manipulating the request cycle. 
However, it will only work if you don't mind losing any page state, as 
it generates a new page rendering. I do this by overriding 
onSelectionChanged(...) of the DropDownChoiceLocale as follows:


@Override
protected void onSelectionChanged(Locale newSelection) {
super.onSelectionChanged(newSelection);
// the following tells wicket to instantiate a new page using 
the current page's class

getRequestCycle().setResponsePage(getPage().getClass());
}

Maybe a more knowledgeable user could suggest a better alternative?

On 23/8/2011 9:13 μμ, Gregor Kaczor wrote:
I have exactly the same problem, though i use an xml file for the 
translations. Any help out there?


On 08/23/2011 02:09 PM, Alexandros Karypidis wrote:

Hello,

I have written a locale selector by extending DropDownChoice (you 
can see the essential stuff of the implementation below). The 
problem is that when the user changes the locale, the page needs to 
be re-rendered using the newly selected locale. This does NOT 
happen. Instead, only the select input box seems to be refreshed 
to use the new locale, whereas the rest of the page content is still 
rendered using the previously selected locale. However, the locale 
has been changed in the Session which can be seen when the user 
navigates to another page (e.g. by clicking on a link), as the new 
page is rendered using the newly-selected locale.


So, how can I force the current page to be re-rendered?

Implementation of my locale selector is as follows:

Markup: select wicket:id=localeSelection/select
Component code:
public class LocaleDropDown extends DropDownChoiceLocale {
//...
public LocaleDropDown(final String id, final ListLocale 
choices) {

// ...
setModel(new IModelLocale() {
public Locale getObject() {
return getSession().getLocale();
}
@Override
public void setObject(Locale locale) {
getSession().setLocale(locale);
// need something here to tell wicket to refresh the 
entire page?

}
});
// ...
}

@Override
protected boolean wantOnSelectionChangedNotifications() {
// post an event when user changes the selected value in the 
drop-down box

return true;
}
}

-- Kind regards, Alex

-
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



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



Basic l10n / i18n question: must page be re-rendered?

2011-08-23 Thread Alexandros Karypidis

Hello,

I have written a locale selector by extending DropDownChoice (you can 
see the essential stuff of the implementation below). The problem is 
that when the user changes the locale, the page needs to be re-rendered 
using the newly selected locale. This does NOT happen. Instead, only the 
select input box seems to be refreshed to use the new locale, 
whereas the rest of the page content is still rendered using the 
previously selected locale. However, the locale has been changed in the 
Session which can be seen when the user navigates to another page (e.g. 
by clicking on a link), as the new page is rendered using the 
newly-selected locale.


So, how can I force the current page to be re-rendered?

Implementation of my locale selector is as follows:

Markup: select wicket:id=localeSelection/select
Component code:
public class LocaleDropDown extends DropDownChoiceLocale {
//...
public LocaleDropDown(final String id, final ListLocale choices) {
// ...
setModel(new IModelLocale() {
public Locale getObject() {
return getSession().getLocale();
}
@Override
public void setObject(Locale locale) {
getSession().setLocale(locale);
// need something here to tell wicket to refresh the 
entire page?

}
});
// ...
}

@Override
protected boolean wantOnSelectionChangedNotifications() {
// post an event when user changes the selected value in the 
drop-down box

return true;
}
}

-- Kind regards, Alex

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



Re: Basic l10n / i18n question: must page be re-rendered?

2011-08-23 Thread Gregor Kaczor
I have exactly the same problem, though i use an xml file for the 
translations. Any help out there?


On 08/23/2011 02:09 PM, Alexandros Karypidis wrote:

Hello,

I have written a locale selector by extending DropDownChoice (you can 
see the essential stuff of the implementation below). The problem is 
that when the user changes the locale, the page needs to be 
re-rendered using the newly selected locale. This does NOT happen. 
Instead, only the select input box seems to be refreshed to use 
the new locale, whereas the rest of the page content is still rendered 
using the previously selected locale. However, the locale has been 
changed in the Session which can be seen when the user navigates to 
another page (e.g. by clicking on a link), as the new page is rendered 
using the newly-selected locale.


So, how can I force the current page to be re-rendered?

Implementation of my locale selector is as follows:

Markup: select wicket:id=localeSelection/select
Component code:
public class LocaleDropDown extends DropDownChoiceLocale {
//...
public LocaleDropDown(final String id, final ListLocale choices) {
// ...
setModel(new IModelLocale() {
public Locale getObject() {
return getSession().getLocale();
}
@Override
public void setObject(Locale locale) {
getSession().setLocale(locale);
// need something here to tell wicket to refresh the 
entire page?

}
});
// ...
}

@Override
protected boolean wantOnSelectionChangedNotifications() {
// post an event when user changes the selected value in the 
drop-down box

return true;
}
}

-- Kind regards, Alex

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




--
How to find files on the Internet? FindFiles.net http://findfiles.net!


Re: Basic l10n / i18n question: must page be re-rendered?

2011-08-23 Thread Alexandros Karypidis

Hi Gregor,

I've found a way to do this by manipulating the request cycle. However, 
it will only work if you don't mind losing any page state, as it 
generates a new page rendering. I do this by overriding 
onSelectionChanged(...) of the DropDownChoiceLocale as follows:


@Override
protected void onSelectionChanged(Locale newSelection) {
super.onSelectionChanged(newSelection);
// the following tells wicket to instantiate a new page using 
the current page's class

getRequestCycle().setResponsePage(getPage().getClass());
}

Maybe a more knowledgeable user could suggest a better alternative?

On 23/8/2011 9:13 μμ, Gregor Kaczor wrote:
I have exactly the same problem, though i use an xml file for the 
translations. Any help out there?


On 08/23/2011 02:09 PM, Alexandros Karypidis wrote:

Hello,

I have written a locale selector by extending DropDownChoice (you can 
see the essential stuff of the implementation below). The problem is 
that when the user changes the locale, the page needs to be 
re-rendered using the newly selected locale. This does NOT happen. 
Instead, only the select input box seems to be refreshed to use 
the new locale, whereas the rest of the page content is still 
rendered using the previously selected locale. However, the locale 
has been changed in the Session which can be seen when the user 
navigates to another page (e.g. by clicking on a link), as the new 
page is rendered using the newly-selected locale.


So, how can I force the current page to be re-rendered?

Implementation of my locale selector is as follows:

Markup: select wicket:id=localeSelection/select
Component code:
public class LocaleDropDown extends DropDownChoiceLocale {
//...
public LocaleDropDown(final String id, final ListLocale choices) {
// ...
setModel(new IModelLocale() {
public Locale getObject() {
return getSession().getLocale();
}
@Override
public void setObject(Locale locale) {
getSession().setLocale(locale);
// need something here to tell wicket to refresh the 
entire page?

}
});
// ...
}

@Override
protected boolean wantOnSelectionChangedNotifications() {
// post an event when user changes the selected value in the 
drop-down box

return true;
}
}

-- Kind regards, Alex

-
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: Basic l10n / i18n question: must page be re-rendered?

2011-08-23 Thread Igor Vaynberg
the pub and form input examples works correctly, take a look at those.

-igor


On Tue, Aug 23, 2011 at 11:13 AM, Gregor Kaczor gkac...@gmx.de wrote:
 I have exactly the same problem, though i use an xml file for the
 translations. Any help out there?

 On 08/23/2011 02:09 PM, Alexandros Karypidis wrote:

 Hello,

 I have written a locale selector by extending DropDownChoice (you can see
 the essential stuff of the implementation below). The problem is that when
 the user changes the locale, the page needs to be re-rendered using the
 newly selected locale. This does NOT happen. Instead, only the select
 input box seems to be refreshed to use the new locale, whereas the rest of
 the page content is still rendered using the previously selected locale.
 However, the locale has been changed in the Session which can be seen when
 the user navigates to another page (e.g. by clicking on a link), as the new
 page is rendered using the newly-selected locale.

 So, how can I force the current page to be re-rendered?

 Implementation of my locale selector is as follows:

 Markup: select wicket:id=localeSelection/select
 Component code:
 public class LocaleDropDown extends DropDownChoiceLocale {
 //...
    public LocaleDropDown(final String id, final ListLocale choices) {
    // ...
        setModel(new IModelLocale() {
            public Locale getObject() {
                return getSession().getLocale();
            }
            @Override
            public void setObject(Locale locale) {
                getSession().setLocale(locale);
                // need something here to tell wicket to refresh the entire
 page?
            }
        });
    // ...
    }

    @Override
    protected boolean wantOnSelectionChangedNotifications() {
        // post an event when user changes the selected value in the
 drop-down box
        return true;
    }
 }

 -- Kind regards, Alex

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



 --
 How to find files on the Internet? FindFiles.net http://findfiles.net!


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