<i18n dev> RFR: 8289227: Support for BCP 47 Extension T - Transformed Content [v2]

Naoto Sato naoto at openjdk.org
Tue Jul 26 17:27:07 UTC 2022


On Tue, 26 Jul 2022 01:07:29 GMT, Joe Wang <joehw at openjdk.org> wrote:

>> Naoto Sato has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Removed unnecessary `contains()` check
>
> src/java.base/share/classes/java/util/Locale.java line 236:
> 
>> 234:  * particular Unicode locale attributes or key/type pairs.
>> 235:  *
>> 236:  * <h2><a id="t_extension">Transformed Content extension</a></h2>
> 
> Both the full name "Transformed Content extension" and the abbreviated forms "T Extension" are used in this document. I see Unicode and the RFC referred to it as "T Extension", " 't' Extension", and "Extension T". If we describe the extension as "T Extension", maybe we can make it clear in the title, e.g.:
>      Transformed Content (T) Extension
>      
> could thus in the doc thereafter use "T Extension". The existing methods look like used full extension name, but for T Extension, the short form, e.g. getTExtensionFields also matches its javadoc ("Returns the map of fields in the T extension"). Your call.

Thanks for the suggestion, Joe. I made changes to the `Locale` class documentation, mainly to spell out `transformed content`, instead of using `T`. I believe that would be more descriptive. Since the RFC title uses `T`, I added it in the section title.

> src/java.base/share/classes/java/util/Locale.java line 265:
> 
>> 263:  * field separator (one alpha + one digit), followed by one or more subtags of the length 3 to 8,
>> 264:  * each delimited by a hyphen.
>> 265:  * <p>The transformed content information {@code source} language tag and {@code fields} are returned
> 
> "transformed content information" seems not needed as "The {@code source} language tag and {@code fields}" are known from the previous paragraph.

Modified to make it more sense.

> src/java.base/share/classes/sun/util/locale/TransformedContentExtension.java line 40:
> 
>> 38: public final class TransformedContentExtension extends Extension {
>> 39: 
>> 40:     public static final char SINGLETON = 't';
> 
> "singleton" as in "The singleton identifier" in the doc, seems to mean the key consists of a single character. But it can be confused with the Singleton pattern. T_EXTENSION_KEY (as methods such as isTransformedContentxxx expect a key) or Locale.TRANSFORMED_CONTENT_EXTENSION might be better.

This is analogous to the implementation of `UnicodeLocaleExtension`, and I believe this means the singleton as in the pattern. No need to use literal `t` everywhere.

-------------

PR: https://git.openjdk.org/jdk/pull/9620


More information about the i18n-dev mailing list