human_number 0.1.6 → 0.1.7

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: f3e4c992501e9303d1d288b507757e305bbf1cd148322bb5d23046f3ca9a5703
4
- data.tar.gz: 74b84f6b21e5e4d7b869f81f4ee41a1f090be8884c07f0d58fb113029afde5de
3
+ metadata.gz: 3bc432b4b82fa70b18804f6db6080c10cf33c95e410c7ee9bb2335c99b053f8d
4
+ data.tar.gz: e2aa145ec5319d06c8ff98748ee8a696f6a0a999a571440931fc55e34681f78d
5
5
  SHA512:
6
- metadata.gz: c8204b1d746ffda09e0973bc49d7418bbfb5a3355c791839a1afc6f22e2332de1fe9ceb44eee744f92d10d7e15f0e883d3ea8c1b1d171119c84e345160a1b14b
7
- data.tar.gz: 4cf5346df66b1dfb6143dec1c61db38532bb172bf9a56fddc0700531941de333292081c7431fe1799e900723289947ef10b35d48252657efef9ec76fba6b6419
6
+ metadata.gz: 123d58896c01e0297e7dde721df49e8036e4ced81185b508aa34750cf6b869487449b454fa9149d6816a05284f058bdf8ec6bf674ae52fbee6487ac880b8af42
7
+ data.tar.gz: e58469487228d201d424006a2d9a75aec5e8c73dedc3a7580c3e0ed716b20600d07f1055ec2993668aa38f422237b353e6f24091ba4a789c36ee4924e1546d35
@@ -40,7 +40,7 @@ module HumanNumber
40
40
  }.freeze
41
41
 
42
42
  # Keys supported for native currency formatting
43
- SUPPORTED_NATIVE_CURRENCY_KEYS = %i[unit format native_format].freeze
43
+ SUPPORTED_NATIVE_CURRENCY_KEYS = %i[unit format].freeze
44
44
 
45
45
  module_function
46
46
 
@@ -113,16 +113,17 @@ module HumanNumber
113
113
  # Return nil for unknown currencies so formatters can fall back appropriately
114
114
  return nil if native_locales_for_currency(currency_code).empty?
115
115
 
116
- # For native locales, use native currency formatting (native_unit, native_format)
117
- if SUPPORTED_NATIVE_CURRENCY_KEYS.include?(key) && native_locale?(currency_code, locale)
116
+ # For native locales and supported keys, try native formatting first
117
+ if native_locale?(currency_code, locale) && SUPPORTED_NATIVE_CURRENCY_KEYS.include?(key)
118
118
  native_key = native_currency_key(key)
119
-
120
119
  return I18n.t(native_key, locale:) if I18n.exists?(native_key, locale)
121
120
  end
122
121
 
123
- # For non-native locales or standard keys, always use the currency's native locale
124
- # This ensures we get the correct currency symbol regardless of user's locale
125
- I18n.t(currency_key(key), locale: primary_locale_for_currency(currency_code, locale))
122
+ # Fallback to standard currency formatting using currency's primary locale
123
+ currency_locale = primary_locale_for_currency(currency_code, locale)
124
+ standard_key = currency_key(key)
125
+
126
+ I18n.t(standard_key, locale: currency_locale)
126
127
  end
127
128
  end
128
129
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module HumanNumber
4
- VERSION = "0.1.6"
4
+ VERSION = "0.1.7"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: human_number
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ether Moon