File tree Expand file tree Collapse file tree 1 file changed +14
-12
lines changed
apps/nestjs-backend/src/utils Expand file tree Collapse file tree 1 file changed +14
-12
lines changed Original file line number Diff line number Diff line change 11import fs from 'fs' ;
22import path from 'path' ;
33
4- export const getI18nPath = ( ) => {
5- const isDev = process . env . NODE_ENV !== 'production' ;
6-
7- const resultPath = isDev
8- ? path . join ( __dirname , '../../../packages/common-i18n/src/locales' )
9- : path . join ( __dirname , './node_modules/@teable/common-i18n/src/locales' ) ;
4+ const localPaths = [
5+ process . env . I18N_LOCALES_PATH || '' ,
6+ path . join ( __dirname , '../../../packages/common-i18n/src/locales' ) ,
7+ ] ;
108
11- if ( ! fs . existsSync ( resultPath ) ) {
12- console . error ( 'nestjs-backend I18n path not found' , isDev , __dirname , resultPath ) ;
13- return null ;
14- }
15- console . log ( 'nestjs-backend I18n path found' , isDev , __dirname , resultPath ) ;
16- return resultPath ;
9+ export const getI18nPath = ( ) => {
10+ console . log ( 'nestjs-backend I18n path checking' , __dirname , 'localPaths' , localPaths ) ;
11+ return localPaths . find ( ( str ) => {
12+ const exists = fs . existsSync ( str ) ;
13+ console . log ( `nestjs-backend I18n path checking exists ${ exists } ${ str } ` ) ;
14+ if ( exists ) {
15+ console . log ( 'nestjs-backend I18n path found' , str ) ;
16+ }
17+ return exists ;
18+ } ) ;
1719} ;
You can’t perform that action at this time.
0 commit comments