filter.py (2520B)
1 # This Source Code Form is subject to the terms of the Mozilla Public 2 # License, v. 2.0. If a copy of the MPL was not distributed with this 3 # file, You can obtain one at http://mozilla.org/MPL/2.0/. 4 5 """This routine controls which localizable files and entries are 6 reported and l10n-merged. 7 This needs to stay in sync with the copy in mobile/locales. 8 """ 9 10 11 def test(mod, path, entity=None): 12 import re 13 14 # ignore anything but mobile, which is our local repo checkout name 15 if mod not in ("dom", "toolkit", "mobile", "mobile/android"): 16 return "ignore" 17 18 if mod == "toolkit": 19 # keep this file list in sync with jar.mn 20 if path in ( 21 "chrome/global/commonDialogs.properties", 22 "chrome/global/intl.css", 23 "toolkit/branding/brandings.ftl", 24 "toolkit/global/processTypes.ftl", 25 "toolkit/global/resetProfile.ftl", 26 "toolkit/intl/regionNames.ftl", 27 ): 28 return "error" 29 if re.match(r"toolkit/about/[^/]*About.ftl", path): 30 # error on toolkit/about/*About.ftl 31 return "error" 32 if re.match(r"toolkit/about/[^/]*Mozilla.ftl", path): 33 # error on toolkit/about/*Mozilla.ftl 34 return "error" 35 if re.match(r"toolkit/about/[^/]*Rights.ftl", path): 36 # error on toolkit/about/*Rights.ftl 37 return "error" 38 if re.match(r"toolkit/about/[^/]*Compat.ftl", path): 39 # error on toolkit/about/*Compat.ftl 40 return "error" 41 if re.match(r"toolkit/about/[^/]*Support.ftl", path): 42 # error on toolkit/about/*Support.ftl 43 return "error" 44 if re.match(r"toolkit/about/[^/]*Webrtc.ftl", path): 45 # error on toolkit/about/*Webrtc.ftl 46 return "error" 47 if re.match(r"toolkit/about/[^/]*Logging.ftl", path): 48 # error on toolkit/about/*Logging.ftl 49 return "error" 50 return "ignore" 51 52 if mod == "dom": 53 # keep this file list in sync with jar.mn 54 if path in ( 55 "chrome/accessibility/AccessFu.properties", 56 "chrome/dom/dom.properties", 57 ): 58 return "error" 59 return "ignore" 60 61 if mod not in ("mobile", "mobile/android"): 62 # we only have exceptions for mobile* 63 return "error" 64 if mod == "mobile/android": 65 if entity is None: 66 if re.match(r"mobile-l10n.js", path): 67 return "ignore" 68 return "error" 69 70 return "error"