diff --git a/CHANGELOG.md b/CHANGELOG.md index 46549bb..60d8bfb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -42,6 +42,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), - `Layout` component no longer exports files unless they contain data, [#183](https://github.com/ruby-i18n/ruby-cldr/pull/183) - Sort the data at the component level, allowing components to specify their own sort orders, [#200](https://github.com/ruby-i18n/ruby-cldr/pull/200) - Export `` data, [#206](https://github.com/ruby-i18n/ruby-cldr/pull/206) +- `Numbers` component now outputs data from all number systems, [#189](https://github.com/ruby-i18n/ruby-cldr/pull/189) --- diff --git a/lib/cldr/export/data/numbers.rb b/lib/cldr/export/data/numbers.rb index ed72990..1ca2ea7 100644 --- a/lib/cldr/export/data/numbers.rb +++ b/lib/cldr/export/data/numbers.rb @@ -7,103 +7,175 @@ class Numbers < Base def initialize(locale) super update( - numbers: { - formats: { - currency: { - number_system: number_system("currency"), - patterns: format("currency"), - unit: unit, - }, - decimal: { - number_system: number_system("decimal"), - patterns: format("decimal"), - }, - percent: { - number_system: number_system("percent"), - patterns: format("percent"), - }, - scientific: { - number_system: number_system("scientific"), - patterns: format("scientific"), - }, - }, - symbols: symbols, - }, + numbers: number_systems, ) deep_sort! end private - def symbols - select("numbers/symbols[@numberSystem=\"latn\"]/*").each_with_object({}) do |node, result| + FORMAT_TYPES = ["currency", "decimal", "percent", "scientific"].freeze + + def number_systems + number_systems = select("/descendant::*[attribute::numberSystem]").map { |node| node["numberSystem"] }.uniq.map(&:to_sym) + number_systems.to_h do |number_system| + children = { + formats: FORMAT_TYPES.to_h do |type| + results = { patterns: format(number_system, type) } + results.merge!({ unit: unit(number_system) }) if type == "currency" + [type.to_sym, results] + end, + symbols: symbols(number_system), + } + [number_system, children] + end + end + + def symbols(number_system) + number_system_node = select_single("numbers/symbols[@numberSystem=\"#{number_system}\"]") + + aliased = select_single(number_system_node, "alias") + if aliased + return xpath_to_symbols_alias(aliased["path"]) + end + + select("numbers/symbols[@numberSystem=\"#{number_system}\"]/*").each_with_object({}) do |node, result| result[name(node).to_sym] = node.content end end - def format(type) - result = select("numbers/#{type}Formats/#{type}FormatLength").each_with_object({}) do |format_length_node, format_result| - format_nodes = select(format_length_node, "#{type}Format") + def format(number_system, type) + number_system_node = select_single("numbers/#{type}Formats[@numberSystem=\"#{number_system}\"]") + return {} unless number_system_node - format_key = format_length_node.attribute("type") - format_key = format_key ? format_key.value.to_sym : :default + aliased = select_single(number_system_node, "alias") + if aliased + return xpath_to_format_alias(aliased["path"], type) + end - if !format_nodes.empty? - format_nodes.each do |format_node| - format_result[format_key] ||= select(format_node, "pattern").each_with_object({}) do |pattern_node, pattern_result| - pattern_key_node = pattern_node.attribute("type") + result = select("numbers/#{type}Formats[@numberSystem=\"#{number_system}\"]/#{type}FormatLength").each_with_object({}) do |format_length_node, format_result| + format_length_key = format_length_node["type"]&.to_sym || default_format_length_type - pattern_count_node = pattern_node.attribute("count") + aliased = select_single(format_length_node, "alias") + if aliased + format_result[format_length_key] = xpath_to_format_length_alias(aliased["path"], number_system, type) + next + end - pattern_key = pattern_key_node ? pattern_key_node.value.to_sym : :default + format_result[format_length_key] = if format_length_key == default_format_length_type + parse_default_format_length_node(number_system, format_length_node, type) + else + parse_format_length_node(format_length_node, type) + end + end - if pattern_count_node - pattern_count = pattern_count_node.value.to_sym + result + end - if pattern_result[pattern_key].nil? - pattern_result[pattern_key] ||= {} - elsif !pattern_result[pattern_key].is_a?(Hash) - raise "can't parse patterns with and without 'count' attribute in the same section" - end + def parse_default_format_length_node(number_system, format_length_node, type) + result = {} + select(format_length_node, "#{type}Format").each do |format_node| + format_key = format_node["type"]&.to_sym || default_format_type - pattern_result[pattern_key][pattern_count] = pattern_node.content - else - pattern_result[pattern_key] = pattern_node.content - end - end - end + if (aliased = select_single(format_node, "alias")) + result[format_key] = xpath_to_default_format_length_node_alias(aliased["path"], number_system, default_format_length_type) else - aliased = select_single(format_length_node, "alias") + pattern_node = select_single(format_node, "pattern[not(@alt)]") # https://github.com/ruby-i18n/ruby-cldr/issues/125 + next unless pattern_node - if aliased - format_result[format_key] = xpath_to_redirect(aliased.attribute("path").value) - end + result[format_key] = pattern_node.content end end - - result[:default] = result[:default][:default] if result[:default] result end - def xpath_to_redirect(xpath) - length = xpath[/(\w+)FormatLength/, 1] - type = xpath[/@type='(\w+)'/, 1] + def parse_format_length_node(format_length_node, type) + result = {} + select(format_length_node, "#{type}Format").each do |format_node| + format_key = format_node["type"]&.to_sym || default_format_type + + result[format_key] ||= select(format_node, "pattern").each_with_object({}) do |pattern_node, pattern_result| + pattern_key = pattern_node["type"]&.to_sym || default_pattern_type + pattern_count = pattern_node["count"]&.to_sym + + if pattern_count + if pattern_result[pattern_key].nil? + pattern_result[pattern_key] ||= {} + elsif !pattern_result[pattern_key].is_a?(Hash) + raise "can't parse patterns with and without 'count' attribute in the same section" + end + + pattern_result[pattern_key][pattern_count] = pattern_node.content + else + pattern_result[pattern_key] = pattern_node.content + end + end + end + result + end - :"numbers.formats.#{length}.patterns.#{type}" + def default_format_length_type + # TODO: It would be better is this were one of the valid values for the type attribute + # + # But I haven't been able to figure out what the default is. + @default_format_length_type ||= :default end - def number_system(type) - node = select("numbers/#{type}Formats").first - begin - node.attribute("numberSystem").value - rescue - "latn" + def default_format_type + @default_format_type ||= begin + # Verify that the default format type has not changed / is the same for all the types + ldml_dtd_file = File.read("vendor/cldr/common/dtd/ldml.dtd") + FORMAT_TYPES.each do |type| + next if ldml_dtd_file.include?("") + + raise "The default type for #{type}Format has changed. Some code will need to be updated." + end + :standard end end - def unit - @unit ||= select("numbers/currencyFormats/unitPattern").each_with_object({}) do |node, result| - count = node.attribute("count").value.to_sym + def default_pattern_type + @default_pattern_type ||= begin + ldml_dtd_file = File.read("vendor/cldr/common/dtd/ldml.dtd") + ldml_dtd_file.match("")[1] + end.to_sym + end + + def xpath_to_default_format_length_node_alias(xpath, number_system, format_length_key) + match = xpath.match(%r{\.\./currencyFormat\[@type='(\w+)+'\]}) + raise "Alias doesn't match expected pattern: #{xpath}" unless match + + target_type = match[1] + :"numbers.#{number_system}.formats.currency.patterns.#{format_length_key}.#{target_type}" + end + + def xpath_to_format_length_alias(xpath, number_system, type) + match = xpath.match(%r{\.\./#{type}FormatLength\[@type='(\w+)'\]}) + raise "Alias doesn't match expected pattern: #{xpath}" unless match + + length = match[1] + :"numbers.#{number_system}.formats.#{type}.patterns.#{length}" + end + + def xpath_to_symbols_alias(xpath) + match = xpath.match(%r{\.\./symbols\[@numberSystem='(\w+)'\]}) + raise "Alias doesn't match expected pattern: #{xpath}" unless match + + target_number_system = match[1] + :"numbers.#{target_number_system}.symbols" + end + + def xpath_to_format_alias(xpath, type) + match = xpath.match(%r{\.\./#{type}Formats\[@numberSystem='(\w+)'\]}) + raise "Alias doesn't match expected pattern: #{xpath}" unless match + + target_number_system = match[1] + :"numbers.#{target_number_system}.formats.#{type}" + end + + def unit(number_system) + select("numbers/currencyFormats[@numberSystem=\"#{number_system}\"]/unitPattern").each_with_object({}) do |node, result| + count = node["count"].to_sym result[count] = node.content end end diff --git a/lib/cldr/unused_alias_element_chains.txt b/lib/cldr/unused_alias_element_chains.txt index 44659e8..ed9698c 100644 --- a/lib/cldr/unused_alias_element_chains.txt +++ b/lib/cldr/unused_alias_element_chains.txt @@ -181,100 +181,8 @@ /ldml/dates/calendars/calendar[@type="roc"]/months/alias /ldml/dates/calendars/calendar[@type="roc"]/quarters/alias /ldml/dates/calendars/calendar[@type="roc"]/timeFormats/alias -/ldml/numbers/currencyFormats[@numberSystem="adlm"]/alias -/ldml/numbers/currencyFormats[@numberSystem="arab"]/currencyFormatLength/currencyFormat[@type="accounting"]/alias /ldml/numbers/currencyFormats[@numberSystem="arab"]/currencySpacing/alias -/ldml/numbers/currencyFormats[@numberSystem="arabext"]/alias -/ldml/numbers/currencyFormats[@numberSystem="bali"]/alias -/ldml/numbers/currencyFormats[@numberSystem="beng"]/alias -/ldml/numbers/currencyFormats[@numberSystem="brah"]/alias -/ldml/numbers/currencyFormats[@numberSystem="cakm"]/alias -/ldml/numbers/currencyFormats[@numberSystem="cham"]/alias -/ldml/numbers/currencyFormats[@numberSystem="deva"]/alias -/ldml/numbers/currencyFormats[@numberSystem="fullwide"]/alias -/ldml/numbers/currencyFormats[@numberSystem="gong"]/alias -/ldml/numbers/currencyFormats[@numberSystem="gonm"]/alias -/ldml/numbers/currencyFormats[@numberSystem="gujr"]/alias -/ldml/numbers/currencyFormats[@numberSystem="guru"]/alias -/ldml/numbers/currencyFormats[@numberSystem="hanidec"]/alias -/ldml/numbers/currencyFormats[@numberSystem="java"]/alias -/ldml/numbers/currencyFormats[@numberSystem="kali"]/alias -/ldml/numbers/currencyFormats[@numberSystem="khmr"]/alias -/ldml/numbers/currencyFormats[@numberSystem="knda"]/alias -/ldml/numbers/currencyFormats[@numberSystem="lana"]/alias -/ldml/numbers/currencyFormats[@numberSystem="lanatham"]/alias -/ldml/numbers/currencyFormats[@numberSystem="laoo"]/alias -/ldml/numbers/currencyFormats[@numberSystem="latn"]/currencyFormatLength/currencyFormat[@type="accounting"]/alias -/ldml/numbers/currencyFormats[@numberSystem="lepc"]/alias -/ldml/numbers/currencyFormats[@numberSystem="limb"]/alias -/ldml/numbers/currencyFormats[@numberSystem="mlym"]/alias -/ldml/numbers/currencyFormats[@numberSystem="mong"]/alias -/ldml/numbers/currencyFormats[@numberSystem="mtei"]/alias -/ldml/numbers/currencyFormats[@numberSystem="mymr"]/alias -/ldml/numbers/currencyFormats[@numberSystem="mymrshan"]/alias -/ldml/numbers/currencyFormats[@numberSystem="nkoo"]/alias -/ldml/numbers/currencyFormats[@numberSystem="olck"]/alias -/ldml/numbers/currencyFormats[@numberSystem="orya"]/alias -/ldml/numbers/currencyFormats[@numberSystem="osma"]/alias -/ldml/numbers/currencyFormats[@numberSystem="rohg"]/alias -/ldml/numbers/currencyFormats[@numberSystem="saur"]/alias -/ldml/numbers/currencyFormats[@numberSystem="shrd"]/alias -/ldml/numbers/currencyFormats[@numberSystem="sora"]/alias -/ldml/numbers/currencyFormats[@numberSystem="sund"]/alias -/ldml/numbers/currencyFormats[@numberSystem="takr"]/alias -/ldml/numbers/currencyFormats[@numberSystem="talu"]/alias -/ldml/numbers/currencyFormats[@numberSystem="tamldec"]/alias -/ldml/numbers/currencyFormats[@numberSystem="telu"]/alias -/ldml/numbers/currencyFormats[@numberSystem="thai"]/alias -/ldml/numbers/currencyFormats[@numberSystem="tibt"]/alias -/ldml/numbers/currencyFormats[@numberSystem="vaii"]/alias /ldml/numbers/currencyFormats/alias -/ldml/numbers/decimalFormats[@numberSystem="adlm"]/alias -/ldml/numbers/decimalFormats[@numberSystem="arab"]/alias -/ldml/numbers/decimalFormats[@numberSystem="arabext"]/alias -/ldml/numbers/decimalFormats[@numberSystem="bali"]/alias -/ldml/numbers/decimalFormats[@numberSystem="beng"]/alias -/ldml/numbers/decimalFormats[@numberSystem="brah"]/alias -/ldml/numbers/decimalFormats[@numberSystem="cakm"]/alias -/ldml/numbers/decimalFormats[@numberSystem="cham"]/alias -/ldml/numbers/decimalFormats[@numberSystem="deva"]/alias -/ldml/numbers/decimalFormats[@numberSystem="fullwide"]/alias -/ldml/numbers/decimalFormats[@numberSystem="gong"]/alias -/ldml/numbers/decimalFormats[@numberSystem="gonm"]/alias -/ldml/numbers/decimalFormats[@numberSystem="gujr"]/alias -/ldml/numbers/decimalFormats[@numberSystem="guru"]/alias -/ldml/numbers/decimalFormats[@numberSystem="hanidec"]/alias -/ldml/numbers/decimalFormats[@numberSystem="java"]/alias -/ldml/numbers/decimalFormats[@numberSystem="kali"]/alias -/ldml/numbers/decimalFormats[@numberSystem="khmr"]/alias -/ldml/numbers/decimalFormats[@numberSystem="knda"]/alias -/ldml/numbers/decimalFormats[@numberSystem="lana"]/alias -/ldml/numbers/decimalFormats[@numberSystem="lanatham"]/alias -/ldml/numbers/decimalFormats[@numberSystem="laoo"]/alias -/ldml/numbers/decimalFormats[@numberSystem="latn"]/decimalFormatLength[@type="long"]/alias -/ldml/numbers/decimalFormats[@numberSystem="lepc"]/alias -/ldml/numbers/decimalFormats[@numberSystem="limb"]/alias -/ldml/numbers/decimalFormats[@numberSystem="mlym"]/alias -/ldml/numbers/decimalFormats[@numberSystem="mong"]/alias -/ldml/numbers/decimalFormats[@numberSystem="mtei"]/alias -/ldml/numbers/decimalFormats[@numberSystem="mymr"]/alias -/ldml/numbers/decimalFormats[@numberSystem="mymrshan"]/alias -/ldml/numbers/decimalFormats[@numberSystem="nkoo"]/alias -/ldml/numbers/decimalFormats[@numberSystem="olck"]/alias -/ldml/numbers/decimalFormats[@numberSystem="orya"]/alias -/ldml/numbers/decimalFormats[@numberSystem="osma"]/alias -/ldml/numbers/decimalFormats[@numberSystem="rohg"]/alias -/ldml/numbers/decimalFormats[@numberSystem="saur"]/alias -/ldml/numbers/decimalFormats[@numberSystem="shrd"]/alias -/ldml/numbers/decimalFormats[@numberSystem="sora"]/alias -/ldml/numbers/decimalFormats[@numberSystem="sund"]/alias -/ldml/numbers/decimalFormats[@numberSystem="takr"]/alias -/ldml/numbers/decimalFormats[@numberSystem="talu"]/alias -/ldml/numbers/decimalFormats[@numberSystem="tamldec"]/alias -/ldml/numbers/decimalFormats[@numberSystem="telu"]/alias -/ldml/numbers/decimalFormats[@numberSystem="thai"]/alias -/ldml/numbers/decimalFormats[@numberSystem="tibt"]/alias -/ldml/numbers/decimalFormats[@numberSystem="vaii"]/alias /ldml/numbers/decimalFormats/alias /ldml/numbers/miscPatterns[@numberSystem="adlm"]/alias /ldml/numbers/miscPatterns[@numberSystem="arab"]/alias @@ -321,139 +229,6 @@ /ldml/numbers/miscPatterns[@numberSystem="thai"]/alias /ldml/numbers/miscPatterns[@numberSystem="tibt"]/alias /ldml/numbers/miscPatterns[@numberSystem="vaii"]/alias -/ldml/numbers/percentFormats[@numberSystem="adlm"]/alias -/ldml/numbers/percentFormats[@numberSystem="arabext"]/alias -/ldml/numbers/percentFormats[@numberSystem="bali"]/alias -/ldml/numbers/percentFormats[@numberSystem="beng"]/alias -/ldml/numbers/percentFormats[@numberSystem="brah"]/alias -/ldml/numbers/percentFormats[@numberSystem="cakm"]/alias -/ldml/numbers/percentFormats[@numberSystem="cham"]/alias -/ldml/numbers/percentFormats[@numberSystem="deva"]/alias -/ldml/numbers/percentFormats[@numberSystem="fullwide"]/alias -/ldml/numbers/percentFormats[@numberSystem="gong"]/alias -/ldml/numbers/percentFormats[@numberSystem="gonm"]/alias -/ldml/numbers/percentFormats[@numberSystem="gujr"]/alias -/ldml/numbers/percentFormats[@numberSystem="guru"]/alias -/ldml/numbers/percentFormats[@numberSystem="hanidec"]/alias -/ldml/numbers/percentFormats[@numberSystem="java"]/alias -/ldml/numbers/percentFormats[@numberSystem="kali"]/alias -/ldml/numbers/percentFormats[@numberSystem="khmr"]/alias -/ldml/numbers/percentFormats[@numberSystem="knda"]/alias -/ldml/numbers/percentFormats[@numberSystem="lana"]/alias -/ldml/numbers/percentFormats[@numberSystem="lanatham"]/alias -/ldml/numbers/percentFormats[@numberSystem="laoo"]/alias -/ldml/numbers/percentFormats[@numberSystem="lepc"]/alias -/ldml/numbers/percentFormats[@numberSystem="limb"]/alias -/ldml/numbers/percentFormats[@numberSystem="mlym"]/alias -/ldml/numbers/percentFormats[@numberSystem="mong"]/alias -/ldml/numbers/percentFormats[@numberSystem="mtei"]/alias -/ldml/numbers/percentFormats[@numberSystem="mymr"]/alias -/ldml/numbers/percentFormats[@numberSystem="mymrshan"]/alias -/ldml/numbers/percentFormats[@numberSystem="nkoo"]/alias -/ldml/numbers/percentFormats[@numberSystem="olck"]/alias -/ldml/numbers/percentFormats[@numberSystem="orya"]/alias -/ldml/numbers/percentFormats[@numberSystem="osma"]/alias -/ldml/numbers/percentFormats[@numberSystem="rohg"]/alias -/ldml/numbers/percentFormats[@numberSystem="saur"]/alias -/ldml/numbers/percentFormats[@numberSystem="shrd"]/alias -/ldml/numbers/percentFormats[@numberSystem="sora"]/alias -/ldml/numbers/percentFormats[@numberSystem="sund"]/alias -/ldml/numbers/percentFormats[@numberSystem="takr"]/alias -/ldml/numbers/percentFormats[@numberSystem="talu"]/alias -/ldml/numbers/percentFormats[@numberSystem="tamldec"]/alias -/ldml/numbers/percentFormats[@numberSystem="telu"]/alias -/ldml/numbers/percentFormats[@numberSystem="thai"]/alias -/ldml/numbers/percentFormats[@numberSystem="tibt"]/alias -/ldml/numbers/percentFormats[@numberSystem="vaii"]/alias /ldml/numbers/percentFormats/alias -/ldml/numbers/scientificFormats[@numberSystem="adlm"]/alias -/ldml/numbers/scientificFormats[@numberSystem="arab"]/alias -/ldml/numbers/scientificFormats[@numberSystem="arabext"]/alias -/ldml/numbers/scientificFormats[@numberSystem="bali"]/alias -/ldml/numbers/scientificFormats[@numberSystem="beng"]/alias -/ldml/numbers/scientificFormats[@numberSystem="brah"]/alias -/ldml/numbers/scientificFormats[@numberSystem="cakm"]/alias -/ldml/numbers/scientificFormats[@numberSystem="cham"]/alias -/ldml/numbers/scientificFormats[@numberSystem="deva"]/alias -/ldml/numbers/scientificFormats[@numberSystem="fullwide"]/alias -/ldml/numbers/scientificFormats[@numberSystem="gong"]/alias -/ldml/numbers/scientificFormats[@numberSystem="gonm"]/alias -/ldml/numbers/scientificFormats[@numberSystem="gujr"]/alias -/ldml/numbers/scientificFormats[@numberSystem="guru"]/alias -/ldml/numbers/scientificFormats[@numberSystem="hanidec"]/alias -/ldml/numbers/scientificFormats[@numberSystem="java"]/alias -/ldml/numbers/scientificFormats[@numberSystem="kali"]/alias -/ldml/numbers/scientificFormats[@numberSystem="khmr"]/alias -/ldml/numbers/scientificFormats[@numberSystem="knda"]/alias -/ldml/numbers/scientificFormats[@numberSystem="lana"]/alias -/ldml/numbers/scientificFormats[@numberSystem="lanatham"]/alias -/ldml/numbers/scientificFormats[@numberSystem="laoo"]/alias -/ldml/numbers/scientificFormats[@numberSystem="lepc"]/alias -/ldml/numbers/scientificFormats[@numberSystem="limb"]/alias -/ldml/numbers/scientificFormats[@numberSystem="mlym"]/alias -/ldml/numbers/scientificFormats[@numberSystem="mong"]/alias -/ldml/numbers/scientificFormats[@numberSystem="mtei"]/alias -/ldml/numbers/scientificFormats[@numberSystem="mymr"]/alias -/ldml/numbers/scientificFormats[@numberSystem="mymrshan"]/alias -/ldml/numbers/scientificFormats[@numberSystem="nkoo"]/alias -/ldml/numbers/scientificFormats[@numberSystem="olck"]/alias -/ldml/numbers/scientificFormats[@numberSystem="orya"]/alias -/ldml/numbers/scientificFormats[@numberSystem="osma"]/alias -/ldml/numbers/scientificFormats[@numberSystem="rohg"]/alias -/ldml/numbers/scientificFormats[@numberSystem="saur"]/alias -/ldml/numbers/scientificFormats[@numberSystem="shrd"]/alias -/ldml/numbers/scientificFormats[@numberSystem="sora"]/alias -/ldml/numbers/scientificFormats[@numberSystem="sund"]/alias -/ldml/numbers/scientificFormats[@numberSystem="takr"]/alias -/ldml/numbers/scientificFormats[@numberSystem="talu"]/alias -/ldml/numbers/scientificFormats[@numberSystem="tamldec"]/alias -/ldml/numbers/scientificFormats[@numberSystem="telu"]/alias -/ldml/numbers/scientificFormats[@numberSystem="thai"]/alias -/ldml/numbers/scientificFormats[@numberSystem="tibt"]/alias -/ldml/numbers/scientificFormats[@numberSystem="vaii"]/alias /ldml/numbers/scientificFormats/alias -/ldml/numbers/symbols[@numberSystem="adlm"]/alias -/ldml/numbers/symbols[@numberSystem="bali"]/alias -/ldml/numbers/symbols[@numberSystem="beng"]/alias -/ldml/numbers/symbols[@numberSystem="brah"]/alias -/ldml/numbers/symbols[@numberSystem="cakm"]/alias -/ldml/numbers/symbols[@numberSystem="cham"]/alias -/ldml/numbers/symbols[@numberSystem="deva"]/alias -/ldml/numbers/symbols[@numberSystem="fullwide"]/alias -/ldml/numbers/symbols[@numberSystem="gong"]/alias -/ldml/numbers/symbols[@numberSystem="gonm"]/alias -/ldml/numbers/symbols[@numberSystem="gujr"]/alias -/ldml/numbers/symbols[@numberSystem="guru"]/alias -/ldml/numbers/symbols[@numberSystem="hanidec"]/alias -/ldml/numbers/symbols[@numberSystem="hmnp"]/alias -/ldml/numbers/symbols[@numberSystem="java"]/alias -/ldml/numbers/symbols[@numberSystem="kali"]/alias -/ldml/numbers/symbols[@numberSystem="khmr"]/alias -/ldml/numbers/symbols[@numberSystem="knda"]/alias -/ldml/numbers/symbols[@numberSystem="lana"]/alias -/ldml/numbers/symbols[@numberSystem="lanatham"]/alias -/ldml/numbers/symbols[@numberSystem="laoo"]/alias -/ldml/numbers/symbols[@numberSystem="lepc"]/alias -/ldml/numbers/symbols[@numberSystem="limb"]/alias -/ldml/numbers/symbols[@numberSystem="mlym"]/alias -/ldml/numbers/symbols[@numberSystem="mong"]/alias -/ldml/numbers/symbols[@numberSystem="mtei"]/alias -/ldml/numbers/symbols[@numberSystem="mymr"]/alias -/ldml/numbers/symbols[@numberSystem="mymrshan"]/alias -/ldml/numbers/symbols[@numberSystem="nkoo"]/alias -/ldml/numbers/symbols[@numberSystem="olck"]/alias -/ldml/numbers/symbols[@numberSystem="orya"]/alias -/ldml/numbers/symbols[@numberSystem="osma"]/alias -/ldml/numbers/symbols[@numberSystem="rohg"]/alias -/ldml/numbers/symbols[@numberSystem="saur"]/alias -/ldml/numbers/symbols[@numberSystem="shrd"]/alias -/ldml/numbers/symbols[@numberSystem="sora"]/alias -/ldml/numbers/symbols[@numberSystem="sund"]/alias -/ldml/numbers/symbols[@numberSystem="takr"]/alias -/ldml/numbers/symbols[@numberSystem="talu"]/alias -/ldml/numbers/symbols[@numberSystem="tamldec"]/alias -/ldml/numbers/symbols[@numberSystem="telu"]/alias -/ldml/numbers/symbols[@numberSystem="thai"]/alias -/ldml/numbers/symbols[@numberSystem="tibt"]/alias -/ldml/numbers/symbols[@numberSystem="vaii"]/alias /ldml/numbers/symbols/alias diff --git a/lib/cldr/validate_upstream_assumptions.rb b/lib/cldr/validate_upstream_assumptions.rb index 89096b2..3afbe45 100644 --- a/lib/cldr/validate_upstream_assumptions.rb +++ b/lib/cldr/validate_upstream_assumptions.rb @@ -102,6 +102,231 @@ def validate_aliases_only_in_root_locale "/ldml/listPatterns/listPattern[@type=\"unit-narrow\"]/alias", "/ldml/listPatterns/listPattern[@type=\"unit-short\"]/alias", "/ldml/listPatterns/listPattern[@type=\"unit\"]/alias", + "/ldml/numbers/currencyFormats[@numberSystem=\"adlm\"]/alias", + "/ldml/numbers/currencyFormats[@numberSystem=\"arab\"]/currencyFormatLength/currencyFormat[@type=\"accounting\"]/alias", + "/ldml/numbers/currencyFormats[@numberSystem=\"arabext\"]/alias", + "/ldml/numbers/currencyFormats[@numberSystem=\"bali\"]/alias", + "/ldml/numbers/currencyFormats[@numberSystem=\"beng\"]/alias", + "/ldml/numbers/currencyFormats[@numberSystem=\"brah\"]/alias", + "/ldml/numbers/currencyFormats[@numberSystem=\"cakm\"]/alias", + "/ldml/numbers/currencyFormats[@numberSystem=\"cham\"]/alias", + "/ldml/numbers/currencyFormats[@numberSystem=\"deva\"]/alias", + "/ldml/numbers/currencyFormats[@numberSystem=\"fullwide\"]/alias", + "/ldml/numbers/currencyFormats[@numberSystem=\"gong\"]/alias", + "/ldml/numbers/currencyFormats[@numberSystem=\"gonm\"]/alias", + "/ldml/numbers/currencyFormats[@numberSystem=\"gujr\"]/alias", + "/ldml/numbers/currencyFormats[@numberSystem=\"guru\"]/alias", + "/ldml/numbers/currencyFormats[@numberSystem=\"hanidec\"]/alias", + "/ldml/numbers/currencyFormats[@numberSystem=\"java\"]/alias", + "/ldml/numbers/currencyFormats[@numberSystem=\"kali\"]/alias", + "/ldml/numbers/currencyFormats[@numberSystem=\"khmr\"]/alias", + "/ldml/numbers/currencyFormats[@numberSystem=\"knda\"]/alias", + "/ldml/numbers/currencyFormats[@numberSystem=\"lana\"]/alias", + "/ldml/numbers/currencyFormats[@numberSystem=\"lanatham\"]/alias", + "/ldml/numbers/currencyFormats[@numberSystem=\"laoo\"]/alias", + "/ldml/numbers/currencyFormats[@numberSystem=\"latn\"]/currencyFormatLength/currencyFormat[@type=\"accounting\"]/alias", + "/ldml/numbers/currencyFormats[@numberSystem=\"lepc\"]/alias", + "/ldml/numbers/currencyFormats[@numberSystem=\"limb\"]/alias", + "/ldml/numbers/currencyFormats[@numberSystem=\"mlym\"]/alias", + "/ldml/numbers/currencyFormats[@numberSystem=\"mong\"]/alias", + "/ldml/numbers/currencyFormats[@numberSystem=\"mtei\"]/alias", + "/ldml/numbers/currencyFormats[@numberSystem=\"mymr\"]/alias", + "/ldml/numbers/currencyFormats[@numberSystem=\"mymrshan\"]/alias", + "/ldml/numbers/currencyFormats[@numberSystem=\"nkoo\"]/alias", + "/ldml/numbers/currencyFormats[@numberSystem=\"olck\"]/alias", + "/ldml/numbers/currencyFormats[@numberSystem=\"orya\"]/alias", + "/ldml/numbers/currencyFormats[@numberSystem=\"osma\"]/alias", + "/ldml/numbers/currencyFormats[@numberSystem=\"rohg\"]/alias", + "/ldml/numbers/currencyFormats[@numberSystem=\"saur\"]/alias", + "/ldml/numbers/currencyFormats[@numberSystem=\"shrd\"]/alias", + "/ldml/numbers/currencyFormats[@numberSystem=\"sora\"]/alias", + "/ldml/numbers/currencyFormats[@numberSystem=\"sund\"]/alias", + "/ldml/numbers/currencyFormats[@numberSystem=\"takr\"]/alias", + "/ldml/numbers/currencyFormats[@numberSystem=\"talu\"]/alias", + "/ldml/numbers/currencyFormats[@numberSystem=\"tamldec\"]/alias", + "/ldml/numbers/currencyFormats[@numberSystem=\"telu\"]/alias", + "/ldml/numbers/currencyFormats[@numberSystem=\"thai\"]/alias", + "/ldml/numbers/currencyFormats[@numberSystem=\"tibt\"]/alias", + "/ldml/numbers/currencyFormats[@numberSystem=\"vaii\"]/alias", + "/ldml/numbers/decimalFormats[@numberSystem=\"adlm\"]/alias", + "/ldml/numbers/decimalFormats[@numberSystem=\"arab\"]/alias", + "/ldml/numbers/decimalFormats[@numberSystem=\"arabext\"]/alias", + "/ldml/numbers/decimalFormats[@numberSystem=\"bali\"]/alias", + "/ldml/numbers/decimalFormats[@numberSystem=\"beng\"]/alias", + "/ldml/numbers/decimalFormats[@numberSystem=\"brah\"]/alias", + "/ldml/numbers/decimalFormats[@numberSystem=\"cakm\"]/alias", + "/ldml/numbers/decimalFormats[@numberSystem=\"cham\"]/alias", + "/ldml/numbers/decimalFormats[@numberSystem=\"deva\"]/alias", + "/ldml/numbers/decimalFormats[@numberSystem=\"fullwide\"]/alias", + "/ldml/numbers/decimalFormats[@numberSystem=\"gong\"]/alias", + "/ldml/numbers/decimalFormats[@numberSystem=\"gonm\"]/alias", + "/ldml/numbers/decimalFormats[@numberSystem=\"gujr\"]/alias", + "/ldml/numbers/decimalFormats[@numberSystem=\"guru\"]/alias", + "/ldml/numbers/decimalFormats[@numberSystem=\"hanidec\"]/alias", + "/ldml/numbers/decimalFormats[@numberSystem=\"java\"]/alias", + "/ldml/numbers/decimalFormats[@numberSystem=\"kali\"]/alias", + "/ldml/numbers/decimalFormats[@numberSystem=\"khmr\"]/alias", + "/ldml/numbers/decimalFormats[@numberSystem=\"knda\"]/alias", + "/ldml/numbers/decimalFormats[@numberSystem=\"lana\"]/alias", + "/ldml/numbers/decimalFormats[@numberSystem=\"lanatham\"]/alias", + "/ldml/numbers/decimalFormats[@numberSystem=\"laoo\"]/alias", + "/ldml/numbers/decimalFormats[@numberSystem=\"latn\"]/decimalFormatLength[@type=\"long\"]/alias", + "/ldml/numbers/decimalFormats[@numberSystem=\"lepc\"]/alias", + "/ldml/numbers/decimalFormats[@numberSystem=\"limb\"]/alias", + "/ldml/numbers/decimalFormats[@numberSystem=\"mlym\"]/alias", + "/ldml/numbers/decimalFormats[@numberSystem=\"mong\"]/alias", + "/ldml/numbers/decimalFormats[@numberSystem=\"mtei\"]/alias", + "/ldml/numbers/decimalFormats[@numberSystem=\"mymr\"]/alias", + "/ldml/numbers/decimalFormats[@numberSystem=\"mymrshan\"]/alias", + "/ldml/numbers/decimalFormats[@numberSystem=\"nkoo\"]/alias", + "/ldml/numbers/decimalFormats[@numberSystem=\"olck\"]/alias", + "/ldml/numbers/decimalFormats[@numberSystem=\"orya\"]/alias", + "/ldml/numbers/decimalFormats[@numberSystem=\"osma\"]/alias", + "/ldml/numbers/decimalFormats[@numberSystem=\"rohg\"]/alias", + "/ldml/numbers/decimalFormats[@numberSystem=\"saur\"]/alias", + "/ldml/numbers/decimalFormats[@numberSystem=\"shrd\"]/alias", + "/ldml/numbers/decimalFormats[@numberSystem=\"sora\"]/alias", + "/ldml/numbers/decimalFormats[@numberSystem=\"sund\"]/alias", + "/ldml/numbers/decimalFormats[@numberSystem=\"takr\"]/alias", + "/ldml/numbers/decimalFormats[@numberSystem=\"talu\"]/alias", + "/ldml/numbers/decimalFormats[@numberSystem=\"tamldec\"]/alias", + "/ldml/numbers/decimalFormats[@numberSystem=\"telu\"]/alias", + "/ldml/numbers/decimalFormats[@numberSystem=\"thai\"]/alias", + "/ldml/numbers/decimalFormats[@numberSystem=\"tibt\"]/alias", + "/ldml/numbers/decimalFormats[@numberSystem=\"vaii\"]/alias", + "/ldml/numbers/percentFormats[@numberSystem=\"adlm\"]/alias", + "/ldml/numbers/percentFormats[@numberSystem=\"arabext\"]/alias", + "/ldml/numbers/percentFormats[@numberSystem=\"bali\"]/alias", + "/ldml/numbers/percentFormats[@numberSystem=\"beng\"]/alias", + "/ldml/numbers/percentFormats[@numberSystem=\"brah\"]/alias", + "/ldml/numbers/percentFormats[@numberSystem=\"cakm\"]/alias", + "/ldml/numbers/percentFormats[@numberSystem=\"cham\"]/alias", + "/ldml/numbers/percentFormats[@numberSystem=\"deva\"]/alias", + "/ldml/numbers/percentFormats[@numberSystem=\"fullwide\"]/alias", + "/ldml/numbers/percentFormats[@numberSystem=\"gong\"]/alias", + "/ldml/numbers/percentFormats[@numberSystem=\"gonm\"]/alias", + "/ldml/numbers/percentFormats[@numberSystem=\"gujr\"]/alias", + "/ldml/numbers/percentFormats[@numberSystem=\"guru\"]/alias", + "/ldml/numbers/percentFormats[@numberSystem=\"hanidec\"]/alias", + "/ldml/numbers/percentFormats[@numberSystem=\"java\"]/alias", + "/ldml/numbers/percentFormats[@numberSystem=\"kali\"]/alias", + "/ldml/numbers/percentFormats[@numberSystem=\"khmr\"]/alias", + "/ldml/numbers/percentFormats[@numberSystem=\"knda\"]/alias", + "/ldml/numbers/percentFormats[@numberSystem=\"lana\"]/alias", + "/ldml/numbers/percentFormats[@numberSystem=\"lanatham\"]/alias", + "/ldml/numbers/percentFormats[@numberSystem=\"laoo\"]/alias", + "/ldml/numbers/percentFormats[@numberSystem=\"lepc\"]/alias", + "/ldml/numbers/percentFormats[@numberSystem=\"limb\"]/alias", + "/ldml/numbers/percentFormats[@numberSystem=\"mlym\"]/alias", + "/ldml/numbers/percentFormats[@numberSystem=\"mong\"]/alias", + "/ldml/numbers/percentFormats[@numberSystem=\"mtei\"]/alias", + "/ldml/numbers/percentFormats[@numberSystem=\"mymr\"]/alias", + "/ldml/numbers/percentFormats[@numberSystem=\"mymrshan\"]/alias", + "/ldml/numbers/percentFormats[@numberSystem=\"nkoo\"]/alias", + "/ldml/numbers/percentFormats[@numberSystem=\"olck\"]/alias", + "/ldml/numbers/percentFormats[@numberSystem=\"orya\"]/alias", + "/ldml/numbers/percentFormats[@numberSystem=\"osma\"]/alias", + "/ldml/numbers/percentFormats[@numberSystem=\"rohg\"]/alias", + "/ldml/numbers/percentFormats[@numberSystem=\"saur\"]/alias", + "/ldml/numbers/percentFormats[@numberSystem=\"shrd\"]/alias", + "/ldml/numbers/percentFormats[@numberSystem=\"sora\"]/alias", + "/ldml/numbers/percentFormats[@numberSystem=\"sund\"]/alias", + "/ldml/numbers/percentFormats[@numberSystem=\"takr\"]/alias", + "/ldml/numbers/percentFormats[@numberSystem=\"talu\"]/alias", + "/ldml/numbers/percentFormats[@numberSystem=\"tamldec\"]/alias", + "/ldml/numbers/percentFormats[@numberSystem=\"telu\"]/alias", + "/ldml/numbers/percentFormats[@numberSystem=\"thai\"]/alias", + "/ldml/numbers/percentFormats[@numberSystem=\"tibt\"]/alias", + "/ldml/numbers/percentFormats[@numberSystem=\"vaii\"]/alias", + "/ldml/numbers/scientificFormats[@numberSystem=\"adlm\"]/alias", + "/ldml/numbers/scientificFormats[@numberSystem=\"arab\"]/alias", + "/ldml/numbers/scientificFormats[@numberSystem=\"arabext\"]/alias", + "/ldml/numbers/scientificFormats[@numberSystem=\"bali\"]/alias", + "/ldml/numbers/scientificFormats[@numberSystem=\"beng\"]/alias", + "/ldml/numbers/scientificFormats[@numberSystem=\"brah\"]/alias", + "/ldml/numbers/scientificFormats[@numberSystem=\"cakm\"]/alias", + "/ldml/numbers/scientificFormats[@numberSystem=\"cham\"]/alias", + "/ldml/numbers/scientificFormats[@numberSystem=\"deva\"]/alias", + "/ldml/numbers/scientificFormats[@numberSystem=\"fullwide\"]/alias", + "/ldml/numbers/scientificFormats[@numberSystem=\"gong\"]/alias", + "/ldml/numbers/scientificFormats[@numberSystem=\"gonm\"]/alias", + "/ldml/numbers/scientificFormats[@numberSystem=\"gujr\"]/alias", + "/ldml/numbers/scientificFormats[@numberSystem=\"guru\"]/alias", + "/ldml/numbers/scientificFormats[@numberSystem=\"hanidec\"]/alias", + "/ldml/numbers/scientificFormats[@numberSystem=\"java\"]/alias", + "/ldml/numbers/scientificFormats[@numberSystem=\"kali\"]/alias", + "/ldml/numbers/scientificFormats[@numberSystem=\"khmr\"]/alias", + "/ldml/numbers/scientificFormats[@numberSystem=\"knda\"]/alias", + "/ldml/numbers/scientificFormats[@numberSystem=\"lana\"]/alias", + "/ldml/numbers/scientificFormats[@numberSystem=\"lanatham\"]/alias", + "/ldml/numbers/scientificFormats[@numberSystem=\"laoo\"]/alias", + "/ldml/numbers/scientificFormats[@numberSystem=\"lepc\"]/alias", + "/ldml/numbers/scientificFormats[@numberSystem=\"limb\"]/alias", + "/ldml/numbers/scientificFormats[@numberSystem=\"mlym\"]/alias", + "/ldml/numbers/scientificFormats[@numberSystem=\"mong\"]/alias", + "/ldml/numbers/scientificFormats[@numberSystem=\"mtei\"]/alias", + "/ldml/numbers/scientificFormats[@numberSystem=\"mymr\"]/alias", + "/ldml/numbers/scientificFormats[@numberSystem=\"mymrshan\"]/alias", + "/ldml/numbers/scientificFormats[@numberSystem=\"nkoo\"]/alias", + "/ldml/numbers/scientificFormats[@numberSystem=\"olck\"]/alias", + "/ldml/numbers/scientificFormats[@numberSystem=\"orya\"]/alias", + "/ldml/numbers/scientificFormats[@numberSystem=\"osma\"]/alias", + "/ldml/numbers/scientificFormats[@numberSystem=\"rohg\"]/alias", + "/ldml/numbers/scientificFormats[@numberSystem=\"saur\"]/alias", + "/ldml/numbers/scientificFormats[@numberSystem=\"shrd\"]/alias", + "/ldml/numbers/scientificFormats[@numberSystem=\"sora\"]/alias", + "/ldml/numbers/scientificFormats[@numberSystem=\"sund\"]/alias", + "/ldml/numbers/scientificFormats[@numberSystem=\"takr\"]/alias", + "/ldml/numbers/scientificFormats[@numberSystem=\"talu\"]/alias", + "/ldml/numbers/scientificFormats[@numberSystem=\"tamldec\"]/alias", + "/ldml/numbers/scientificFormats[@numberSystem=\"telu\"]/alias", + "/ldml/numbers/scientificFormats[@numberSystem=\"thai\"]/alias", + "/ldml/numbers/scientificFormats[@numberSystem=\"tibt\"]/alias", + "/ldml/numbers/scientificFormats[@numberSystem=\"vaii\"]/alias", + "/ldml/numbers/symbols[@numberSystem=\"adlm\"]/alias", + "/ldml/numbers/symbols[@numberSystem=\"bali\"]/alias", + "/ldml/numbers/symbols[@numberSystem=\"beng\"]/alias", + "/ldml/numbers/symbols[@numberSystem=\"brah\"]/alias", + "/ldml/numbers/symbols[@numberSystem=\"cakm\"]/alias", + "/ldml/numbers/symbols[@numberSystem=\"cham\"]/alias", + "/ldml/numbers/symbols[@numberSystem=\"deva\"]/alias", + "/ldml/numbers/symbols[@numberSystem=\"fullwide\"]/alias", + "/ldml/numbers/symbols[@numberSystem=\"gong\"]/alias", + "/ldml/numbers/symbols[@numberSystem=\"gonm\"]/alias", + "/ldml/numbers/symbols[@numberSystem=\"gujr\"]/alias", + "/ldml/numbers/symbols[@numberSystem=\"guru\"]/alias", + "/ldml/numbers/symbols[@numberSystem=\"hanidec\"]/alias", + "/ldml/numbers/symbols[@numberSystem=\"hmnp\"]/alias", + "/ldml/numbers/symbols[@numberSystem=\"java\"]/alias", + "/ldml/numbers/symbols[@numberSystem=\"kali\"]/alias", + "/ldml/numbers/symbols[@numberSystem=\"khmr\"]/alias", + "/ldml/numbers/symbols[@numberSystem=\"knda\"]/alias", + "/ldml/numbers/symbols[@numberSystem=\"lana\"]/alias", + "/ldml/numbers/symbols[@numberSystem=\"lanatham\"]/alias", + "/ldml/numbers/symbols[@numberSystem=\"laoo\"]/alias", + "/ldml/numbers/symbols[@numberSystem=\"lepc\"]/alias", + "/ldml/numbers/symbols[@numberSystem=\"limb\"]/alias", + "/ldml/numbers/symbols[@numberSystem=\"mlym\"]/alias", + "/ldml/numbers/symbols[@numberSystem=\"mong\"]/alias", + "/ldml/numbers/symbols[@numberSystem=\"mtei\"]/alias", + "/ldml/numbers/symbols[@numberSystem=\"mymr\"]/alias", + "/ldml/numbers/symbols[@numberSystem=\"mymrshan\"]/alias", + "/ldml/numbers/symbols[@numberSystem=\"nkoo\"]/alias", + "/ldml/numbers/symbols[@numberSystem=\"olck\"]/alias", + "/ldml/numbers/symbols[@numberSystem=\"orya\"]/alias", + "/ldml/numbers/symbols[@numberSystem=\"osma\"]/alias", + "/ldml/numbers/symbols[@numberSystem=\"rohg\"]/alias", + "/ldml/numbers/symbols[@numberSystem=\"saur\"]/alias", + "/ldml/numbers/symbols[@numberSystem=\"shrd\"]/alias", + "/ldml/numbers/symbols[@numberSystem=\"sora\"]/alias", + "/ldml/numbers/symbols[@numberSystem=\"sund\"]/alias", + "/ldml/numbers/symbols[@numberSystem=\"takr\"]/alias", + "/ldml/numbers/symbols[@numberSystem=\"talu\"]/alias", + "/ldml/numbers/symbols[@numberSystem=\"tamldec\"]/alias", + "/ldml/numbers/symbols[@numberSystem=\"telu\"]/alias", + "/ldml/numbers/symbols[@numberSystem=\"thai\"]/alias", + "/ldml/numbers/symbols[@numberSystem=\"tibt\"]/alias", + "/ldml/numbers/symbols[@numberSystem=\"vaii\"]/alias", "/ldml/units/unitLength[@type=\"long\"]/alias", "/ldml/units/unitLength[@type=\"narrow\"]/alias", "/ldml/units/unitLength[@type=\"short\"]/unit[@type=\"duration-day-person\"]/alias", @@ -125,6 +350,9 @@ def validate_aliases_only_in_expected_paths Cldr::Export::Element.inheritance_chain(child) end.sort.uniq + found_in_both = SUPPORTED_ALIAS_ELEMENT_CHAINS & UNUSED_ALIAS_ELEMENT_CHAINS + raise "Found #{found_in_both.size} alias paths in both the supported and unused alias element chains. Example: `#{found_in_both.first}`" if found_in_both.any? + unknown_alias_paths = alias_paths - SUPPORTED_ALIAS_ELEMENT_CHAINS - UNUSED_ALIAS_ELEMENT_CHAINS unless unknown_alias_paths.empty? diff --git a/test/export/data/numbers_test.rb b/test/export/data/numbers_test.rb index 7cc800e..f068487 100644 --- a/test/export/data/numbers_test.rb +++ b/test/export/data/numbers_test.rb @@ -20,74 +20,83 @@ class TestCldrDataNumbers < Test::Unit::TestCase superscripting_exponent: "·", time_separator: ":", } - assert_equal expected, Cldr::Export::Data::Numbers.new(:de)[:numbers][:symbols] + assert_equal expected, Cldr::Export::Data::Numbers.new(:de)[:numbers][:latn][:symbols] end test "number formats :de" do expected = { currency: { - number_system: "latn", patterns: { - default: "#,##0.00 ¤", + default: { + accounting: "#,##0.00 ¤", + standard: "#,##0.00 ¤", + }, short: { - "1000": { one: "0", other: "0" }, - "10000": { one: "0", other: "0" }, - "100000": { one: "0", other: "0" }, - "1000000": { one: "0 Mio'.' ¤", other: "0 Mio'.' ¤" }, - "10000000": { one: "00 Mio'.' ¤", other: "00 Mio'.' ¤" }, - "100000000": { one: "000 Mio'.' ¤", other: "000 Mio'.' ¤" }, - "1000000000": { one: "0 Mrd'.' ¤", other: "0 Mrd'.' ¤" }, - "10000000000": { one: "00 Mrd'.' ¤", other: "00 Mrd'.' ¤" }, - "100000000000": { one: "000 Mrd'.' ¤", other: "000 Mrd'.' ¤" }, - "1000000000000": { one: "0 Bio'.' ¤", other: "0 Bio'.' ¤" }, - "10000000000000": { one: "00 Bio'.' ¤", other: "00 Bio'.' ¤" }, - "100000000000000": { one: "000 Bio'.' ¤", other: "000 Bio'.' ¤" }, + standard: { + "1000": { one: "0", other: "0" }, + "10000": { one: "0", other: "0" }, + "100000": { one: "0", other: "0" }, + "1000000": { one: "0 Mio'.' ¤", other: "0 Mio'.' ¤" }, + "10000000": { one: "00 Mio'.' ¤", other: "00 Mio'.' ¤" }, + "100000000": { one: "000 Mio'.' ¤", other: "000 Mio'.' ¤" }, + "1000000000": { one: "0 Mrd'.' ¤", other: "0 Mrd'.' ¤" }, + "10000000000": { one: "00 Mrd'.' ¤", other: "00 Mrd'.' ¤" }, + "100000000000": { one: "000 Mrd'.' ¤", other: "000 Mrd'.' ¤" }, + "1000000000000": { one: "0 Bio'.' ¤", other: "0 Bio'.' ¤" }, + "10000000000000": { one: "00 Bio'.' ¤", other: "00 Bio'.' ¤" }, + "100000000000000": { one: "000 Bio'.' ¤", other: "000 Bio'.' ¤" }, + }, }, }, unit: { one: "{0} {1}", other: "{0} {1}" }, }, decimal: { - number_system: "latn", patterns: { - default: "#,##0.###", + default: { + standard: "#,##0.###", + }, long: { - "1000": { one: "0 Tausend", other: "0 Tausend" }, - "10000": { one: "00 Tausend", other: "00 Tausend" }, - "100000": { one: "000 Tausend", other: "000 Tausend" }, - "1000000": { one: "0 Million", other: "0 Millionen" }, - "10000000": { one: "00 Millionen", other: "00 Millionen" }, - "100000000": { one: "000 Millionen", other: "000 Millionen" }, - "1000000000": { one: "0 Milliarde", other: "0 Milliarden" }, - "10000000000": { one: "00 Milliarden", other: "00 Milliarden" }, - "100000000000": { one: "000 Milliarden", other: "000 Milliarden" }, - "1000000000000": { one: "0 Billion", other: "0 Billionen" }, - "10000000000000": { one: "00 Billionen", other: "00 Billionen" }, - "100000000000000": { one: "000 Billionen", other: "000 Billionen" }, + standard: { + "1000": { one: "0 Tausend", other: "0 Tausend" }, + "10000": { one: "00 Tausend", other: "00 Tausend" }, + "100000": { one: "000 Tausend", other: "000 Tausend" }, + "1000000": { one: "0 Million", other: "0 Millionen" }, + "10000000": { one: "00 Millionen", other: "00 Millionen" }, + "100000000": { one: "000 Millionen", other: "000 Millionen" }, + "1000000000": { one: "0 Milliarde", other: "0 Milliarden" }, + "10000000000": { one: "00 Milliarden", other: "00 Milliarden" }, + "100000000000": { one: "000 Milliarden", other: "000 Milliarden" }, + "1000000000000": { one: "0 Billion", other: "0 Billionen" }, + "10000000000000": { one: "00 Billionen", other: "00 Billionen" }, + "100000000000000": { one: "000 Billionen", other: "000 Billionen" }, + }, }, short: { - "1000": { one: "0", other: "0" }, - "10000": { one: "0", other: "0" }, - "100000": { one: "0", other: "0" }, - "1000000": { one: "0 Mio'.'", other: "0 Mio'.'" }, - "10000000": { one: "00 Mio'.'", other: "00 Mio'.'" }, - "100000000": { one: "000 Mio'.'", other: "000 Mio'.'" }, - "1000000000": { one: "0 Mrd'.'", other: "0 Mrd'.'" }, - "10000000000": { one: "00 Mrd'.'", other: "00 Mrd'.'" }, - "100000000000": { one: "000 Mrd'.'", other: "000 Mrd'.'" }, - "1000000000000": { one: "0 Bio'.'", other: "0 Bio'.'" }, - "10000000000000": { one: "00 Bio'.'", other: "00 Bio'.'" }, - "100000000000000": { one: "000 Bio'.'", other: "000 Bio'.'" }, + standard: { + "1000": { one: "0", other: "0" }, + "10000": { one: "0", other: "0" }, + "100000": { one: "0", other: "0" }, + "1000000": { one: "0 Mio'.'", other: "0 Mio'.'" }, + "10000000": { one: "00 Mio'.'", other: "00 Mio'.'" }, + "100000000": { one: "000 Mio'.'", other: "000 Mio'.'" }, + "1000000000": { one: "0 Mrd'.'", other: "0 Mrd'.'" }, + "10000000000": { one: "00 Mrd'.'", other: "00 Mrd'.'" }, + "100000000000": { one: "000 Mrd'.'", other: "000 Mrd'.'" }, + "1000000000000": { one: "0 Bio'.'", other: "0 Bio'.'" }, + "10000000000000": { one: "00 Bio'.'", other: "00 Bio'.'" }, + "100000000000000": { one: "000 Bio'.'", other: "000 Bio'.'" }, + }, }, }, }, - percent: { number_system: "latn", patterns: { default: "#,##0 %" } }, - scientific: { number_system: "latn", patterns: { default: "#E0" } }, + percent: { patterns: { default: { standard: "#,##0 %" } } }, + scientific: { patterns: { default: { standard: "#E0" } } }, } - assert_equal expected, Cldr::Export::Data::Numbers.new(:de)[:numbers][:formats] + assert_equal expected, Cldr::Export::Data::Numbers.new(:de)[:numbers][:latn][:formats] end test "redirects in root locale" do - assert_equal :"numbers.formats.decimal.patterns.short", - Cldr::Export::Data::Numbers.new(:root)[:numbers][:formats][:decimal][:patterns][:long] + assert_equal :"numbers.latn.formats.decimal.patterns.short", + Cldr::Export::Data::Numbers.new(:root)[:numbers][:latn][:formats][:decimal][:patterns][:long] end end diff --git a/test/export_test.rb b/test/export_test.rb index ff1e18e..fe110ff 100644 --- a/test/export_test.rb +++ b/test/export_test.rb @@ -27,10 +27,10 @@ def tmp_dir test "passing the merge option generates and merge data for all fallback locales" do data = Cldr::Export.data(:Numbers, :"de-AT") - assert !data[:numbers][:formats][:nan] + assert !data[:numbers][:latn][:formats][:nan] data = Cldr::Export.data(:Numbers, :"de-AT", merge: true) - assert_equal "NaN", data[:numbers][:symbols][:nan] + assert_equal "NaN", data[:numbers][:latn][:symbols][:nan] end test "passing the merge option generates and merges Plurals data from fallback locales" do