File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11{
22 "name" : " @zen-browser/surfer" ,
3- "version" : " 1.12.0 " ,
3+ "version" : " 1.12.1 " ,
44 "description" : " Simplifying building firefox forks!" ,
55 "main" : " index.js" ,
66 "bin" : {
Original file line number Diff line number Diff line change @@ -22,7 +22,23 @@ const machPath = resolve(ENGINE_DIR, 'mach')
2222async function getLocales ( ) {
2323 // locales/supported-languages is a list of locales divided by newlines
2424 // open the file and split it by newlines
25- const localesText = await readFile ( 'locales/supported-languages' , 'utf-8' )
25+ let localesText = await readFile ( 'locales/supported-languages' , 'utf-8' ) ;
26+ const languageMaps = await readFile ( 'locales/language-maps' , 'utf-8' ) ;
27+ // Language maps contains a list of locale mappings for specific locales
28+ // e.g. "nb:nb-NO" means that "nb" should be mapped to "nb-NO"
29+ const mappings : Record < string , string > = { }
30+ for ( const line of languageMaps . split ( '\n' ) ) {
31+ const [ key , value ] = line . split ( ':' )
32+ if ( key && value ) {
33+ mappings [ key . trim ( ) ] = value . trim ( )
34+ }
35+ }
36+ localesText = localesText
37+ . split ( '\n' )
38+ . map ( ( locale ) => locale . trim ( ) )
39+ . filter ( ( locale ) => locale . length > 0 )
40+ . map ( ( locale ) => ( mappings [ locale ] ? mappings [ locale ] : locale ) )
41+ . join ( '\n' )
2642 log . info ( `Found locales:\n${ localesText } ` )
2743 return localesText . split ( '\n' )
2844}
You can’t perform that action at this time.
0 commit comments