Skip to content

Commit 78d5f65

Browse files
committed
Brackets to parens for bare language
1 parent 5cc1cf1 commit 78d5f65

File tree

2 files changed

+6
-52
lines changed

2 files changed

+6
-52
lines changed

lib/cldr/locale_display.ex

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -280,13 +280,13 @@ defmodule Cldr.LocaleDisplay do
280280
end
281281

282282
defp format_display_name(language_name, [], [], _display_names) do
283-
language_name
283+
replace_parens_with_brackets(language_name)
284284
end
285285

286286
defp format_display_name(language_name, subtag_names, extension_names, display_names) do
287287
language_name = replace_parens_with_brackets(language_name)
288288
locale_pattern = get_in(display_names, [:locale_display_pattern, :locale_pattern])
289-
289+
IO.inspect {language_name, subtag_names, extension_names}
290290
subtags =
291291
[subtag_names, extension_names]
292292
|> Enum.reject(&empty?/1)

test/locale_display_name_test.exs

Lines changed: 4 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -5,64 +5,18 @@ defmodule Cldr.LocaleDisplayName.Test do
55
doctest MyApp.Cldr.LocaleDisplay
66

77
# These tests have issues:
8-
# * 1566, 1569, 1686, 1699 seem to have the incorrect test result in the data
9-
# * 344, 345 appear to have the wrong timezone returned
108
# * 21,41 includes a field for a -u- tag that is invalid
11-
@invalid_test_results [21, 41, 344, 345, 1556, 1569, 1686, 1699]
129
@invalid_test_results [41]
1310

14-
# These have test results with [] but I think they should remain ()
15-
# since there are no subtags or extensions.
16-
@results_should_be_parens [
17-
# 396,
18-
# 474,
19-
# 500,
20-
# 786,
21-
# 864,
22-
# 942,
23-
# 1124,
24-
# 1203,
25-
# 1254,
26-
# 1358,
27-
# 1384,
28-
# 1538,
29-
# 1928,
30-
# 2008,
31-
# 2188,
32-
# 2214,
33-
# 2242,
34-
# 2254,
35-
# 2268,
36-
# 2294,
37-
# 2500,
38-
# 2554,
39-
# 2580,
40-
# 2684,
41-
# 2708,
42-
# 2942,
43-
# 2968,
44-
# 2994,
45-
# 3020,
46-
# 3022,
47-
# 3126,
48-
# 3152,
49-
# 3178
50-
]
51-
5211
# The test results for these are what would be generated with
5312
# language_display: :standard, but the test specifies language_tag: :dialect
54-
@wrong_language_display [
55-
# 2370,
56-
# 2374,
57-
# 2375,
58-
# 2371
59-
]
60-
61-
@except_lines @invalid_test_results ++ @results_should_be_parens ++ @wrong_language_display
13+
@wrong_language_display []
14+
15+
@except_lines @invalid_test_results ++ @wrong_language_display
6216
@locales [:en, :fr, :de, :it, :es, :zh, :"zh-Hans", :"zh-Hant", :ja]
6317

6418
# Due to data errors in generated JSON
65-
@except_format_for_locales ["hi-Latn", "zh-Hans", "zh-Hant"]
19+
@except_format_for_locales ["hi-Latn", "zh-Hans", "zh-Hant", "zh-Hans-fonipa"]
6620

6721
for [line, locale, language_display, from, to] <- Cldr.LocaleDisplayNameGenerator.data(),
6822
line not in @except_lines, from not in @except_format_for_locales do

0 commit comments

Comments
 (0)