Skip to content

Duplicate i18n keys in en.json5/cs.json5 break sync-i18n #192

Closed

Description

@kosarko

Problem

Several i18n keys are defined twice in both src/assets/i18n/en.json5 and src/assets/i18n/cs.json5 (line numbers as of clarin-v7 @ 550ec11):

Key en.json5 (1st → 2nd) cs.json5 (1st → 2nd)
admin.update-config.success.save.title 5548 "Configuration Saved" → 5626 "File Saved Successfully" 8323 → 8487
admin.update-config.success.save.message 5550 "{{message}}" → 5627 "{{fileName}} has been updated successfully" 8326 → 8490
admin.update-config.error.save.title 5552 → 5634 (same text) 8329 → 8506
admin.update-config.error.save.message 5554 "Unable to save configuration file. Please check the logs and try again." → 5635 "Could not save {{fileName}}" 8332 → 8509
admin.update-config.file-info.modified 5571 "Last Modified" → 5608 "Modified" 8366 → 8448
item.preview.dc.identifier.other 2632 → 2652 (also duplicated upstream in DSpace dspace-7_x) 3948 → 3979

In JSON5 the last definition wins, so the first entry of each pair is dead. Its text is never shown.

Why it matters

yarn run sync-i18n -t src/assets/i18n/cs.json5 -i, which the PR template asks authors to run, can't tell the two entries apart. It copies the first Czech translation onto the second (the one that takes effect) and adds a misleading TODO Source message changed. This happened in #167, where it silently changed three Czech strings. For example, error.save.message lost its {{fileName}} placeholder. The values were restored by hand there, but every future sync run will mangle them again.

Proposed fix

  • For each pair, remove the first (dead) entry from en.json5 and cs.json5, keeping the one that takes effect today so the UI doesn't change. Check against admin-update-config.component.ts that the kept text fits how the key is used (e.g. error.save.message is called with { fileName }).
  • Optionally, add a duplicate-key check to CI (or to sync-i18n) so new duplicates fail fast.

Activity

  1. added a commit that references this issue on Nov 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions