I have a Wicket application which supports 10 different languages.  We need
to dynamically add the current locale tag to the <html> tag like this:

<html ... xml:lang="en-US">

Using the standard WebMarkupContainer + AttributeModifier does not work; it
seems to be very difficult to change content outside of the standard body
content.  Does anyone know how to add a dynamic attribute to the <html> tag?

    public TemplatePage() {
        WebMarkupContainer html = new WebMarkupContainer("html");
        String localeCode =
LocaleUtils.languageTagForLocale(Resources.getGlobalization().getCurrentLocale());
        html.add(new AttributeModifier("lang", true, new
Model(localeCode)));
        html.add(new AttributeModifier("xml:lang", true, new
Model(localeCode)));
        add(html);

wicket.WicketRuntimeException: Programming error: 'parent' should be a Page
or a Border implementing
 IHeaderRenderer
html.WebMarkupContainer, isVisible = true, isVersioned = true]]
        at
wicket.markup.html.internal.HtmlHeaderContainer.onComponentTagBody(HtmlHeaderContainer.ja
va:147)
        at wicket.Component.renderComponent(Component.java:1712)
        at wicket.MarkupContainer.onRender(MarkupContainer.java:932)
        at wicket.Component.render(Component.java:1526)
        at wicket.MarkupContainer.autoAdd(MarkupContainer.java:200)
        at
wicket.markup.resolver.HtmlHeaderResolver.resolve(HtmlHeaderResolver.java:82)

-- 
View this message in context: 
http://www.nabble.com/How-to-change-the-%3Chtml%3E-tag--tf4075663.html#a11583490
Sent from the Wicket - User mailing list archive at Nabble.com.


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to