Class: ICU4X::DataGenerator

Inherits:
Object
  • Object
show all
Defined in:
lib/icu4x/yard_docs.rb

Overview

Generates locale data blobs for use with DataProvider.

DataGenerator exports Unicode CLDR data into a compact binary format that can be loaded at runtime by DataProvider.

Examples:

Generate data for specific locales

ICU4X::DataGenerator.export(
  locales: ["en", "ja", "de"],
  markers: :all,
  format: :blob,
  output: Pathname.new("data.postcard")
)

Class Method Summary collapse

Class Method Details

.available_markersArray<String>

Returns a list of all available data marker names.

Examples:

markers = ICU4X::DataGenerator.available_markers
#=> ["CalendarJapaneseExtendedV1", "CalendarJapaneseModernV1", ...]

Returns:

  • (Array<String>)

    list of marker names



156
# File 'lib/icu4x/yard_docs.rb', line 156

def self.available_markers; end

.export(locales:, markers:, format:, output:) ⇒ void

This method returns an undefined value.

Exports locale data to a file.

The ‘locales` parameter accepts either a Symbol for predefined locale sets based on CLDR coverage levels, or an Array of locale identifier strings. When using `with_descendants`, ancestor locales (including `und`) are automatically included for fallback support.

Examples:

Export all data for Japanese and English

ICU4X::DataGenerator.export(
  locales: ["ja", "en"],
  markers: :all,
  format: :blob,
  output: Pathname.new("i18n_data.postcard")
)

Export data for all modern coverage locales

ICU4X::DataGenerator.export(
  locales: :modern,
  markers: :all,
  format: :blob,
  output: Pathname.new("modern_data.postcard")
)

Parameters:

  • locales (Symbol, Array<String>)

    locale specification:

    • ‘:full` - all CLDR locales (700+)

    • ‘:recommended` - locales with basic, moderate, or modern coverage (164)

    • ‘:modern` - locales with modern coverage only (103)

    • ‘:moderate` - locales with moderate coverage only

    • ‘:basic` - locales with basic coverage only

    • ‘Array<String>` - explicit list of locale identifiers

  • markers (Symbol, Array<String>)

    data markers to include; use ‘:all` for all markers, or specify individual marker names

  • format (Symbol)

    output format, currently only ‘:blob` is supported

  • output (Pathname)

    path to write the output file

Raises:

See Also:



146
# File 'lib/icu4x/yard_docs.rb', line 146

def self.export(locales:, markers:, format:, output:); end