Closed Bug 672031 Opened 13 years ago Closed 7 years ago

[compare-locales] Warn when the plural form count doesn't match the expected count for the locale

Categories

(Localization Infrastructure and Tools :: compare-locales, enhancement)

enhancement
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: florian, Assigned: Pike)

References

Details

Attachments

(4 files)

New translators sometimes don't understand well how the localized plurals work and it's frequent to see them put only 2 plural forms for a locale that needs more.

And for experimented translators, forgetting a plural form is probably a common inattention mistake.
Depends on: 1415842
Summary: compare-locales should warn when the plural form count doesn't match the expected count for the locale → [compare-locales] Warn when the plural form count doesn't match the expected count for the locale
Component: Infrastructure → compare-locales
Product: Mozilla Localizations → Localization Infrastructure and Tools
Assignee: nobody → l10n
... funny how pluralRule in intl.properties is also checked by the plurals checker ... and generates warnings and errors, depending on  locale.
flod, what's your take on error vs warning?

Lack of plural variants could just be a warning, as we're using the first?
Should we make excess variants a warning, or an error?
Flags: needinfo?(francesco.lodolo)
Ideally:
* Excess of variants: warning. You're not breaking anything, you have a form that doesn't get used. In most cases there's an extra semicolon at the end, or it's a locale with 1 form following English, both easy to fix.
* Lack of variants: error. You're generating errors in console, and likely have some poor translations.

There are two concerns in considering lack of variants an error:
* devtools: if locales with more than 2 plural forms copy over English text, they'll get errors.
* we still have a ton of them (257, they were in the 400 a few weeks back), and it might hurt us.

So, we might have to go with warning also for lack of variants.
Flags: needinfo?(francesco.lodolo)
Comment on attachment 8936361 [details]
bug 672031, pass locale to Checker,

https://reviewboard.mozilla.org/r/207078/#review213076
Attachment #8936361 - Flags: review?(francesco.lodolo) → review+
Comment on attachment 8936362 [details]
bug 672031, factor plurals check in properties to distinct method,

https://reviewboard.mozilla.org/r/207080/#review213078
Attachment #8936362 - Flags: review?(francesco.lodolo) → review+
Comment on attachment 8936363 [details]
bug 672031, add check for plural forms,

https://reviewboard.mozilla.org/r/207082/#review213072

I feel like we should raise a warning if the locale is not available in plurals, not sure where though (definitely not for each string we parse)

::: compare_locales/checks.py:113
(Diff revision 1)
> +            found_forms = l10nValue.count(';') + 1
> +            msg = 'expecting {} plurals, found {}'.format(
> +                expected_forms,
> +                found_forms
> +            )
> +            if expected_forms > found_forms:

This should be only one if

if expected_forms != found_forms:
    yield ('warning', 0, msg, 'plural')
Attachment #8936363 - Flags: review?(francesco.lodolo) → review+
Comment on attachment 8936363 [details]
bug 672031, add check for plural forms,

https://reviewboard.mozilla.org/r/207082/#review213072

Will add an integration test suite to be run via tox and in automation.

As it depends on an external service, I'd rather not do that as part of the regular tests, though.

> This should be only one if
> 
> if expected_forms != found_forms:
>     yield ('warning', 0, msg, 'plural')

I left it like this so that we can more easily switch either case from warning to error if we decide to do so.
(In reply to Axel Hecht [:Pike] from comment #10)
> I left it like this so that we can more easily switch either case from
> warning to error if we decide to do so.

Ah, that makes more sense now.
Comment on attachment 8936363 [details]
bug 672031, add check for plural forms,

https://reviewboard.mozilla.org/r/207082/#review213072

Good call, the plural form for Occitan was out of sync :-).
https://hg.mozilla.org/l10n/compare-locales/rev/f2a6a6f2cb6f295b19d438c8e890198630511d06 landed the fix, rebased on top of that.
https://hg.mozilla.org/l10n/compare-locales/pushloghtml?changeset=caffef49b18c, FIXED.
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: