Skip to content

Commit

Permalink
Remove type default in era
Browse files Browse the repository at this point in the history
`type` is a required attribute of `era` tags.

`<alias>` tags are present in the `:root` locale and were incorrectly getting output as:

```yaml
eras:
  abbr:
    0: BCE
    1: CE
  name:
    0: ''
  narrow:
    0: ''
```

Until ruby-i18n#78 is addressed, I figure it is better not to output any data, rather than incorrect data.
  • Loading branch information
movermeyer committed Nov 15, 2021
1 parent 4bdb939 commit ef8dcd8
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/cldr/export/data/calendars/gregorian.rb
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,13 @@ def eras
keys.inject({}) do |result, name|
path = "#{base_path}/#{name}/*"
key = name.gsub('era', '').gsub(/s$/, '').downcase.to_sym
result[key] = select(path).inject({}) do |ret, node|
type = node.attribute('type').value.to_i rescue 0
key_result = select(path).inject({}) do |ret, node|
next ret if node.name == "alias" # TODO: Actually handle alias nodes, https://github.com/ruby-i18n/ruby-cldr/issues/78
type = node.attribute('type').value.to_i
ret[type] = node.content
ret
end
result[key] = key_result unless key_result.empty?
result
end
else
Expand Down

0 comments on commit ef8dcd8

Please sign in to comment.