Created
October 1, 2014 14:37
-
-
Save pascalchevrel/7906edeb30e63f2e9506 to your computer and use it in GitHub Desktop.
patch to import the Legal string
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/classes/Langchecker/LangManager.php b/classes/Langchecker/LangManager.php | |
index ce450ad..bdebe36 100644 | |
--- a/classes/Langchecker/LangManager.php | |
+++ b/classes/Langchecker/LangManager.php | |
@@ -385,4 +385,16 @@ class LangManager | |
return $result; | |
} | |
+ | |
+ public static function importTransvisionEntity($repository, $english, $entity) | |
+ { | |
+ $API = 'http://transvision-beta.mozfr.org/api/v1/entity/' . $repository . '/?id=' . $entity; | |
+ $translations = array_filter(json_decode(file_get_contents($API), true)); | |
+ $return_array = []; | |
+ foreach ($translations as $locale => $translation) { | |
+ $return_array[$locale] = [$english => $translation]; | |
+ } | |
+ | |
+ return $return_array; | |
+ } | |
} | |
diff --git a/scripts/lang_update b/scripts/lang_update | |
index 913c73b..1d05ea9 100755 | |
--- a/scripts/lang_update | |
+++ b/scripts/lang_update | |
@@ -79,6 +79,8 @@ foreach ($file_list as $current_filename) { | |
$result = ''; | |
+ $transvision_api = LangManager::importTransvisionEntity('aurora', 'Legal', 'mobile/android/base/sync_strings.dtd:fxaccount_status_legal'); | |
+ | |
foreach ($locale_list as $current_locale) { | |
// For each locale, load existing locale file | |
$locale_data = LangManager::loadSource($current_website, $current_locale, $current_filename); | |
@@ -96,6 +98,17 @@ foreach ($file_list as $current_filename) { | |
// $temp_data = LangManager::loadSource($lang_based_sites[0], $current_locale, 'main.lang'); | |
// $locale_data['strings'] = array_merge($locale_data['strings'], $temp_data['strings']); | |
+ if (isset($transvision_api[$current_locale])) { | |
+ foreach($transvision_api[$current_locale] as $k => $v) { | |
+ if (! isset($locale_data['strings'][$k])) { | |
+ $locale_data['strings'][$k] = $v; | |
+ continue; | |
+ } | |
+ if ($locale_data['strings'][$k] == $k) { | |
+ $locale_data['strings'][$k] = $v; | |
+ } | |
+ } | |
+ } | |
// Exceptions are managed in LangManager::manageStringExceptions | |
$content = LangManager::buildLangFile($reference_data, $locale_data, $current_locale, $eol); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment