How to use the cldr-core/supplemental/ordinals.json.supplemental function in cldr-core

To help you get started, we’ve selected a few cldr-core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github eemeli / make-plural / test / plural-data.js View on Github external
describe('Ordinal rules', () => {
    for (var lc in ordinalData.supplemental['plurals-type-ordinal']) {
      describe(lc, () => testPluralData('ordinal', lc, getPlural))
    }
  })
})
github ember-intl / ember-intl / lib / broccoli / translation-reducer / utils / ordinal-categories.js View on Github external
function extractOrdinalCategories() {
  let ordinals = require('cldr-core/supplemental/ordinals.json').supplemental['plurals-type-ordinal'];

  let ordinalCategories = {};
  Object.keys(ordinals).forEach(locale => {
    ordinalCategories[locale] = Object.keys(ordinals[locale]).map(key => key.replace('pluralRule-count-', ''));
  });

  return ordinalCategories;
}
github format-message / format-message / scripts / cldr.js View on Github external
fn = '  function (s/*: string | number */)/*: Rule */ {\n' + fn + 'other\n  }'
  var index = pluralFunctions.indexOf(fn)
  if (index < 0) {
    index = pluralFunctions.length
    pluralFunctions[index] = fn
  }

  return {
    data: data,
    func: index
  }
}

var pluralsTypeCardinal = pluralsJSON.supplemental['plurals-type-cardinal']
var pluralsTypeOrdinal = ordinalsJSON.supplemental['plurals-type-ordinal']
var locales = {}
var funcs = {}

for (var locale in pluralsTypeCardinal) {
  var cardinal = parseRules(pluralsTypeCardinal[locale])
  if (cardinal) {
    locales[locale] = { plurals: { cardinal: cardinal.data } }
    funcs[locale] = 'cardinal: f[' + cardinal.func + ']'
  }
}
for (var locale in pluralsTypeOrdinal) {
  var ordinal = parseRules(pluralsTypeOrdinal[locale])
  if (ordinal) {
    if (locales[locale]) {
      locales[locale].plurals.ordinal = ordinal.data
      funcs[locale] += ', ordinal: f[' + ordinal.func + ']'