Skip to content

ICU-21165 Produce units.txt resource file (with data from CLDR's units.xml) - #1173

Merged
hugovdm merged 1 commit into
unicode-org:masterfrom
hugovdm:import_cldr_units
Jun 18, 2020
Merged

hugovdm merged 1 commit into
unicode-org:masterfrom
hugovdm:import_cldr_units

Conversation

@hugovdm

@hugovdm hugovdm commented Jun 15, 2020 •

Copy link
Copy Markdown
Contributor

Data files produced with:

ant -f build-icu-data.xml -DoutDir=/tmp/new_dir -DcldrVersion=37 \
-DoutputTypes=UNITS,SUPPLEMENTAL_DATA

Once good, commits will be squashed and approval (re-)requested for submission. Before that, only new commits added to aid code review. That's probably best-practice under just about all circumstances, right?

Checklist

@hugovdm hugovdm changed the title WIP(CLDR{38}) - produce units.txt resource file. ICU-21165 Produce units.txt resource file (with data from CLDR's units.xml) Jun 15, 2020
//supplementalData/unitConstants/unitConstant[@constant="(%W)"][@value="(%A)"]
; /unitConstants/$1 ; values="$2"

//supplementalData/unitConstants/unitConstant[@constant="(%W)"][@value="(%A)"][@status="(%W)"]

@hagbard hagbard Jun 16, 2020 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

use (?:...)? for optional attributes you just ignore.
I.e. you can roll up this rule into the parent one.

Same for other rules further down.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done, PTAL?

}
}
cldrVersion{"37"}
cldrVersion{"38"}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I don't know if this is wanted. You should be able to force the cldr version from the Ant build file.
There are lots of options there you might want to read up on.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

-DcldrVersion=37 cleaned this up, thanks!

preferred{"H"}
}
}
unitPreferenceData{

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I can't really review the generated data, but the rest looks good (barring the small regex change).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Generated data: tests pass, so I'm not too worried about (re)moving of data, and the new data produced is already working well for us (dev branch).


# units.xml

//supplementalData/unitConstants/unitConstant[@constant="(%W)"][@value="(%A)"](?:[@status="(?:%W)"])?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

You don't need the inner "(?:%W)", just "%W" will do (here and below).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done. Thanks!

//supplementalData/unitConstants/unitConstant[@constant="(%W)"][@value="(%A)"](?:[@status="(?:%W)"])?
; /unitConstants/$1 ; values="$2"

//supplementalData/unitQuantities/unitQuantity[@baseUnit="(%W)"][@quantity="(%W)"](?:[@status="(?:%W)"])?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Sorry this is such a repetitive slog :(

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

No worries, doesn't bother me: I feel a (readable) little bit of repetition is way better than over-complication due to excessive application of "DRY" principles. ;-)

hugovdm added a commit to sffc/icu that referenced this pull request Jun 17, 2020
Update supplementalData.txt and units.txt from upstream PR unicode-org#1173
@hagbard
hagbard self-requested a review June 17, 2020 23:34
hagbard
hagbard previously approved these changes Jun 17, 2020
@hugovdm

hugovdm commented Jun 18, 2020

Copy link
Copy Markdown
Contributor Author

Thanks, squashing!

@jira-pull-request-webhook

Copy link
Copy Markdown

Hooray! The files in the branch are the same across the force-push. 😃

~ Your Friendly Jira-GitHub PR Checker Bot

- Produce new supplementalData.txt and units.txt with:

      ant -f build-icu-data.xml -DoutDir=/tmp/new_dir \
          -DcldrVersion=37 -DoutputTypes=UNITS,SUPPLEMENTAL_DATA
@hugovdm
hugovdm force-pushed the import_cldr_units branch from 51b2711 to 015d24f Compare June 18, 2020 00:55
@jira-pull-request-webhook

Copy link
Copy Markdown

Hooray! The files in the branch are the same across the force-push. 😃

~ Your Friendly Jira-GitHub PR Checker Bot

@hugovdm
hugovdm requested a review from hagbard June 18, 2020 00:56
@hugovdm
hugovdm merged commit 55127d6 into unicode-org:master Jun 18, 2020
@hugovdm
hugovdm deleted the import_cldr_units branch June 18, 2020 07:59
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