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 41
41
npm run test:lib
42
42
npm run test:styles
43
43
npm run test:schematics
44
+ npm run test:i18n
44
45
env :
45
46
NODE_OPTIONS : --max_old_space_size=4096
46
47
- name : Build i18n & validate output
Original file line number Diff line number Diff line change 23
23
"test:lib:watch" : " ng test igniteui-angular --karma-config=./projects/igniteui-angular/karma.watch.conf.js" ,
24
24
"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" ,
25
25
"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" ,
26
27
"build:lib" : " ng build igniteui-angular --configuration production && gulp buildStyle" ,
27
28
"build:style" : " gulp buildStyle" ,
28
29
"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