Hi,
I also found out that can also use <input type="button" class="button"
wicket:message="value=button.label" /> with WicketMessageTagHandler.enable =
true in the application init method.
Thanks
Thomas Gier-2 wrote:
>
> tbt wrote:
>> Hi
>>
>> I tried to add a attribute to a html tag using the wicket:message tag.
>> The
>> code is as follows
>>
>> HomePage.html
>>
>> <input type="button" class="button" wicket:message="value:button.label"
>> />
>>
>> HomePage.properties
>>
>> button.label=save
>>
>> This method didnt display the label in the html page. Then in the
>> applications init() method I added
>> WicketMessageTagHandler.enable = true; and modified the tag as
>> <input type="button" class="button" wicket:message
>> key="value:button.label"
>> />
>>
>> but still it is not working. Can someone tell me how to add an attribute
>> to
>> a tag using wicket:message
>>
>> Thanks
>> Nadeeshan
>>
>>
>> Erik van Oosten-3 wrote:
>>
>>> Yes, this is possible.
>>>
>>> But actually the previous solution is usally sufficient. You can easily
>>> define a page that is extended by all other pages. In the base page you
>>> can include the stylesheet as before and all other pages will get it
>>> too. (See the wiki for component inheritance.)
>>>
>>> But anyway, here is a non tested approach:
>>> - move the style.css (and variations) somewhere on your classpath. For
>>> example in the package that contains the java file JustSomeClass.java.
>>> - remove the <wicket:link> from the markup file
>>> - give the stylesheet link a wicket:id, eg.:
>>> <link rel="stylesheet" type="text/css" href="style.css"
>>> wicket:id="abc"></link>
>>> - in the code do something like:
>>> add(new StyleSheetReference("abc", JustSomeClass.class, "style.css"))
>>>
>>> Regards,
>>> Erik.
>>>
>>> tbt wrote:
>>>
>>>> Hi,
>>>>
>>>> I like to have my css file('style.css') in a seperate folder instead of
>>>> having it in the same folder as HomePage.java because multiple web
>>>> pages
>>>> are
>>>> using the same classes in the css file. Is it possible to have both css
>>>> files(style.css and style_tw.css) in a seperate folder. This applies
>>>> for
>>>> only css files and not property files which I would be happy to keep in
>>>> the
>>>> same folder as the html and java files.
>>>>
>>>> Thanks
>>>>
>>>>
>>>> Erik van Oosten-3 wrote:
>>>>
>>>>
>>>>> You can call:
>>>>> getSession().setLocale(new Locale("en", "US"))
>>>>>
>>>>> In the Java javadocs
>>>>> (http://java.sun.com/j2se/1.4.2/docs/api/java/util/Locale.html) you
>>>>> find
>>>>> references to language and country codes. Language code "ta" means
>>>>> Tamil
>>>>> so that is probably not what you want. Country Taiwan is represented
>>>>> by
>>>>> county code "TW".
>>>>>
>>>>> Switching css is fairly easy. Put this in the header:
>>>>> <wicket:link><link rel="stylesheet" type="text/css"
>>>>> href="style.css"></link></wicket:link>
>>>>> and move style.css to the same folder as HomePage.html.
>>>>>
>>>>> Now if you want to add another locale for the stylesheet, you just add
>>>>> a
>>>>> file called style_[language code].css. No other changes needed.
>>>>>
>>>>> Regards,
>>>>> Erik.
>>>>>
>>>>>
>>>>> tbt wrote:
>>>>>
>>>>>
>>>>>> Hi
>>>>>>
>>>>>> I have a html page called HomePage.html
>>>>>>
>>>>>> <html>
>>>>>> <head>
>>>>>> <link href="Resources/css/style.css" rel="stylesheet" type="text/css"
>>>>>> />
>>>>>> </head>
>>>>>> <body>
>>>>>> English
>>>>>> Taiwanese
>>>>>>
>>>>>> <wicket:message key="option_id" />
>>>>>>
>>>>>>
>>>>>> </body>
>>>>>> </html>
>>>>>>
>>>>>> and two property files called HomePage.properties and
>>>>>> HomePage_ta.properties.
>>>>>>
>>>>>> These files hold the values which should be replaced inside the
>>>>>> <wicket:message> tag.
>>>>>> How can I switch between these property files once the user selects a
>>>>>> particular language inside my HomePage .java class. I also need to
>>>>>> change
>>>>>> the css file according to each language.
>>>>>>
>>>>>> eg:- If Taiwanese is selected it should look like <link
>>>>>> href="Resources/css/style_ta.css" rel="stylesheet" type="text/css" />
>>>>>>
>>>>>> Thanks
>>>>>>
>>>>>>
>>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>>>>> For additional commands, e-mail: [EMAIL PROTECTED]
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>>> For additional commands, e-mail: [EMAIL PROTECTED]
>>>
>>>
> Hi,
>
> I use AttributeModifier / AttributeAppender to add attributes to HTML
> elements. Something like
>
> yourComponent.add(new AttributeModifier("value", true, new
> ResourceModel("button.label")));
>
> should do the trick. The boolean value makes sure that the attribute is
> added even if it is not present in the HTML.
>
> HTH
> Tom
>
> P.S this is my first post to the list so "hello" to everybody :) ...
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>
--
View this message in context:
http://www.nabble.com/Localization-tp15036142p15084381.html
Sent from the Wicket - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]