icu4x 0.9.0-x86_64-linux → 0.10.0-x86_64-linux

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7fdb262599a79ef5a36f4563ca9836aafec4054c56010f240c31f534e1b42850
4
- data.tar.gz: 35341839853ead6aaa7eda5381680a89adaf3fbc5469a22c4700806ef240482a
3
+ metadata.gz: 2236ee432a052aa836c1f8c3649fbe4d38ecbc05ceb457354390e506906529f2
4
+ data.tar.gz: 754b04c38f827dfdc7e0e4c3aae91169269f16c69ba27de63949128956501fff
5
5
  SHA512:
6
- metadata.gz: a6772e9514d8f62d2fc76f568f2f2a57c090f0a5bc006644a84fab6c8c6c8fd0b293301873052490280ee25fe75f8120939b07b037d4e9c921536f11e843d151
7
- data.tar.gz: acd2a7140a9ff77ca8a00a32e4628f121b9cbaad6cae10acc2dee112fbf95cc1b92d527fbfaf6da91135fe1f05679412f1e06682fcffe935b851d253e0fd956a
6
+ metadata.gz: a32818b0588eab4d02eaab7243cda39f89573c8e79bfded162585513f0dd598f11b8252e7bff9a368ddb86e990e5f0d3998ed45273470dfca7ac3eee5cbb4c11
7
+ data.tar.gz: 68f19e55601bd47cceed4f3227ac0f4ff0dd708bd3d531d07c4c57bc1e62113be3ad72a6d3e1ebbe9515a1f9887fd4fadebf053f35078b249ba87308ce59fbc3
data/CHANGELOG.md CHANGED
@@ -1,5 +1,22 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.10.0] - 2026-05-08
4
+
5
+ ### Added
6
+
7
+ - `era:` option for `ICU4X::DateTimeFormat` to control era display (`:auto`, `:full`, `:with_era`, `:never`) (#144)
8
+ - Locale variant APIs: `ICU4X::Locale#variants`, `#add_variant!`, `#add_variant`, `#remove_variant!`, `#remove_variant` (#143)
9
+
10
+ ### Fixed
11
+
12
+ - `hour12: true/false` now maps to `Clock12`/`Clock24` for locale-aware hour cycle preference, not fixed `H12`/`H23` (#145)
13
+ - Declare `bigdecimal` as an explicit runtime dependency (#149)
14
+ - Remove deprecated `AnyCalendarKind::JapaneseExtended` (#141)
15
+
16
+ ### Changed
17
+
18
+ - Update ICU4X crates from 2.1 to 2.2 (CLDR 48.2, TZDB 2026a) (#138)
19
+
3
20
  ## [0.9.0] - 2026-02-01
4
21
 
5
22
  ### Added
data/README.md CHANGED
@@ -114,7 +114,7 @@ lf.format(%w[Apple Banana Cherry])
114
114
  # Relative time formatting
115
115
  rtf = ICU4X::RelativeTimeFormat.new(locale, provider:)
116
116
  rtf.format(-3, :day)
117
- # => "3日前"
117
+ # => "3 日前"
118
118
 
119
119
  # Display names
120
120
  dn = ICU4X::DisplayNames.new(locale, provider:, type: :language)
Binary file
Binary file
Binary file
data/lib/icu4x/version.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ICU4X
4
- VERSION = "0.9.0"
4
+ VERSION = "0.10.0"
5
5
  public_constant :VERSION
6
6
  end
data/lib/icu4x.rb CHANGED
@@ -1,5 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "bigdecimal"
3
4
  require "dry-configurable"
4
5
  require "pathname"
5
6
 
@@ -52,15 +53,9 @@ module ICU4X
52
53
 
53
54
  # Error raised when data generation fails
54
55
  class DataGeneratorError < Error; end
55
- end
56
56
 
57
- # Define FormattedPart data class for format_to_parts methods
58
- module ICU4X
59
57
  FormattedPart = Data.define(:type, :value)
60
- end
61
58
 
62
- # Enhance the FormattedPart data class
63
- module ICU4X
64
59
  # Represents a part of a formatted string.
65
60
  #
66
61
  # Used by format_to_parts methods in DateTimeFormat, NumberFormat,
@@ -74,18 +69,10 @@ module ICU4X
74
69
  # @return [String] Human-readable representation
75
70
  def inspect = "#<ICU4X::FormattedPart type=#{type.inspect} value=#{value.inspect}>"
76
71
  end
77
- end
78
72
 
79
- # Define Segment data class for Segmenter
80
- module ICU4X
81
73
  class Segmenter
82
74
  Segment = Data.define(:segment, :index, :word_like)
83
- end
84
- end
85
75
 
86
- # Enhance the Segment data class
87
- module ICU4X
88
- class Segmenter
89
76
  # Represents a segment of text.
90
77
  #
91
78
  # @!attribute [r] segment
@@ -100,12 +87,36 @@ module ICU4X
100
87
  private :word_like
101
88
  end
102
89
  end
103
- end
104
90
 
105
- # Enhance the native Locale class
106
- module ICU4X
107
91
  # Represents a BCP 47 locale identifier.
108
92
  class Locale
93
+ POSIX_CATEGORIES = %i[collate ctype messages monetary numeric time].freeze
94
+ private_constant :POSIX_CATEGORIES
95
+
96
+ # Creates a Locale from environment variables.
97
+ #
98
+ # Checks LC_ALL, LC_{category}, and LANG in order,
99
+ # parsing each as a POSIX locale. Falls back to "C" if none are valid.
100
+ #
101
+ # @param category [Symbol] POSIX locale category (default: :messages)
102
+ # @return [Locale]
103
+ # @raise [ArgumentError] if category is not a valid POSIX category
104
+ def self.from_env(category: :messages)
105
+ unless POSIX_CATEGORIES.include?(category)
106
+ raise ArgumentError, "unknown locale category: #{category.inspect}"
107
+ end
108
+
109
+ env_name = "LC_#{category.to_s.upcase}"
110
+ [ENV["LC_ALL"], ENV[env_name], ENV["LANG"]].each do |value|
111
+ next if value.nil? || value.empty?
112
+
113
+ return parse_posix(value)
114
+ rescue LocaleError
115
+ next
116
+ end
117
+ parse_posix("C")
118
+ end
119
+
109
120
  # @return [String] Human-readable representation
110
121
  def inspect = "#<ICU4X::Locale:#{self}>"
111
122
 
data/sig/icu4x.rbs CHANGED
@@ -35,7 +35,10 @@ module ICU4X
35
35
  def self.available_markers: () -> Array[String]
36
36
  end
37
37
 
38
+ type locale_category = :collate | :ctype | :messages | :monetary | :numeric | :time
39
+
38
40
  class Locale
41
+ def self.from_env: (?category: locale_category) -> Locale
39
42
  def self.parse_bcp47: (String locale_str) -> Locale
40
43
  alias self.parse self.parse_bcp47
41
44
  def self.parse_posix: (String posix_str) -> Locale
metadata CHANGED
@@ -1,15 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: icu4x
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.0
4
+ version: 0.10.0
5
5
  platform: x86_64-linux
6
6
  authors:
7
7
  - OZAWA Sakuro
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-02-01 00:00:00.000000000 Z
11
+ date: 2026-05-08 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bigdecimal
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '4.0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '4.0'
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: dry-configurable
15
29
  requirement: !ruby/object:Gem::Requirement
@@ -38,7 +52,6 @@ files:
38
52
  - LICENSE.txt
39
53
  - README.md
40
54
  - lib/icu4x.rb
41
- - lib/icu4x/3.2/icu4x.so
42
55
  - lib/icu4x/3.3/icu4x.so
43
56
  - lib/icu4x/3.4/icu4x.so
44
57
  - lib/icu4x/4.0/icu4x.so
@@ -63,7 +76,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
63
76
  requirements:
64
77
  - - ">="
65
78
  - !ruby/object:Gem::Version
66
- version: '3.2'
79
+ version: '3.3'
67
80
  - - "<"
68
81
  - !ruby/object:Gem::Version
69
82
  version: 4.1.dev
Binary file