proposal: add ULocale API to set and delete keyword values

Doug Felt <[email protected]> Wed, 21 Jul 2004 15:56:05 -0700 (PDT)
Newsgroups gmane.comp.lib.icu.general
Message-ID <[email protected]>
This proposal is Java only.  Please respond by August 4.

Following the existing ULocale API, there are equivalent APIs to work on both a
ULocale object and on a locale ID string.  To change the keyword, pass the
keyword with a new value.  To delete the keyword, pass null as the new value. 
To delete all keywords, pass null as the keyword.

    /**
     * Sets the value for a keyword in this locale. If the value is null,
removes the keyword.  If the keyword is null, removes all keywords.
     * The new ULocale is returned.
     * @param keywordName name of the keyword whose value will be changed. 
Case insensitive.
     * @param keywordValue name of the value to assign to the keyword, or null
to remove the keyword
     * @return the resulting ULocale
     * @draft ICU 3.2
     * @deprecated This is a draft API and might change in a future release of
ICU.
     */
    public ULocale setKeywordValue(String keywordName, String keywordValue){
        return new ULocale(setKeywordValue(localeID, keywordName,
keywordValue), null);
    }
    
    /**
     * Set the value for a keyword in the specified locale. If the value is
null, removes the keyword.  If the keyword is null, removes all keywords.
     * The new locale ID is returned.  The locale name does not need to be
normalized.
     * @param keywordName name of the keyword whose value will be changed. 
Case insensitive.
     * @param keywordValue name of the value to assign to the keyword, or null
to remove the keyword
     * @return String the resulting locale ID
     * @draft ICU 3.0
     * @deprecated This is a draft API and might change in a future release of
ICU.
     */
    public static String setKeywordValue(String localeID, String keywordName,
String keywordValue) {
        return new IDParser(localeID).setKeywordValue(keywordName,
keywordValue).toString();
    }



		
__________________________________
Do you Yahoo!?
Yahoo! Mail is new and improved - Check it out!
http://promotions.yahoo.com/new_mail