File tree Expand file tree Collapse file tree 3 files changed +33
-0
lines changed
projects/igniteui-angular/src/lib/core/i18n/tests Expand file tree Collapse file tree 3 files changed +33
-0
lines changed Original file line number Diff line number Diff line change 4141 npm run test:lib
4242 npm run test:styles
4343 npm run test:schematics
44+ npm run test:i18n
4445 env :
4546 NODE_OPTIONS : --max_old_space_size=4096
4647 - name : Build i18n & validate output
Original file line number Diff line number Diff line change 2323 "test:lib:watch" : " ng test igniteui-angular --karma-config=./projects/igniteui-angular/karma.watch.conf.js" ,
2424 "test:schematics" : " ts-node --project projects/igniteui-angular/migrations/tsconfig.json ./node_modules/jasmine/bin/jasmine.js ./projects/igniteui-angular/migrations/**/*.spec.ts ./projects/igniteui-angular/schematics/**/*.spec.ts" ,
2525 "test:styles" : " ts-node --skip-project ./node_modules/jasmine/bin/jasmine.js ./projects/igniteui-angular/src/lib/core/styles/spec/tests.ts" ,
26+ "test:i18n" : " ts-node --skip-project ./projects/igniteui-angular/src/lib/core/i18n/tests/tests.ts" ,
2627 "build:lib" : " ng build igniteui-angular --configuration production && gulp buildStyle" ,
2728 "build:style" : " gulp buildStyle" ,
2829 "build:migration" : " gulp copyMigrations && tsc --listEmittedFiles --project ./projects/igniteui-angular/migrations/tsconfig.json" ,
Original file line number Diff line number Diff line change 1+ import * as fs from 'fs' ;
2+ import * as path from 'path' ;
3+
4+ const i18nProductPath = path . join ( __dirname , '../' ) ;
5+ const i18nLanguagesPath = path . join ( __dirname , '../../../../../../igniteui-angular-i18n/src/i18n' ) ;
6+ const errors = [ ] ;
7+
8+ class i18nTests {
9+ public runTests ( ) : void {
10+ this . i18nFilesMatchForAllLanguages ( ) ;
11+ }
12+
13+ public getDirectories = srcPath => fs . readdirSync ( srcPath ) . filter ( file => fs . statSync ( path . join ( srcPath , file ) ) . isDirectory ( ) ) ;
14+ public getFiles = srcPath => fs . readdirSync ( srcPath ) . filter ( file => fs . statSync ( path . join ( srcPath , file ) ) . isFile ( ) ) ;
15+
16+ public i18nFilesMatchForAllLanguages ( ) : void {
17+ this . getDirectories ( i18nLanguagesPath ) . forEach ( dir => {
18+ const curDirPath = path . join ( i18nLanguagesPath , dir ) ;
19+ if ( this . getFiles ( curDirPath ) . length === this . getFiles ( i18nProductPath ) . length ) {
20+ errors . push ( `Not all i18n component files that are available for localization have matching files for ${ dir } language.
21+ Check and add the appropriate resource strings with EN translation and mark the PR as 'pending localization'`
22+ ) ;
23+ }
24+ } ) ;
25+ if ( errors . length > 0 ) {
26+ throw errors ;
27+ }
28+ }
29+ }
30+
31+ new i18nTests ( ) . runTests ( ) ;
You can’t perform that action at this time.
0 commit comments