@superset-ui/translation
Advanced tools
Comparing version 0.1.0 to 0.2.0
{ | ||
"name": "@superset-ui/translation", | ||
"version": "0.1.0", | ||
"version": "0.2.0", | ||
"description": "Superset UI translation", | ||
@@ -12,15 +12,2 @@ "sideEffects": false, | ||
], | ||
"scripts": { | ||
"build:cjs": "beemo babel ./src --out-dir lib/ --minify", | ||
"build:esm": "beemo babel ./src --out-dir esm/ --esm --minify", | ||
"build": "yarn run build:cjs && yarn run build:esm", | ||
"dev": "beemo babel --watch ./src --out-dir esm/ --esm", | ||
"jest": "beemo jest --color --coverage", | ||
"eslint": "beemo eslint \"./{src,test}/**/*.{js,jsx,md}\"", | ||
"lint": "yarn run prettier && yarn run eslint", | ||
"lint:fix": "yarn run prettier --write && yarn run eslint --fix", | ||
"test": "yarn run jest", | ||
"prettier": "beemo prettier \"./{src,test}/**/*.{js,jsx,json,md}\"", | ||
"prepublish": "yarn run build" | ||
}, | ||
"repository": { | ||
@@ -46,4 +33,3 @@ "type": "git", | ||
"@babel/runtime": "^7.1.2", | ||
"jed": "^1.1.1", | ||
"sprintf-js": "^1.1.1" | ||
"jed": "^1.1.1" | ||
}, | ||
@@ -66,3 +52,4 @@ "beemo": { | ||
"access": "public" | ||
} | ||
}, | ||
"gitHead": "098c2fce9f3f6a16b555c2a3ebf4715af76818a8" | ||
} |
@@ -12,3 +12,3 @@ ## `@superset-ui/translation` | ||
```js | ||
import { configure, t } from '@superset-ui/translation'; | ||
import { configure, t, tn } from '@superset-ui/translation'; | ||
@@ -20,2 +20,3 @@ configure({ | ||
console.log(t('text to be translated')); | ||
console.log(tn('singular text', 'plural text', value)); | ||
``` | ||
@@ -32,4 +33,4 @@ | ||
- Translate `text` when no `args` is provided. | ||
- Translate `text` and substitute `args` into the placeholders specified within `text`. | ||
- Translate `text`. | ||
- If `args` is provided, substitute `args` into the `sprintf` placeholders specified within `text` translation. | ||
@@ -39,3 +40,3 @@ For example | ||
```js | ||
t('Hello %(name)s', user) | ||
t('Hello %(name)s', user); | ||
``` | ||
@@ -45,2 +46,13 @@ | ||
`tn(singular, plural, num, [, args])` | ||
- Translate and choose between `singular` and `plural` based on `num`. | ||
- If `args` is provided, substitute `args` into the `sprintf` placeholders specified within `singular` or `plural` translations. | ||
For example | ||
```js | ||
tn('%d duck', '%d ducks', 2, 2); | ||
``` | ||
### Development | ||
@@ -47,0 +59,0 @@ |
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
2
57
4990
- Removedsprintf-js@^1.1.1
- Removedsprintf-js@1.1.3(transitive)