Hello,
After thinking a bit I came up with a solution (which many of you might
call "dirty workaround"). But since no one else came up with a solution
I will stick to it until something better will be provided.
The solution can be found here:
http://blog.gruenewaldt.net/en/programming/java/apache-wicket-1_4-mounting-urls-for-a-multilanguage-setup-i18n-seo/
Perhaps someone might find that useful.
Bernhard
Bernhard Grünewaldt schrieb:
Hi folks,
Since my app will be english and german aswell, that is something I need
too. I tried to mount and unmount my pages
when the locale changes from german to english or vice versa.
I tried using ResourceModel Strings for the urls, but it's not working
the way I want it to be. And it would be a massive amount of code for
something that seems to be so simple.
The problem is, that I want both urls to be accessed via the url like in
the example:
http://xxx/impressum
and
http://xxx/imprint
should be accessible not depending on a specific locale setting.
(Perhaps the locale should change to english or german depending on the
url when accessed via a browser bookmark with no session)
The problem is, that you can mount a class multiple times, but for
creating the BookmarkablePageLinks the first one mounted will be used
for the link. (tested with wicket 1.4.3).
Wouldn't it be cool to have such a mechanism which uses the Locale
setting to generate links and mount pages.
For example (Just pseudo code):
.mount(
new HybridUrlCodingStrategy(
"impressum", ImprintPage.class, Locale.GERMAN)
);
.mount(
new HybridUrlCodingStrategy(
"imprint", ImprintPage.class, Locale.ENGLISH)
);
And when you then generate a url you could use:
add(new BookmarkablePageLink<Void>(
"bookmarked",
ImprintPage.class,
getSession().getLocale())
);
That way both urls would be accessible if bookmarked.
And the user gets the url generated in his locale while browsing through
the app.
Is there a cool(=easy) way to do that or will it lead to
a massive code section that mounts and unmounts pages on locale change?
Bernhard
Ilja Pavkovic schrieb:
Hi,
as we need some SEO optimization I want to provide the following
bookmarkable pages:
http://xxx/impressum
http://xxx/imprint
the native approach would be somethink like:
mountBookmarkablePage("imprint", ImprintPage.class);
mountBookmarkablePage("impressum", ImprintPage.class);
This looks ugly but works.
Now I don't know how to create a bookmarkable links having an url in
the expected language.
if( getLocale().equals(Locale.GERMAN)) {
//create http://xxx/impressum
} else {
// http://xxx/imprint
}
Obviously the following code does not help:
add(new BookmarkablePageLink("link", ImprintPage.class));
Does anyone have a good idea?
Best regards,
Ilja Pavkovic
---------------------------------------------------------------------
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