@@ -42,8 +42,8 @@ export class ConverterIOS extends ConverterCommon {
42
42
const languageResourcesDir = path . join ( this . appResourcesDirectoryPath , `${ language } .lproj` ) ;
43
43
this
44
44
. createDirectoryIfNeeded ( languageResourcesDir )
45
- . writeStrings ( languageResourcesDir , "Localizable.strings" , i18nEntries , true )
46
- . writeStrings ( languageResourcesDir , "InfoPlist.strings" , infoPlistStrings , false )
45
+ . writeStrings ( languageResourcesDir , "Localizable.strings" , i18nEntries )
46
+ . writeStrings ( languageResourcesDir , "InfoPlist.strings" , infoPlistStrings )
47
47
;
48
48
if ( isDefaultLanguage ) {
49
49
infoPlistStrings . set ( "CFBundleDevelopmentRegion" , language ) ;
@@ -52,15 +52,24 @@ export class ConverterIOS extends ConverterCommon {
52
52
return this ;
53
53
}
54
54
55
+ private encodeI18nEntries ( i18nEntries : I18nEntries ) : I18nEntries {
56
+ const encodedI18nEntries : I18nEntries = new Map ( ) ;
57
+ i18nEntries . forEach ( ( value , key ) => {
58
+ const encodedKey = encodeKey ( key ) ;
59
+ const encodedValue = encodeValue ( value ) ;
60
+ encodedI18nEntries . set ( encodedKey , encodedValue ) ;
61
+ } ) ;
62
+ return encodedI18nEntries ;
63
+ }
64
+
55
65
private writeStrings (
56
66
languageResourcesDir : string ,
57
67
resourceFileName : string ,
58
- strings : I18nEntries ,
59
- encodeKeys : boolean
68
+ i18nEntries : I18nEntries ,
60
69
) : this {
61
70
let content = "" ;
62
- strings . forEach ( ( value , key ) => {
63
- content += `"${ encodeKeys ? encodeKey ( key ) : key } " = "${ encodeValue ( value ) } ";\n` ;
71
+ this . encodeI18nEntries ( i18nEntries ) . forEach ( ( encodedValue , encodedKey ) => {
72
+ content += `"${ encodedKey } " = "${ encodedValue } ";\n` ;
64
73
} ) ;
65
74
const resourceFilePath = path . join ( languageResourcesDir , resourceFileName ) ;
66
75
this . writeFileSyncIfNeeded ( resourceFilePath , content ) ;
0 commit comments