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 e64c3a1 commit 045c7d3
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/cldr/export/data/calendars/gregorian.rb
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,10 @@ def eras
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
# TODO: Actually resolve alias nodes
# https://github.com/ruby-i18n/ruby-cldr/issues/78
next {} if node.name == "alias"
type = node.attribute('type').value.to_i
ret[type] = node.content
ret
end
Expand Down

0 comments on commit 045c7d3

Please sign in to comment.