Skip to content

Ruby library for exporting data from CLDR (Common Locale Data Repository)

License

Notifications You must be signed in to change notification settings

ruby-i18n/ruby-cldr

Folders and files

NameName
Last commit message
Last commit date
Dec 1, 2024
May 18, 2022
Apr 12, 2022
Dec 5, 2024
Dec 5, 2024
Jan 20, 2010
Jan 4, 2023
Nov 2, 2012
Dec 1, 2024
Jan 10, 2022
Dec 1, 2024
Feb 23, 2023
Feb 19, 2025
Jan 16, 2010
Dec 1, 2024
Dec 13, 2021
Nov 20, 2020
Jan 10, 2022
Nov 30, 2024

Repository files navigation

Ruby library for exporting data from CLDR

Tests

The Unicode Consortium's Common Locale Data Repository (CLDR) contains tons of high-quality locale data such as formatting rules for dates, times, numbers, currencies as well as language, country, calendar-specific names etc.

For localizing applications in Ruby we obviously want to use this incredibly comprehensive and well-maintained resource.

ruby-cldr exports the XML-serialized CLDR data as YAML and Ruby files, for consumption in an I18n context.

WIP status

ruby-cldr is a work in progress towards a complete and accurate serialization of the CLDR data as Ruby + YAML files.

There are still a number of issues that need to be addressed before it can be considered production-ready.

Requirements

Installation

gem install bundler
bundle install

thor cldr:download

Export

By default, the thor cldr:export command will export all known components from all locales to the target directory:

thor cldr:export

Locales, components, and target directory

You can also optionally specify locales and/or components to export as well as the target directory:

# Export the `Numbers` and `Plurals` components for the locales `de`, `fr-FR` and `en-ZA` to the `./data` target directory

thor cldr:export --locales de fr-FR en-ZA --components Numbers Plurals --target=./data

Draft status

CLDR defines a hierarchy of four draft statuses, used to indicate how confident they are in the data: unconfirmed < provisional < contributed < approved.

By default, ruby-cldr only exports data with a minimum draft status of contributed (i.e., contributed or approved). This is the same threshold that is used by the Unicode Consortium's International Components for Unicode (ICU).

Set the --draft-status= parameter to specify the minimum draft status the data needs in order to be exported:

# Export any data with a minimum draft status of `provisional`
# (i.e., `provisional`, `contributed` or `approved`)).

thor cldr:export --draft-status=provisional

Tests

bundle exec ruby test/all.rb

Resources

About

Ruby library for exporting data from CLDR (Common Locale Data Repository)

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages