Skip to content

Conversation

@btangmu
Copy link
Member

@btangmu btangmu commented Dec 6, 2024

-Switch almost all calls to use integer instead of string

-TODO comments for 3 exceptions where getting integer is challenging

-Fix off-by-one bug in CLDRFile.typeNameToCode

-New unit test for CLDRFile.typeNameToCode

-Move some calls to nameGetter() out of loops, re-use

CLDR-15830

  • This PR completes the ticket.

ALLOW_MANY_COMMITS=true

-Switch almost all calls to use integer instead of string

-TODO comments for 3 exceptions where getting integer is challenging

-Fix off-by-one bug in CLDRFile.typeNameToCode

-New unit test for CLDRFile.typeNameToCode

-Move some calls to nameGetter() out of loops, re-use
type = "territory";
}
for (int i = 0; i < LIMIT_TYPES; ++i) {
for (int i = 0; i <= LIMIT_TYPES; ++i) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bug fix, off-by-one, SUBDIVISION_NAME == LIMIT_TYPES == 15

@btangmu
Copy link
Member Author

btangmu commented Dec 6, 2024

Still to do:

  1. Fix the 3 new TODO items to use getNameFromTypenumCode instead of getNameFromTypestrCode, then remove getNameFromTypestrCode
  2. Change int to Enum for LANGUAGE_NAME, etc.
  3. Possibly move that Enum and related code from CLDRFile to NameGetter
  4. Rename some methods like getNameFromBCP47 to reflect the possibility that the identifiers in question may be "extensions" of BCP47, not strictly BCP47; this question needs clarification
  5. Further refactor NameGetter to avoid methods with too many parameters, consider Builder pattern as Steven suggested, see https://www.baeldung.com/java-fluent-interface-vs-builder-pattern
  6. Steven suggested possibly following naming conventions of ICU4J https://unicode-org.github.io/icu-docs/apidoc/released/icu4j/com/ibm/icu/text/LocaleDisplayNames.html
  7. Avoid boolean params as in getNameFromBCP47Bool(localeOrTZID, false), use enums instead
  8. Per the ticket description, go beyond refactoring -- implement better tracking (“where found”) so that GlossonymConstructor.valueIsBogus isn't over-relied on to recognize inheritence of codes, etc., from code-fallback, etc.

@btangmu btangmu marked this pull request as ready for review December 6, 2024 20:39
Copy link
Member

@srl295 srl295 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice use of enums

@btangmu btangmu merged commit 9263526 into unicode-org:main Dec 13, 2024
10 checks passed
@btangmu btangmu deleted the t15830_b branch December 13, 2024 23:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants