MIDP 3 adds support for localizable attributes, that is, attributes which can have locale specific values in addition to the value specified by the attribute itself.
A locale specific value for a localizable attribute can be specified at installation time using a localized attribute, which is an attribute whose name is formed from the name of the localizable attribute with the suffix
"-"<locale>
appended, where the value of <locale> is of the form
<language> ["-" <country> ["-" <variant>]]
The value of <language> must be a lower-case ISO-639-1 two-letter language code.
The value of <country> if present must be an upper-case ISO-3166-1 two-letter country code.
For example, the existing attribute
MIDlet-Description
is now localizable. so it is now possible to define locale specific versions of the MIDlet Suite description using attributes such as
MIDlet-Description-deMIDlet-Description-de-DEMIDlet-Description-frMIDlet-Description-tr
Multiple locale specific values of a localizable attribute can be specified at installation time. For example, all the MIDlet-Description localized attributes above can appear in the JAD and/or manifest of the MIDlet Suite Jar.
At installation time the specification permits an implementation to discard all those localized attributes whose specified language is not supported by the device.
The value of a localizable attribute to be used is selected on the basis of the current locale. If there is a locale specific variant of the localizable attribute whose locale matches the current locale then the specified value is used. If there is no matching locale specific variant the value of the localizable attribute itself is used.
The algorithm used to do locale matching is similar to the one used to select locale specific resources in JSE. In pseudo-code it might be expressed as follows
current = current locale
if attribute with locale equal to current found then
return matching attribute
else
if current has variant then
current = current with variant removed
if attribute with locale equal to current found then
return matching attribute
else
current = current with country removed
if attribute with locale equal to current found then
return matching attribute
else
return no match
endif
endif
else
if current has country then
current = current with country removed
if attribute with locale equal to current found then
return matching attribute
else
return no match
endif
else
return no match
endif
Note
As has been mentioned, the specification permits an implementation to discard at installation time any localized attributes for languages not supported on the device. It is not clear whether the discarded localized attributes are subsequently accessible via the variants of the
MIDlet.getAppProperty()methods. If they are not then it would be useful if the specification made this clear. Alternatively, if they are accessible it is not clear what discard might actually mean in this context.
Copyright (c) 2009 By Simon Lewis. All Rights Reserved.
[...] MIDP3, MIDP3SpecIssues — Simon Lewis @ 12:00 pm The MIDlet-<n> attribute is now a localizable attribute. It is possible for a MIDlet to have a locale specific name and icon, and also, apparently, [...]
Pingback by What’s New In MIDP 3.0 ? Part 15: Localized MIDlet Attributes « Just An Application — June 19, 2009 @ 12:01 pm
[...] MIDlet-<n>-Scalable-Icon is a localizable attribute, so a locale specific scalable icon can be specified using [...]
Pingback by What’s New In MIDP 3.0 ? Part 16: Scalable MIDlet Icons « Just An Application — June 19, 2009 @ 5:37 pm
[...] Localizable Attributes for the semantics of localized [...]
Pingback by What’s New In MIDP 3.0 ? Part 40: MIDlet Suite Scalable Icons « Just An Application — July 24, 2009 @ 9:42 am