1
- var os = require ( 'os' ) ;
2
1
var dom = require ( 'xmldom' ) . DOMParser
3
2
var gulp = require ( 'gulp' )
4
3
var config = require ( './config' )
@@ -132,7 +131,7 @@ gulp.task('ext:localization:xliff-to-ts', function () {
132
131
contents . push ( '};' ) ;
133
132
134
133
// Join with new lines in between
135
- let fullFileContents = contents . join ( os . EOL ) + os . EOL ;
134
+ let fullFileContents = contents . join ( '\r\n' ) + '\r\n' ;
136
135
file . contents = new Buffer ( fullFileContents ) ;
137
136
138
137
// Name our file
@@ -169,9 +168,14 @@ function dictionaryMapping(file, packageAllKeys = undefined) {
169
168
if ( contents . length >= 2 ) {
170
169
contents [ contents . length - 1 ] += ',' ;
171
170
}
172
- if ( dict . hasOwnProperty ( key ) ) {
171
+ if ( packageAllKeys && dict . hasOwnProperty ( key ) ) {
172
+ //running in localized mode, use localized value.
173
173
value = dict [ key ] [ 'target' ] ;
174
174
}
175
+ else if ( dict . hasOwnProperty ( key ) ) {
176
+ //running in generation mode, use original source value.
177
+ value = dict [ key ] [ 'source' ] ;
178
+ }
175
179
if ( packageAllKeys && value === '' ) {
176
180
// If localizing and value is not provided, use original English value.
177
181
value = packageAllKeys [ key ] ;
@@ -188,7 +192,7 @@ function dictionaryMapping(file, packageAllKeys = undefined) {
188
192
contents . push ( '}' ) ;
189
193
190
194
// Join with new lines in between
191
- let fullFileContents = contents . join ( os . EOL ) + os . EOL ;
195
+ let fullFileContents = contents . join ( '\r\n' ) + '\r\n' ;
192
196
file . contents = new Buffer ( fullFileContents ) ;
193
197
194
198
let indexToStart = 'localizedPackage.json.' . length + 1 ;
0 commit comments