[loc-en-dev] getLocaleKeywordKeys/getLocaleKeywordValue

Doug Felt dougfelt at google.com
Thu Mar 12 10:02:13 PDT 2009


My preference is for

Locale.getLDMLExtensionKeys
Locale.getLDMLExtensionValue
Builder.setLDMLExtensionValue(char key, String value);

To my mind, this better communicates that
- this is a key/value map
- it's subordinate to an extension
- it's represented as an LDML extension in the language tag

I find the term 'type' unfortunate and misleading, and I don't see a
pressing need to push this LDML terminology into the Java arena.  I'd rather
reuse common terminology that reflects the semantics of the operation.

Doug

On Thu, Mar 12, 2009 at 9:04 AM, Yoshito Umaoka <y.umaoka at gmail.com> wrote:

> In the API review conference call on Tuesday, we agreed that the term
> "LocaleKeywordXXX" and "Unicode Locale Identifier" might not be appropriate.
>  I'm going to update the name of these APIs:
>
> Locale#getLocaleKeywordValue -> getLDMLType
> Locale#getLocaleKeywordKeys -> getLDMLKeys
> Builder#setLocaleKeyword -> setLDMLKeyword
>
> I'll also add a static definition for LDML extension letter as
> LDML_EXTENSION_KEY ('u')
>
> I attached the new  JavaDoc comments and API signature at the end of this
> message.  If you have any problems with the new names, please respond to the
> ML.
>
> -Yoshito
>
>   /**
>    * <span style="background-color: #00ccff; font-weight: bold">New
>    * API</span> Returns the LDML keyword type value associated with
>    * the specified LDML key for this locale.  LDML keywords are specified
>    * by the 'u' extension and consist of key/type pairs.  The key must be
>    * two alphanumeric characters in length, or an IllegalArgumentException
>    * is thrown.
>    * @param key the LDML key
>    * @return the value ('type') associated with the key, or null if the
>    * locale does not define a value for the key.
>    * @throws IllegalArgumentException if the key is not valid.
>    * @since 1.7
>    */
>   public String getLDMLType(String key)
>
>   /**
>    * <span style="background-color: #00ccff; font-weight: bold">New
> API</span>
>    * Returns the set of keys for LDML keywords defined by this locale, or
>    * null if this locale has no locale extension.  The returned set is
>    * immutable.
>    * @return The set of the LDML keys, or null
>    * @since 1.7
>    */
>   public Set<String> getLDMLKeys()
>       /**
>        * <span style="background-color: #00ccff; font-weight: bold">New
> API</span>
>        * Sets the Unicode locale type for the given key.  If the
>        * type is the empty string, the locale key is removed.
>        * Well-formed keys are strings of two alphanumeric characters.
> Well-formed
>        * types are strings of three to eight alphanumeric characters.
>        * <p>
>        * <b>Note</b>:Setting the 'u' extension replaces all LDML
>        * keywords with those defined in the extension.
>        * @param key the key
>        * @param type the Unicode locale type
>        * @return this builder
>        * @throws IllegalArgumentException if <code>key</code> or
> <code>type</code>
>        * is ill-formed
>        * @see #setExtension(char, String)
>        * @since 1.7
>        */
>       public Builder setLDMLKeyword(String key, String type)
>
>   /**
>    * <span style="background-color: #00ccff; font-weight: bold">New
> API</span>
>    * The key for LDML extension.
>    * @see #getExtension(char)
>    * @see Builder#setExtension(char, String)
>    * @since 1.7
>    */
>   static public final char LDML_EXTENSION_KEY = 'u';
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.openjdk.java.net/pipermail/locale-enhancement-dev/attachments/20090312/c7c7ea06/attachment.html 


More information about the locale-enhancement-dev mailing list