1.2.7 • Published 2 months ago
@opi_pib/node-translate v1.2.7
@opi_pib/node-translate
Helper tool for generating translation files that works with ngx-translate
Install
npm install @opi_pib/node-translate
Generate translations
Find all translation keys in 'app' and 'domain' folders and generate translation files
translate build --source=\"./src/{app,domain}/**/*+(.ts|.html)\" --langs=pl --langs=en
Define translation keys
in TypeScript
Every translation key needs to match RegExp which means also that it needs to be used inside of methods translate\$ or instant
/[\s\t\[\(\{\.](?:t|translate\$|instant)\(:?\'\w+(:?.\w+)*/
If translate\$ or instant methods can't be used, wrap translation key in translation marker 't'
const a = t("A.B.C");
in HTML
Every translation key needs to match RegExp which means also that it needs to be passed through 'translate' pipe
/\'\w+(?:\.\w+)*\'\s(?:\|\s.+)*?\|\stranslate/
Example
<div [value]="'J' | async | name | translate"></div>
<div value="{{ 'J.J' | getName: {a: '1'} | translate }}"></div>
<div value="{{ 'J.J.J' | translate: {name: 'Jan'} }}"></div>
Default config
{
"source": "./src/app/**/*+(.ts|.html)",
"dist": "./src/translations",
"i18n": "./src/assets/i18n",
"langs": ["pl"],
"reportDuplicates": true
}
1.2.7
2 months ago
1.2.6
6 months ago
1.2.5
7 months ago
1.2.4
7 months ago
1.2.3
7 months ago
1.2.2
7 months ago
1.2.1
12 months ago
1.2.0
1 year ago
1.1.1
1 year ago
1.1.0
1 year ago
1.1.3
1 year ago
1.1.2
1 year ago
1.0.7
1 year ago
1.0.6
1 year ago
1.0.5
1 year ago
1.0.4
1 year ago
1.0.3
2 years ago
1.0.2
2 years ago
1.0.1
2 years ago
1.0.0
2 years ago