Bug 1708422: part 17) Rename `words` to `normalizedWords` in `mozInlineSpellChecker...
[gecko.git] / mobile / locales / filter.py
blobb5d7c260ea15076614afe5914da61cfc6d71728d
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/.
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/android/locales.
8 """
10 from __future__ import absolute_import
13 def test(mod, path, entity=None):
14 import re
16 # ignore anything but mobile, which is our local repo checkout name
17 if mod not in ("dom", "toolkit", "mobile", "mobile/android/base", "mobile/android"):
18 return "ignore"
20 if mod == "toolkit":
21 # keep this file list in sync with jar.mn
22 if path in (
23 "chrome/global/aboutReader.properties",
24 "chrome/global/commonDialogs.properties",
25 "chrome/global/intl.properties",
26 "chrome/global/intl.css",
28 return "error"
29 if re.match(r"crashreporter/[^/]*.ftl", path):
30 # error on crashreporter/*.ftl
31 return "error"
33 if re.match(r"toolkit/about/[^/]*About.ftl", path):
34 # error on toolkit/about/*About.ftl
35 return "error"
36 if re.match(r"toolkit/about/[^/]*Mozilla.ftl", path):
37 # error on toolkit/about/*Mozilla.ftl
38 return "error"
39 if re.match(r"toolkit/about/[^/]*Plugins.ftl", path):
40 # error on toolkit/about/*Plugins.ftl
41 return "error"
42 if re.match(r"toolkit/about/[^/]*Rights.ftl", path):
43 # error on toolkit/about/*Rights.ftl
44 return "error"
45 if re.match(r"toolkit/about/[^/]*Compat.ftl", path):
46 # error on toolkit/about/*Compat.ftl
47 return "error"
48 if re.match(r"toolkit/about/[^/]*Support.ftl", path):
49 # error on toolkit/about/*Support.ftl
50 return "error"
51 if re.match(r"toolkit/about/[^/]*Webrtc.ftl", path):
52 # error on toolkit/about/*Webrtc.ftl
53 return "error"
54 return "ignore"
56 if mod == "dom":
57 # keep this file list in sync with jar.mn
58 if path in (
59 "chrome/global.dtd",
60 "chrome/accessibility/AccessFu.properties",
61 "chrome/dom/dom.properties",
62 "chrome/plugins.properties",
64 return "error"
65 return "ignore"
67 if mod not in ("mobile", "mobile/android"):
68 # we only have exceptions for mobile*
69 return "error"
70 if mod == "mobile/android":
71 if entity is None:
72 if re.match(r"mobile-l10n.js", path) or re.match(r"defines.inc", path):
73 return "ignore"
74 if path == "defines.inc":
75 if entity == "MOZ_LANGPACK_CONTRIBUTORS":
76 return "ignore"
77 return "error"
79 # we're in mod == "mobile"
80 if path == "chrome/region.properties":
81 # only region.properties exceptions remain
82 if (
83 re.match(r"browser\.contentHandlers\.types\.[0-5]", entity)
84 or re.match(r"gecko\.handlerService\.schemes\.", entity)
85 or re.match(r"gecko\.handlerService\.defaultHandlersVersion", entity)
86 or re.match(r"browser\.suggestedsites\.", entity)
88 return "ignore"
90 return "error"