1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/mobile/locales/filter.py Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,42 @@ 1.4 +# This Source Code Form is subject to the terms of the Mozilla Public 1.5 +# License, v. 2.0. If a copy of the MPL was not distributed with this 1.6 +# file, You can obtain one at http://mozilla.org/MPL/2.0/. 1.7 + 1.8 +"""This routine controls which localizable files and entries are 1.9 +reported and l10n-merged. 1.10 +This needs to stay in sync with the copy in mobile/android/locales. 1.11 +""" 1.12 + 1.13 +def test(mod, path, entity = None): 1.14 + import re 1.15 + # ignore anything but mobile, which is our local repo checkout name 1.16 + if mod not in ("netwerk", "dom", "toolkit", "security/manager", 1.17 + "services/sync", "mobile", 1.18 + "mobile/android/base", "mobile/android"): 1.19 + return "ignore" 1.20 + 1.21 + if mod not in ("mobile", "mobile/android"): 1.22 + # we only have exceptions for mobile* 1.23 + return "error" 1.24 + if mod == "mobile/android": 1.25 + if not entity: 1.26 + if (re.match(r"mobile-l10n.js", path) or 1.27 + re.match(r"defines.inc", path)): 1.28 + return "ignore" 1.29 + if path == "defines.inc": 1.30 + if entity == "MOZ_LANGPACK_CONTRIBUTORS": 1.31 + return "ignore" 1.32 + return "error" 1.33 + 1.34 + # we're in mod == "mobile" 1.35 + if re.match(r"searchplugins\/.+\.xml", path): 1.36 + return "ignore" 1.37 + if path == "chrome/region.properties": 1.38 + # only region.properties exceptions remain 1.39 + if (re.match(r"browser\.search\.order\.[1-9]", entity) or 1.40 + re.match(r"browser\.contentHandlers\.types\.[0-5]", entity) or 1.41 + re.match(r"gecko\.handlerService\.schemes\.", entity) or 1.42 + re.match(r"gecko\.handlerService\.defaultHandlersVersion", entity)): 1.43 + return "ignore" 1.44 + 1.45 + return "error"