File tree Expand file tree Collapse file tree 3 files changed +41
-0
lines changed
Expand file tree Collapse file tree 3 files changed +41
-0
lines changed Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ module Data
1919 autoload :Layout , "cldr/export/data/layout"
2020 autoload :LikelySubtags , "cldr/export/data/likely_subtags"
2121 autoload :Lists , "cldr/export/data/lists"
22+ autoload :LocaleDisplayPattern , "cldr/export/data/locale_display_pattern"
2223 autoload :Metazones , "cldr/export/data/metazones"
2324 autoload :NumberingSystems , "cldr/export/data/numbering_systems"
2425 autoload :Numbers , "cldr/export/data/numbers"
Original file line number Diff line number Diff line change 1+ # frozen_string_literal: true
2+
3+ module Cldr
4+ module Export
5+ module Data
6+ class LocaleDisplayPattern < Base
7+ def initialize ( locale )
8+ super
9+ update ( locale_display_pattern : locale_display_pattern )
10+ end
11+
12+ private
13+
14+ def locale_display_pattern
15+ @locale_display_pattern ||= select ( "localeDisplayNames/localeDisplayPattern/*" ) . each_with_object ( { } ) do |node , result |
16+ result [ node . name . underscore ] = node . content
17+ end
18+ end
19+ end
20+ end
21+ end
22+ end
Original file line number Diff line number Diff line change 1+ # encoding: utf-8
2+ # frozen_string_literal: true
3+
4+ require File . expand_path ( File . join ( File . dirname ( __FILE__ ) + "/../../test_helper" ) )
5+
6+ class TestLocaleDisplayPattern < Test ::Unit ::TestCase
7+ test "locale_display_pattern :de" do
8+ expected = {
9+ "locale_key_type_pattern" => "{0}: {1}" ,
10+ "locale_pattern" => "{0} ({1})" ,
11+ "locale_separator" => "{0}, {1}" ,
12+ }
13+
14+ actual = Cldr ::Export ::Data ::LocaleDisplayPattern . new ( :de ) [ :locale_display_pattern ]
15+
16+ assert_equal expected , actual
17+ end
18+ end
You can’t perform that action at this time.
0 commit comments