Closed Bug 1371601 Opened 7 years ago Closed 7 years ago

compare-locales should error on duplicate entries in l10n, warn for en-US

Categories

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

enhancement
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: Pike, Assigned: Pike)

References

Details

Attachments

(2 files)

We don't show anything right now if an entry shows up more than once, we should error for l10n, and warn for en-US.
Blocks: 1372254
Comment on attachment 8881733 [details]
bug 1371601, prep: make variable names for reference entities nicer,

https://reviewboard.mozilla.org/r/152844/#review157980

::: compare_locales/compare.py:480
(Diff revision 1)
> -        checker = getChecker(l10n, reference=ref[0], extra_tests=extra_tests)
> +        checker = getChecker(l10n,
> +                             reference=ref_entities, extra_tests=extra_tests)
>          for action, entity in ar:
>              if action == 'delete':
>                  # missing entity
> -                if isinstance(ref[0][ref[1][entity]], parser.Junk):
> +                if isinstance(ref_entities[ref_map[entity]], parser.Junk):

To make this clearer, how about renaming `entity` to `key` and then:

    entity = ref_entities[ref_map[key]]
    
right after the `for … in`?
Attachment #8881733 - Flags: review?(stas) → review+
Comment on attachment 8881734 [details]
bug 1371601, check for duplicate entities, and duplicate attributes in ftl,

https://reviewboard.mozilla.org/r/152846/#review157982

::: compare_locales/parser.py:321
(Diff revision 1)
> +        found = defaultdict(list)
> +        for entity in entities:
> +            found[entity.key].append(entity)
> +        for entity_list in found.values():
> +            if len(entity_list) > 1:
> +                yield '{} occurs {} times'.format(

If you don't plan to add more data to the reported error/warning here, perhaps also use Counter here?
Attachment #8881734 - Flags: review?(stas) → review+
remote:   https://hg.mozilla.org/l10n/compare-locales/rev/a5d2a6476e667c61fbb8c180df14b2f75f9ef2b1
remote:   https://hg.mozilla.org/l10n/compare-locales/rev/0dcd32f2781955a4b8f63e680af8de4d901497cc

Resolving FIXED, there are a couple of follow-ups for duplicate attributes and message references.
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: