|
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/android/locales. |
|
8 """ |
|
9 |
|
10 def test(mod, path, entity = None): |
|
11 import re |
|
12 # ignore anything but mobile, which is our local repo checkout name |
|
13 if mod not in ("netwerk", "dom", "toolkit", "security/manager", |
|
14 "services/sync", "mobile", |
|
15 "mobile/android/base", "mobile/android"): |
|
16 return "ignore" |
|
17 |
|
18 if mod not in ("mobile", "mobile/android"): |
|
19 # we only have exceptions for mobile* |
|
20 return "error" |
|
21 if mod == "mobile/android": |
|
22 if not entity: |
|
23 if (re.match(r"mobile-l10n.js", path) or |
|
24 re.match(r"defines.inc", path)): |
|
25 return "ignore" |
|
26 if path == "defines.inc": |
|
27 if entity == "MOZ_LANGPACK_CONTRIBUTORS": |
|
28 return "ignore" |
|
29 return "error" |
|
30 |
|
31 # we're in mod == "mobile" |
|
32 if re.match(r"searchplugins\/.+\.xml", path): |
|
33 return "ignore" |
|
34 if path == "chrome/region.properties": |
|
35 # only region.properties exceptions remain |
|
36 if (re.match(r"browser\.search\.order\.[1-9]", entity) or |
|
37 re.match(r"browser\.contentHandlers\.types\.[0-5]", entity) or |
|
38 re.match(r"gecko\.handlerService\.schemes\.", entity) or |
|
39 re.match(r"gecko\.handlerService\.defaultHandlersVersion", entity)): |
|
40 return "ignore" |
|
41 |
|
42 return "error" |