icu4x 0.6.0 → 0.6.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +14 -0
- data/README.md +8 -4
- data/lib/icu4x/data_gem_task.rb +5 -5
- data/lib/icu4x/rake_task.rb +2 -2
- data/lib/icu4x/version.rb +1 -1
- data/lib/icu4x/yard_docs.rb +64 -64
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a9647737d3f7715bf56e3bc7c7c06be56aff4ac715e984bd245fa1d4410d4542
|
|
4
|
+
data.tar.gz: 5841b15fb21057937fcbdf98fedb4b78ff77acbb831a265ac7929106cd7ff39f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a86b5b21224069d5309cfd87f468313cc53636c8e724fd6d22644c15a6057d109f5e447d43466cb9b2ed36d82c1fad1dc9fffaa4ae6405ff127a10ee882b4751
|
|
7
|
+
data.tar.gz: bab512907b93d835df787cf89f3b4f98d0e8e31009d4e851f202904a2f57ec13e7d6e04e24e52b8157ce3b0f2cab570a34df7b7728e5d794b7c6cd668c708c8c
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
## [Unreleased]
|
|
2
2
|
|
|
3
|
+
## [0.6.2] - 2026-01-02
|
|
4
|
+
|
|
5
|
+
### Fixed
|
|
6
|
+
|
|
7
|
+
- Fix incorrect `Segment#text` → `#segment` in README example
|
|
8
|
+
- Improve README Setup section (mention prebuilt binary gems, add Data Preparation heading)
|
|
9
|
+
- Replace YARD `+...+` syntax with markdown backticks for consistency
|
|
10
|
+
|
|
11
|
+
## [0.6.1] - 2026-01-02
|
|
12
|
+
|
|
13
|
+
### Changed
|
|
14
|
+
|
|
15
|
+
- Re-release to publish companion data gems with Trusted Publisher configuration
|
|
16
|
+
|
|
3
17
|
## [0.6.0] - 2026-01-02
|
|
4
18
|
|
|
5
19
|
### Added
|
data/README.md
CHANGED
|
@@ -25,7 +25,7 @@ No locale data is bundled with the gem. Users generate only the data they need,
|
|
|
25
25
|
## Requirements
|
|
26
26
|
|
|
27
27
|
- Ruby 3.2+
|
|
28
|
-
- Rust toolchain (
|
|
28
|
+
- Rust toolchain (only required when building from source; prebuilt binary gems are available for major platforms)
|
|
29
29
|
|
|
30
30
|
## Setup
|
|
31
31
|
|
|
@@ -35,7 +35,11 @@ Add to your Gemfile:
|
|
|
35
35
|
gem "icu4x"
|
|
36
36
|
```
|
|
37
37
|
|
|
38
|
-
|
|
38
|
+
Prebuilt binary gems are available for x86_64-linux, aarch64-linux, x86_64-darwin, arm64-darwin, and x64-mingw-ucrt. On these platforms, no Rust toolchain is required.
|
|
39
|
+
|
|
40
|
+
### Data Preparation
|
|
41
|
+
|
|
42
|
+
#### Option 1: Use Pre-built Data Gem (Quick Start)
|
|
39
43
|
|
|
40
44
|
Add a companion data gem for instant setup:
|
|
41
45
|
|
|
@@ -54,7 +58,7 @@ Available data gems:
|
|
|
54
58
|
- `icu4x-data-recommended` - Recommended locales (164)
|
|
55
59
|
- `icu4x-data-modern` - Modern coverage locales (103)
|
|
56
60
|
|
|
57
|
-
|
|
61
|
+
#### Option 2: Generate Custom Data
|
|
58
62
|
|
|
59
63
|
For fine-grained control, generate only the locales you need:
|
|
60
64
|
|
|
@@ -124,7 +128,7 @@ dn.of("en")
|
|
|
124
128
|
|
|
125
129
|
# Text segmentation
|
|
126
130
|
segmenter = ICU4X::Segmenter.new(granularity: :word, provider:)
|
|
127
|
-
segmenter.segment("Hello, world!").map(&:
|
|
131
|
+
segmenter.segment("Hello, world!").map(&:segment)
|
|
128
132
|
# => ["Hello", ",", " ", "world", "!"]
|
|
129
133
|
```
|
|
130
134
|
|
data/lib/icu4x/data_gem_task.rb
CHANGED
|
@@ -17,11 +17,11 @@ module ICU4X
|
|
|
17
17
|
# ICU4X::DataGemTask.new
|
|
18
18
|
#
|
|
19
19
|
# This creates the following tasks:
|
|
20
|
-
# -
|
|
21
|
-
# -
|
|
22
|
-
# -
|
|
23
|
-
# -
|
|
24
|
-
# -
|
|
20
|
+
# - `icu4x:data_gems:build` - Build all data gems
|
|
21
|
+
# - `icu4x:data_gems:build:full` - Build icu4x-data-full gem
|
|
22
|
+
# - `icu4x:data_gems:build:recommended` - Build icu4x-data-recommended gem
|
|
23
|
+
# - `icu4x:data_gems:build:modern` - Build icu4x-data-modern gem
|
|
24
|
+
# - `icu4x:data_gems:clean` - Clean data gem build artifacts
|
|
25
25
|
class DataGemTask < ::Rake::TaskLib
|
|
26
26
|
VARIANTS = {
|
|
27
27
|
full: {locales: :full, description: "All CLDR locales (700+)"},
|
data/lib/icu4x/rake_task.rb
CHANGED
|
@@ -24,11 +24,11 @@ module ICU4X
|
|
|
24
24
|
attr_reader :name
|
|
25
25
|
|
|
26
26
|
# @return [Symbol, Array<String>] Locale specifier or array of locale strings
|
|
27
|
-
# Defaults to
|
|
27
|
+
# Defaults to `:recommended`
|
|
28
28
|
attr_accessor :locales
|
|
29
29
|
|
|
30
30
|
# @return [Symbol, Array<String>] Data markers to include
|
|
31
|
-
# Defaults to
|
|
31
|
+
# Defaults to `:all`
|
|
32
32
|
attr_accessor :markers
|
|
33
33
|
|
|
34
34
|
# @return [Pathname, String] Output path relative to Rakefile
|
data/lib/icu4x/version.rb
CHANGED
data/lib/icu4x/yard_docs.rb
CHANGED
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
#
|
|
28
28
|
# # Returns the default data provider, lazily loaded from configuration.
|
|
29
29
|
# #
|
|
30
|
-
# # The provider is created from
|
|
30
|
+
# # The provider is created from `config.data_path` or the `ICU4X_DATA_PATH`
|
|
31
31
|
# # environment variable. Once created, the provider is cached.
|
|
32
32
|
# #
|
|
33
33
|
# # @return [DataProvider, nil] the default provider, or nil if not configured
|
|
@@ -85,7 +85,7 @@
|
|
|
85
85
|
# # Creates a DataProvider from a binary blob file.
|
|
86
86
|
# #
|
|
87
87
|
# # @param path [Pathname] path to the .postcard blob file
|
|
88
|
-
# # @param priority [Symbol] collation fallback priority, either
|
|
88
|
+
# # @param priority [Symbol] collation fallback priority, either `:language` or `:region`
|
|
89
89
|
# # @return [DataProvider] a new data provider instance
|
|
90
90
|
# # @raise [DataError] if the file cannot be read or is invalid
|
|
91
91
|
# #
|
|
@@ -112,21 +112,21 @@
|
|
|
112
112
|
# class DataGenerator
|
|
113
113
|
# # Exports locale data to a file.
|
|
114
114
|
# #
|
|
115
|
-
# # The
|
|
115
|
+
# # The `locales` parameter accepts either a Symbol for predefined locale sets
|
|
116
116
|
# # based on CLDR coverage levels, or an Array of locale identifier strings.
|
|
117
|
-
# # When using
|
|
117
|
+
# # When using `with_descendants`, ancestor locales (including `und`) are
|
|
118
118
|
# # automatically included for fallback support.
|
|
119
119
|
# #
|
|
120
120
|
# # @param locales [Symbol, Array<String>] locale specification:
|
|
121
|
-
# # -
|
|
122
|
-
# # -
|
|
123
|
-
# # -
|
|
124
|
-
# # -
|
|
125
|
-
# # -
|
|
126
|
-
# # -
|
|
121
|
+
# # - `:full` - all CLDR locales (700+)
|
|
122
|
+
# # - `:recommended` - locales with basic, moderate, or modern coverage (164)
|
|
123
|
+
# # - `:modern` - locales with modern coverage only (103)
|
|
124
|
+
# # - `:moderate` - locales with moderate coverage only
|
|
125
|
+
# # - `:basic` - locales with basic coverage only
|
|
126
|
+
# # - `Array<String>` - explicit list of locale identifiers
|
|
127
127
|
# # @param markers [Symbol, Array<String>] data markers to include;
|
|
128
|
-
# # use
|
|
129
|
-
# # @param format [Symbol] output format, currently only
|
|
128
|
+
# # use `:all` for all markers, or specify individual marker names
|
|
129
|
+
# # @param format [Symbol] output format, currently only `:blob` is supported
|
|
130
130
|
# # @param output [Pathname] path to write the output file
|
|
131
131
|
# # @return [void]
|
|
132
132
|
# # @raise [DataGeneratorError] if export fails
|
|
@@ -233,9 +233,9 @@
|
|
|
233
233
|
# # Returns the locale extensions.
|
|
234
234
|
# #
|
|
235
235
|
# # @return [Hash] a hash containing extension data with keys:
|
|
236
|
-
# # -
|
|
237
|
-
# # -
|
|
238
|
-
# # -
|
|
236
|
+
# # - `:unicode` [Hash<String, String>] Unicode extension key-value pairs
|
|
237
|
+
# # - `:transform` [String, nil] Transform extension string
|
|
238
|
+
# # - `:private` [Array<String>] Private use extensions
|
|
239
239
|
# #
|
|
240
240
|
# # @example
|
|
241
241
|
# # locale = ICU4X::Locale.parse("ja-JP-u-ca-japanese")
|
|
@@ -299,7 +299,7 @@
|
|
|
299
299
|
# #
|
|
300
300
|
# # @param locale [Locale] the locale for plural rules
|
|
301
301
|
# # @param provider [DataProvider, nil] data provider (uses default if nil)
|
|
302
|
-
# # @param type [Symbol] plural rule type, either
|
|
302
|
+
# # @param type [Symbol] plural rule type, either `:cardinal` or `:ordinal`
|
|
303
303
|
# # @return [PluralRules] a new instance
|
|
304
304
|
# # @raise [DataError] if data for the locale is unavailable
|
|
305
305
|
# #
|
|
@@ -312,7 +312,7 @@
|
|
|
312
312
|
# # Selects the plural category for a number.
|
|
313
313
|
# #
|
|
314
314
|
# # @param number [Integer, Float] the number to categorize
|
|
315
|
-
# # @return [Symbol] one of
|
|
315
|
+
# # @return [Symbol] one of `:zero`, `:one`, `:two`, `:few`, `:many`, or `:other`
|
|
316
316
|
# #
|
|
317
317
|
# # @example
|
|
318
318
|
# # rules.select(0) #=> :other (in English)
|
|
@@ -334,8 +334,8 @@
|
|
|
334
334
|
# # Returns the resolved options for this instance.
|
|
335
335
|
# #
|
|
336
336
|
# # @return [Hash] options hash with keys:
|
|
337
|
-
# # -
|
|
338
|
-
# # -
|
|
337
|
+
# # - `:locale` [String] the resolved locale identifier
|
|
338
|
+
# # - `:type` [Symbol] the plural rule type (`:cardinal` or `:ordinal`)
|
|
339
339
|
# #
|
|
340
340
|
# def resolved_options; end
|
|
341
341
|
# end
|
|
@@ -362,8 +362,8 @@
|
|
|
362
362
|
# #
|
|
363
363
|
# # @param locale [Locale] the locale for formatting
|
|
364
364
|
# # @param provider [DataProvider, nil] data provider (uses default if nil)
|
|
365
|
-
# # @param style [Symbol] format style:
|
|
366
|
-
# # @param currency [String, nil] ISO 4217 currency code (required for
|
|
365
|
+
# # @param style [Symbol] format style: `:decimal`, `:percent`, or `:currency`
|
|
366
|
+
# # @param currency [String, nil] ISO 4217 currency code (required for `:currency` style)
|
|
367
367
|
# # @param use_grouping [Boolean] whether to use grouping separators
|
|
368
368
|
# # @param minimum_integer_digits [Integer, nil] minimum number of integer digits
|
|
369
369
|
# # @param minimum_fraction_digits [Integer, nil] minimum number of fraction digits
|
|
@@ -393,14 +393,14 @@
|
|
|
393
393
|
# # Returns the resolved options for this instance.
|
|
394
394
|
# #
|
|
395
395
|
# # @return [Hash] options hash with keys:
|
|
396
|
-
# # -
|
|
397
|
-
# # -
|
|
398
|
-
# # -
|
|
399
|
-
# # -
|
|
400
|
-
# # -
|
|
401
|
-
# # -
|
|
402
|
-
# # -
|
|
403
|
-
# # -
|
|
396
|
+
# # - `:locale` [String] the resolved locale identifier
|
|
397
|
+
# # - `:style` [Symbol] the format style
|
|
398
|
+
# # - `:use_grouping` [Boolean] whether grouping is enabled
|
|
399
|
+
# # - `:currency` [String] currency code (if applicable)
|
|
400
|
+
# # - `:minimum_integer_digits` [Integer] minimum integer digits
|
|
401
|
+
# # - `:minimum_fraction_digits` [Integer] minimum fraction digits
|
|
402
|
+
# # - `:maximum_fraction_digits` [Integer] maximum fraction digits
|
|
403
|
+
# # - `:rounding_mode` [Symbol] the rounding mode
|
|
404
404
|
# #
|
|
405
405
|
# def resolved_options; end
|
|
406
406
|
# end
|
|
@@ -426,8 +426,8 @@
|
|
|
426
426
|
# #
|
|
427
427
|
# # @param locale [Locale] the locale for formatting
|
|
428
428
|
# # @param provider [DataProvider, nil] data provider (uses default if nil)
|
|
429
|
-
# # @param date_style [Symbol, nil] date format style:
|
|
430
|
-
# # @param time_style [Symbol, nil] time format style:
|
|
429
|
+
# # @param date_style [Symbol, nil] date format style: `:full`, `:long`, `:medium`, or `:short`
|
|
430
|
+
# # @param time_style [Symbol, nil] time format style: `:full`, `:long`, `:medium`, or `:short`
|
|
431
431
|
# # @param time_zone [String, nil] IANA time zone identifier (e.g., "America/New_York")
|
|
432
432
|
# # @param calendar [Symbol] calendar system to use
|
|
433
433
|
# # @return [DateTimeFormat] a new instance
|
|
@@ -449,11 +449,11 @@
|
|
|
449
449
|
# # Returns the resolved options for this instance.
|
|
450
450
|
# #
|
|
451
451
|
# # @return [Hash] options hash with keys:
|
|
452
|
-
# # -
|
|
453
|
-
# # -
|
|
454
|
-
# # -
|
|
455
|
-
# # -
|
|
456
|
-
# # -
|
|
452
|
+
# # - `:locale` [String] the resolved locale identifier
|
|
453
|
+
# # - `:calendar` [Symbol] the calendar system
|
|
454
|
+
# # - `:date_style` [Symbol] the date style (if set)
|
|
455
|
+
# # - `:time_style` [Symbol] the time style (if set)
|
|
456
|
+
# # - `:time_zone` [String] the time zone (if set)
|
|
457
457
|
# #
|
|
458
458
|
# def resolved_options; end
|
|
459
459
|
# end
|
|
@@ -475,8 +475,8 @@
|
|
|
475
475
|
# #
|
|
476
476
|
# # @param locale [Locale] the locale for formatting
|
|
477
477
|
# # @param provider [DataProvider, nil] data provider (uses default if nil)
|
|
478
|
-
# # @param style [Symbol] format style:
|
|
479
|
-
# # @param numeric [Symbol] numeric display:
|
|
478
|
+
# # @param style [Symbol] format style: `:long`, `:short`, or `:narrow`
|
|
479
|
+
# # @param numeric [Symbol] numeric display: `:always` or `:auto`
|
|
480
480
|
# # @return [RelativeTimeFormat] a new instance
|
|
481
481
|
# # @raise [DataError] if data for the locale is unavailable
|
|
482
482
|
# #
|
|
@@ -485,8 +485,8 @@
|
|
|
485
485
|
# # Formats a relative time value.
|
|
486
486
|
# #
|
|
487
487
|
# # @param value [Integer] the relative time value (negative for past, positive for future)
|
|
488
|
-
# # @param unit [Symbol] time unit:
|
|
489
|
-
# #
|
|
488
|
+
# # @param unit [Symbol] time unit: `:second`, `:minute`, `:hour`, `:day`,
|
|
489
|
+
# # `:week`, `:month`, `:quarter`, or `:year`
|
|
490
490
|
# # @return [String] the formatted relative time string
|
|
491
491
|
# #
|
|
492
492
|
# # @example
|
|
@@ -498,9 +498,9 @@
|
|
|
498
498
|
# # Returns the resolved options for this instance.
|
|
499
499
|
# #
|
|
500
500
|
# # @return [Hash] options hash with keys:
|
|
501
|
-
# # -
|
|
502
|
-
# # -
|
|
503
|
-
# # -
|
|
501
|
+
# # - `:locale` [String] the resolved locale identifier
|
|
502
|
+
# # - `:style` [Symbol] the format style
|
|
503
|
+
# # - `:numeric` [Symbol] the numeric display mode
|
|
504
504
|
# #
|
|
505
505
|
# def resolved_options; end
|
|
506
506
|
# end
|
|
@@ -524,8 +524,8 @@
|
|
|
524
524
|
# #
|
|
525
525
|
# # @param locale [Locale] the locale for formatting
|
|
526
526
|
# # @param provider [DataProvider, nil] data provider (uses default if nil)
|
|
527
|
-
# # @param type [Symbol] list type:
|
|
528
|
-
# # @param style [Symbol] format style:
|
|
527
|
+
# # @param type [Symbol] list type: `:conjunction`, `:disjunction`, or `:unit`
|
|
528
|
+
# # @param style [Symbol] format style: `:long`, `:short`, or `:narrow`
|
|
529
529
|
# # @return [ListFormat] a new instance
|
|
530
530
|
# # @raise [DataError] if data for the locale is unavailable
|
|
531
531
|
# #
|
|
@@ -541,9 +541,9 @@
|
|
|
541
541
|
# # Returns the resolved options for this instance.
|
|
542
542
|
# #
|
|
543
543
|
# # @return [Hash] options hash with keys:
|
|
544
|
-
# # -
|
|
545
|
-
# # -
|
|
546
|
-
# # -
|
|
544
|
+
# # - `:locale` [String] the resolved locale identifier
|
|
545
|
+
# # - `:type` [Symbol] the list type
|
|
546
|
+
# # - `:style` [Symbol] the format style
|
|
547
547
|
# #
|
|
548
548
|
# def resolved_options; end
|
|
549
549
|
# end
|
|
@@ -572,9 +572,9 @@
|
|
|
572
572
|
# # @param locale [Locale] the locale for collation rules
|
|
573
573
|
# # @param provider [DataProvider, nil] data provider (uses default if nil)
|
|
574
574
|
# # @param sensitivity [Symbol] comparison sensitivity:
|
|
575
|
-
# #
|
|
575
|
+
# # `:base`, `:accent`, `:case`, or `:variant`
|
|
576
576
|
# # @param numeric [Boolean] whether to compare numeric strings as numbers
|
|
577
|
-
# # @param case_first [Symbol, nil] which case to sort first:
|
|
577
|
+
# # @param case_first [Symbol, nil] which case to sort first: `:upper` or `:lower`
|
|
578
578
|
# # @return [Collator] a new instance
|
|
579
579
|
# # @raise [DataError] if data for the locale is unavailable
|
|
580
580
|
# #
|
|
@@ -592,10 +592,10 @@
|
|
|
592
592
|
# # Returns the resolved options for this instance.
|
|
593
593
|
# #
|
|
594
594
|
# # @return [Hash] options hash with keys:
|
|
595
|
-
# # -
|
|
596
|
-
# # -
|
|
597
|
-
# # -
|
|
598
|
-
# # -
|
|
595
|
+
# # - `:locale` [String] the resolved locale identifier
|
|
596
|
+
# # - `:sensitivity` [Symbol] the comparison sensitivity
|
|
597
|
+
# # - `:numeric` [Boolean] whether numeric sorting is enabled
|
|
598
|
+
# # - `:case_first` [Symbol] which case sorts first (if set)
|
|
599
599
|
# #
|
|
600
600
|
# def resolved_options; end
|
|
601
601
|
# end
|
|
@@ -617,9 +617,9 @@
|
|
|
617
617
|
# #
|
|
618
618
|
# # @param locale [Locale] the locale for display names
|
|
619
619
|
# # @param provider [DataProvider, nil] data provider (uses default if nil)
|
|
620
|
-
# # @param type [Symbol] display name type:
|
|
621
|
-
# # @param style [Symbol] display style:
|
|
622
|
-
# # @param fallback [Symbol] fallback behavior:
|
|
620
|
+
# # @param type [Symbol] display name type: `:language`, `:region`, `:script`, or `:locale`
|
|
621
|
+
# # @param style [Symbol] display style: `:long`, `:short`, or `:narrow`
|
|
622
|
+
# # @param fallback [Symbol] fallback behavior: `:code` or `:none`
|
|
623
623
|
# # @return [DisplayNames] a new instance
|
|
624
624
|
# # @raise [DataError] if data for the locale is unavailable
|
|
625
625
|
# #
|
|
@@ -629,7 +629,7 @@
|
|
|
629
629
|
# #
|
|
630
630
|
# # @param code [String] the code to look up (language, region, script, or locale)
|
|
631
631
|
# # @return [String, nil] the localized display name, or nil if not found
|
|
632
|
-
# # (when fallback is
|
|
632
|
+
# # (when fallback is `:none`)
|
|
633
633
|
# #
|
|
634
634
|
# # @example
|
|
635
635
|
# # names.of("ja") #=> "Japanese"
|
|
@@ -641,10 +641,10 @@
|
|
|
641
641
|
# # Returns the resolved options for this instance.
|
|
642
642
|
# #
|
|
643
643
|
# # @return [Hash] options hash with keys:
|
|
644
|
-
# # -
|
|
645
|
-
# # -
|
|
646
|
-
# # -
|
|
647
|
-
# # -
|
|
644
|
+
# # - `:locale` [String] the resolved locale identifier
|
|
645
|
+
# # - `:type` [Symbol] the display name type
|
|
646
|
+
# # - `:style` [Symbol] the display style
|
|
647
|
+
# # - `:fallback` [Symbol] the fallback behavior
|
|
648
648
|
# #
|
|
649
649
|
# def resolved_options; end
|
|
650
650
|
# end
|
|
@@ -687,7 +687,7 @@
|
|
|
687
687
|
# # Creates a new Segmenter instance.
|
|
688
688
|
# #
|
|
689
689
|
# # @param granularity [Symbol] segmentation granularity:
|
|
690
|
-
# #
|
|
690
|
+
# # `:grapheme`, `:word`, `:sentence`, or `:line`
|
|
691
691
|
# # @param provider [DataProvider, nil] data provider (uses default if nil)
|
|
692
692
|
# # @return [Segmenter] a new instance
|
|
693
693
|
# # @raise [DataError] if data is unavailable
|
|
@@ -714,7 +714,7 @@
|
|
|
714
714
|
# # Returns the resolved options for this instance.
|
|
715
715
|
# #
|
|
716
716
|
# # @return [Hash] options hash with keys:
|
|
717
|
-
# # -
|
|
717
|
+
# # - `:granularity` [Symbol] the segmentation granularity
|
|
718
718
|
# #
|
|
719
719
|
# def resolved_options; end
|
|
720
720
|
# end
|