I'm trying to internationalize the text in a submit button using package.properties file. The properties file works for all other fields but seems to be ignored in submit/reset buttons. I've tried a number of combinations including:
Where "widget.submit" is a key to a text value defined in my properties file. Most of these end up with the button value displaying "widgetform.submit". Am I missing an obvious combination or is this a broken feature?
The long (invalid) form for what I'd like is:
<s:submit value="<s:text name="widgetform.submit"/>"/>
If anyone has a solution using the long form that doesn't throw a compilation error due to the embedded tag, I'll take that too.
1) That would try to get a value from an action property.
2) Same, but would fall back to a JEE scoped attribute if no action property.
3) That's JSF (or unified) EL, or whatever it's called.
4) I don't think submit buttons have labels.
5) Similar to #1.
Personally I'd go the route of the other tags first and try the "key" attribute.
If that failed, I'd use OGNL's method call support:
No, they don't: "name" defines the action property used to fill an input element and the name of the element that will be submitted (and stored into the action property). It doesn't have anything to do with I18N--it's just defining the form element name and, if there's no "value" attribute, will pre-load the input element w/ the action property's value.
The "label" property is expecting a string to use as the text element's label: submit buttons, however, don't have a separate label. Labels are the things that appear next to the form fields; submit-type things are different because labeling them would be a little redundant. The string used as the label can be immediate (the default) or the result of an arbitrary method call--in the example I provided I used ActionSupport's getText() I18N support.
The "key" property is just shorthand for a set of name/value/localized label attributes; it's the only attribute that automagically does I18N.
So all the places I'm using 'name' that happens to resolve the i18n should be 'key'? I don't disagree that "key" is the way to go for submit/reset buttons, but it seems like confused redundancy that "name" does i18n throughout a dozen other tags, and not these two.