2.0.0 • Published 9 months ago

@opi_pib/node-translate v2.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
9 months ago

@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
}
2.0.0

9 months ago

1.3.0

12 months ago

1.2.7

1 year ago

1.2.6

2 years ago

1.2.5

2 years ago

1.2.4

2 years ago

1.2.3

2 years ago

1.2.2

2 years ago

1.2.1

2 years ago

1.2.0

2 years ago

1.1.1

2 years ago

1.1.0

2 years ago

1.1.3

2 years ago

1.1.2

2 years ago

1.0.7

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago