@prepair/locale-support

2.2.3 • Public • Published

locale-support

Locale related data in a neat bundle.

Warning: locale and currency connections are defined by @prepair specs (meaning that even though in a country the standard currency may be XXX, we support payments in YYY so we will use the latter in the config file).

supported locales

supportedLocales = ["ar-ae","bg-BG","bs-Latn-BA","ca-ES","cs-CZ","de-DE","el-GR","en-GB","es-ES","fr-FR","he-IL","hi-IN","hu-HU","it-IT","ka-GE","lt-LT","lv-LV","mk-MK","nb-NO","nl-NL","pl-PL","pt-PT","ro-RO","ru-RU","sk-SK","sq-AL","sr-Cyrl-CS","sv-SE","uk-UA","zh-CN"];

installation

npm i -S @prepair/locale-support
  • metadata code generator assumes a node context.
  • use metadata in the browser with webpack or browserify.
  • use generated code in your own repository.

usage

metadata

import { metadata } from '@prepair/locale-support';
  • contains locale data for accounting
  • contains currency data (code, short symbol, precision)

mod rewrite partial regexp

Returns a regexpish partial string for mod rewrite, created from the dotnet lang ids.

For example: bg-bg|bs-latn-ba|cs-cz

const localeSupport = require('@prepair/locale-support');
const ruleChunk = localeSupport.getModRewriteRex();
  • with no params it returns all the lang ids
  • ids are sorted before concatenation
  • localeSupport.getModRewriteRex({rtl: true}) - rtl only ids
  • localeSupport.getModRewriteRex({rtl: false}) - non rtl only ids

adding new locales

Add new data to ./src/config.js

then run npm run build.

TODO

  • refactor "src - lib - lib-es5" so that instead of 2 build cycles we should use 1
  • transpile config.js, before someone accidentally adds an es6 keyword there

Readme

Keywords

Package Sidebar

Install

npm i @prepair/locale-support

Weekly Downloads

17

Version

2.2.3

License

MIT

Unpacked Size

28 kB

Total Files

15

Last publish

Collaborators

  • prepair
  • zfeher
  • gasparrobi
  • leventefrks
  • fecz0