@lion/localize
Advanced tools
Comparing version 0.10.0 to 0.11.0
@@ -6,2 +6,13 @@ # Change Log | ||
# [0.11.0](https://github.com/ing-bank/lion/compare/@lion/localize@0.10.0...@lion/localize@0.11.0) (2020-05-29) | ||
### Features | ||
* use markdown javascript (mdjs) for documentation ([bcd074d](https://github.com/ing-bank/lion/commit/bcd074d1fbce8754d428538df723ba402603e2c8)) | ||
# [0.10.0](https://github.com/ing-bank/lion/compare/@lion/localize@0.9.2...@lion/localize@0.10.0) (2020-05-18) | ||
@@ -8,0 +19,0 @@ |
{ | ||
"name": "@lion/localize", | ||
"version": "0.10.0", | ||
"version": "0.11.0", | ||
"description": "The localization system helps to manage localization data split into locales and automate its loading", | ||
@@ -46,3 +46,3 @@ "author": "ing-bank", | ||
}, | ||
"gitHead": "f9ce60c08cf0c608f5f3a9ef9937c536f7782c11" | ||
"gitHead": "94b87c80f5c734cd7d2d2ecd1c6598b22575717e" | ||
} |
@@ -0,5 +1,14 @@ | ||
[//]: # 'AUTO INSERT HEADER PREPUBLISH' | ||
# Localize | ||
The localization system helps to manage localization data split into locales and automate its loading. | ||
```js script | ||
export default { | ||
title: 'Localize/Intro', | ||
}; | ||
``` | ||
Is meant to translate text into multiple languages. | ||
In it's simplest form it is a function that returns the translated text for a namespace + key. | ||
## Live Demo/Documentation | ||
@@ -9,41 +18,28 @@ | ||
## How to use | ||
## Features | ||
### Installation | ||
- Uses es modules | ||
- Formatting of numbers, amounts | ||
- Formatting of dates | ||
```sh | ||
npm i --save @lion/localize | ||
``` | ||
Further examples can be seen at [Features Overview Demo](?path=/docs/localize-features-overview--as-function) and a more in depth description can be found at [Localize System Overview](?path=/docs/localize-system-overview--page). | ||
```js | ||
import { localize } from '@lion/localize'; | ||
``` | ||
## Content | ||
### Example | ||
| Feature | Description | | ||
| --------------------------------------------------------------------- | --------------------------------------------- | | ||
| [Translate Text](?path=/docs/localize-features-overview--as-function) | Load and translate text in multiple languages | | ||
| [Format Numbers](?path=/docs/localize-numbers--formatting) | Format numbers in multiple languages | | ||
| [Format Dates](?path=/docs/localize-dates--formatting) | Format dates in multiple languages | | ||
Translation data: | ||
## How to use | ||
```js | ||
// path/to/hello-world/translations/en-GB.js | ||
export default { greeting: 'Hello {name}!', };` | ||
``` | ||
### Installation | ||
Loading translations: | ||
```js | ||
// path/to/hello-world/HelloWorld.js | ||
localize.loadNamespace({ | ||
'hello-world': locale => { | ||
return import(`./translations/${locale}.js`); | ||
}, | ||
}); | ||
```bash | ||
npm i --save @lion/localize | ||
``` | ||
> Note: dynamic variables inside dynamic imports may cause problems with tools that do static analysis, and may not work out of the box | ||
Translating messages: | ||
```js | ||
localize.msg('hello-world:greeting', { name: 'John' }); | ||
// Hello John! | ||
import { localize } from '@lion/localize'; | ||
``` |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
172694
76
3266
45