ruby-i18n/ruby-cldr

`thor cldr:export` produces invalid `plurals.rb` file when `--merge` is not set

Closed this issue · 1 comments

Steps to Reproduce

bundle exec thor cldr:download
bundle exec thor cldr:export

Note that the --merge option was not set in the cldr:export call.

Actual output

Look at the contents of data/af-NA/plurals.rb:

{ :'af_NA' => { :i18n => { :plural => { :keys => nil, :rule =>  } } } }

Note that this is not valid ruby syntax, since there is no value for the :rule key.

$> ruby data/af-NA/plurals.rb
data/af-NA/plurals.rb:1: syntax error, unexpected '}'
... => { :keys => nil, :rule =>  } } } }

Expected output

All Ruby files (including plurals.rb files) created by ruby-cldr should be valid Ruby files (i.e. syntactically correct)

I think the expectation from a users perspective, is that there would not be any plurals.rb file for any locale that doesn't have its own plural rules defined in CLDR:

By default this library just exports data that is present in CLDR for a given locale. If you do not want to use locale fallbacks in your application you’ll need to “flatten” locale fallbacks and merge the data during export time. To do that you can use the --merge option:
-https://github.com/ruby-i18n/ruby-cldr#export

In this example, parent locale af has plural rules defined in upstream CLDR, but af-NA does not.