Skip to content

Commit dd5f513

Browse files
committed
One more try at quote preference
1 parent e384b73 commit dd5f513

File tree

1 file changed

+17
-4
lines changed

1 file changed

+17
-4
lines changed

lib/cldr/backend/cldr_backend.ex

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -490,8 +490,10 @@ defmodule Cldr.Backend do
490490
with {:ok, %LanguageTag{cldr_locale_name: locale_name}} <- validate_locale(locale) do
491491
marks = quote_marks_for(locale_name)
492492

493-
# IO.inspect marks.quotation_start, label: "Quote start for #{locale_name}"
494-
# IO.inspect marks.quotation_end, label: "Quote end for #{locale_name}"
493+
if is_binary(marks.quotation_start) || is_binary(marks.quotation_end) do
494+
IO.inspect marks.quotation_start, label: "Quote start for #{locale_name}"
495+
IO.inspect marks.quotation_end, label: "Quote end for #{locale_name}"
496+
end
495497

496498
quote_start = quote_preference(marks.quotation_start, preference)
497499
quote_end = quote_preference(marks.quotation_end, preference)
@@ -500,8 +502,19 @@ defmodule Cldr.Backend do
500502
end
501503
end
502504

503-
defp quote_preference(marks, preference) when is_map_key(marks, preference),
504-
do: Map.fetch!(marks, preference)
505+
# There is an anomalous behaviour in CI where somehow the marks show up
506+
# as binary even though debugging says thats not so. Therefore this needs
507+
# revisiting at some time. `marks` should always be a map, and always have
508+
# a map entry of :default.
509+
510+
defp quote_preference(marks, preference) do
511+
if is_binary(marks) do
512+
marks
513+
else
514+
Map.get(marks, preference) || Map.fetch!(marks, :default)
515+
end
516+
end
517+
505518

506519
@doc """
507520
Add locale-specific ellipsis to a string.

0 commit comments

Comments
 (0)