From cb3061b43f357e2fb57b14bd5fb5060875c1f128 Mon Sep 17 00:00:00 2001 From: Alexey Gerasimov Date: Mon, 23 Apr 2018 19:48:32 +0300 Subject: [PATCH 1/2] Base language substitution added --- xcode/aux_scripts/import_strings.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/xcode/aux_scripts/import_strings.php b/xcode/aux_scripts/import_strings.php index 14050c9..fa97433 100644 --- a/xcode/aux_scripts/import_strings.php +++ b/xcode/aux_scripts/import_strings.php @@ -10,18 +10,21 @@ $localization = './'.$PROJECT_NAME.'/Resources/Localization/'; + $baseFile = file_get_contents(array_pop(glob($COMMON_STRINGS_PATH.'/default*.json'))); + $baseJson = json_decode($baseFile, true); + foreach (glob($COMMON_STRINGS_PATH.'/*.json') as $file) { $languageName = array_pop(explode('_', basename($file, '.json'))); $isBase = strpos($file, 'default') !== false; $jsonFile = file_get_contents($file); - $json = json_decode($jsonFile); + $json = array_merge($baseJson, json_decode($jsonFile, true)); $ios_strings = ""; foreach ($json as $key=>$value) { $ios_strings.='"'.$key.'" = "'.str_replace('%s', '%@', str_replace('"','\"', str_replace("\n", '\n', $value))).'";'.PHP_EOL; } - $ios_strings = preg_replace('/(\\\\)(u)(\d{4})/', '$1U$3', $ios_strings); + $ios_strings = preg_replace('/(\\\\)(u)([0-9a-fA-F]{4})/', '$1U$3', $ios_strings); $lproj = $localization.$languageName.'.lproj/'; createFolder($lproj); From fd49e41c55515b2536b9efcc4ae328775ac37987 Mon Sep 17 00:00:00 2001 From: Alexey Gerasimov Date: Mon, 23 Apr 2018 20:02:34 +0300 Subject: [PATCH 2/2] Indentation fixed --- xcode/aux_scripts/import_strings.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xcode/aux_scripts/import_strings.php b/xcode/aux_scripts/import_strings.php index fa97433..b314468 100644 --- a/xcode/aux_scripts/import_strings.php +++ b/xcode/aux_scripts/import_strings.php @@ -11,7 +11,7 @@ $localization = './'.$PROJECT_NAME.'/Resources/Localization/'; $baseFile = file_get_contents(array_pop(glob($COMMON_STRINGS_PATH.'/default*.json'))); - $baseJson = json_decode($baseFile, true); + $baseJson = json_decode($baseFile, true); foreach (glob($COMMON_STRINGS_PATH.'/*.json') as $file) { $languageName = array_pop(explode('_', basename($file, '.json')));