diff --git a/tests/resources/l10n/localizable.xpi b/tests/resources/l10n/localizable.xpi new file mode 100644 index 0000000..b8fce56 Binary files /dev/null and b/tests/resources/l10n/localizable.xpi differ diff --git a/tests/test_l10n.py b/tests/test_l10n.py index 2bed3cc..f9c5671 100644 --- a/tests/test_l10n.py +++ b/tests/test_l10n.py @@ -17,10 +17,21 @@ def test_unlocalizable(): "Test a package without localization data." l10n.LOCALE_CACHE = {} - _do_test("tests/resources/l10n/unlocalizable.xpi", - l10n.test_xpi, - failure=False, - set_type=PACKAGE_EXTENSION) + output = _do_test("tests/resources/l10n/unlocalizable.xpi", + l10n.test_xpi, + failure=False, + set_type=PACKAGE_EXTENSION) + assert output.notices # Should alert about lack of locales + +def test_localizable(): + "Tests a package with minimal localization data." + + l10n.LOCALE_CACHE = {} + output = _do_test("tests/resources/l10n/localizable.xpi", + l10n.test_xpi, + failure=False, + set_type=PACKAGE_EXTENSION) + assert not output.notices def test_missing(): "Test a package with missing localization entities." diff --git a/validator/testcases/l10ncompleteness.py b/validator/testcases/l10ncompleteness.py index d81b631..8eea0e9 100644 --- a/validator/testcases/l10ncompleteness.py +++ b/validator/testcases/l10ncompleteness.py @@ -103,7 +103,17 @@ def test_xpi(err, package_contents, xpi_package): locales = _get_locales(err, xpi_package); # We need at least a reference and a target. - if len(locales) < 2: + num_locales = len(locales) + if num_locales < 2: + if num_locales == 0: + err.notice(("testcases_l10ncompleteness", + "test_xpi", + "no_locales"), + "Add-on cannot be localized", + "In order to localize this add-on, at least one " + "'locale' entry needs to be present in the chrome." + "manifest file.", + filename="chrome.manifest") return # Use the first locale by default