File tree Expand file tree Collapse file tree 2 files changed +24
-10
lines changed Expand file tree Collapse file tree 2 files changed +24
-10
lines changed Original file line number Diff line number Diff line change @@ -599,17 +599,24 @@ function createXlfFilesForExtensions() {
599
599
const basename = path . basename ( file . path ) ;
600
600
if ( basename === 'package.nls.json' ) {
601
601
const json = JSON . parse ( buffer . toString ( 'utf8' ) ) ;
602
- const keys = Object . keys ( json ) ;
603
- const messages = keys . map ( ( key ) => {
602
+ const keys = [ ] ;
603
+ const messages = [ ] ;
604
+ Object . keys ( json ) . forEach ( ( key ) => {
604
605
const value = json [ key ] ;
605
606
if ( Is . string ( value ) ) {
606
- return value ;
607
+ keys . push ( key ) ;
608
+ messages . push ( value ) ;
607
609
}
608
610
else if ( value ) {
609
- return value . message ;
611
+ keys . push ( {
612
+ key,
613
+ comment : value . comment
614
+ } ) ;
615
+ messages . push ( value . message ) ;
610
616
}
611
617
else {
612
- return `Unknown message for key: ${ key } ` ;
618
+ keys . push ( key ) ;
619
+ messages . push ( `Unknown message for key: ${ key } ` ) ;
613
620
}
614
621
} ) ;
615
622
getXlf ( ) . addFile ( `extensions/${ extensionName } /package` , keys , messages ) ;
Original file line number Diff line number Diff line change @@ -714,15 +714,22 @@ export function createXlfFilesForExtensions(): ThroughStream {
714
714
const basename = path . basename ( file . path ) ;
715
715
if ( basename === 'package.nls.json' ) {
716
716
const json : PackageJsonFormat = JSON . parse ( buffer . toString ( 'utf8' ) ) ;
717
- const keys = Object . keys ( json ) ;
718
- const messages = keys . map ( ( key ) => {
717
+ const keys : Array < string | LocalizeInfo > = [ ] ;
718
+ const messages : string [ ] = [ ] ;
719
+ Object . keys ( json ) . forEach ( ( key ) => {
719
720
const value = json [ key ] ;
720
721
if ( Is . string ( value ) ) {
721
- return value ;
722
+ keys . push ( key ) ;
723
+ messages . push ( value ) ;
722
724
} else if ( value ) {
723
- return value . message ;
725
+ keys . push ( {
726
+ key,
727
+ comment : value . comment
728
+ } ) ;
729
+ messages . push ( value . message ) ;
724
730
} else {
725
- return `Unknown message for key: ${ key } ` ;
731
+ keys . push ( key ) ;
732
+ messages . push ( `Unknown message for key: ${ key } ` ) ;
726
733
}
727
734
} ) ;
728
735
getXlf ( ) . addFile ( `extensions/${ extensionName } /package` , keys , messages ) ;
You can’t perform that action at this time.
0 commit comments