Bug 1413985 - Package .ftl files on repackage for both, source and AB_CD locales. r?glandium draft
authorZibi Braniecki <zbraniecki@mozilla.com>
Thu, 02 Nov 2017 12:10:26 -0700
changeset 693943 bc7e9c5b19a93216bdc5a79a9a5bbc4ddff36387
parent 693830 c2fe4b3b1b930b3e7fdb84eae44cec165394f322
child 739211 23f5240d3a3d0efac8cf1f773931fc8195f881e4
push id87995
push userbmo:gandalf@aviary.pl
push dateTue, 07 Nov 2017 06:44:08 +0000
reviewersglandium
bugs1413985
milestone58.0a1
Bug 1413985 - Package .ftl files on repackage for both, source and AB_CD locales. r?glandium When repackaging, we want to take all localization resources from the source package, and add all localization resources from the repackage target locale. This patch makes packager.l10n scan for `localization` directories in l10n_finder and add them. MozReview-Commit-ID: CRLP3bOAyDx
python/mozbuild/mozpack/packager/l10n.py
--- a/python/mozbuild/mozpack/packager/l10n.py
+++ b/python/mozbuild/mozpack/packager/l10n.py
@@ -211,16 +211,22 @@ def _repack(app_finder, l10n_finder, cop
 
     # Add any remaining non chrome files.
     for pattern in non_chrome:
         for base in bases:
             for p, f in l10n_finder.find(mozpath.join(base, pattern)):
                 if not formatter.contains(p):
                     formatter.add(p, f)
 
+    # Resources in `localization` directories are packaged from the source and then
+    # if localized versions are present in the l10n dir, we package them as well
+    # keeping the source dir resources as a runtime fallback.
+    for p, f in l10n_finder.find('**/localization'):
+        formatter.add(p, f)
+
     # Transplant jar preloading information.
     for path, log in app_finder.jarlogs.iteritems():
         assert isinstance(copier[path], Jarrer)
         copier[path].preload([l.replace(locale, l10n_locale) for l in log])
 
 
 def repack(source, l10n, extra_l10n={}, non_resources=[], non_chrome=set()):
     '''