ruby-i18n/ruby-cldr

Only output a single copy of `parent_locales.yml`

Closed this issue · 0 comments

Problem

thor cldr:export --components=parentLocales

Produces a parent_locales.yml for every locale. This is a waste of files / disk space / memory.

The data in parent_locales.yml comes from supplementalData.xml, which is valid for all locales.

You can verify that the data is identical for all locales with this bit of Ruby:

require 'yaml'

def check_parent_locales
  result = nil
  Dir[File.join("data", "*", "parent_locales.yml")].sort.each do |source_file_name|
    parsed = YAML.load_file(source_file_name).values.first
    result ||= parsed
    unless parsed == result
      raise "`#{source_file_name}` is different from the others"
    end
  end
end

check_parent_locales

Potential solution

Instead of outputting duplicated data for every locale, output a top-level parent_locales.yml