Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bridge: Drop translations from manifests.js, introduce m-i18n.js #21516

Merged
merged 2 commits into from
Jan 14, 2025

Conversation

martinpitt
Copy link
Member

Pages don't (shouldn't) care about manifest translations when including
manifests.js -- they usually do that to query for a package's
existence or some feature flags.

Only the Shell cares about the translations. So drop translations from
manifests.js, and support a new manifests-i18n.js which only the
shell uses.

This isolates translations from different pages from another.
Concretely, subscription-manager-cockpit and our systemd page both
translate "$0 important hit" differently, and even to different data
types (in s-m it results in an array, in systemd in a normal string).
This caused a page crash, and also wrong strings, as s-m's translations
are really not expected to be used on the Overview page.

This also speeds up the loading of frames, as they now don't have to go
through umpteen cockpit.locale() calls any more.

Note that this still leaves i18n conflicts in the shell itself, so this
isn't a full fix, just an "80%" mitigation.

Fixes #21486

This doesn't reproduce cockpit-project#21486, but is a good test to have anyway.
Pages don't (shouldn't) care about manifest translations when including
`manifests.js` -- they usually do that to query for a package's
existence or some feature flags.

Only the Shell cares about the translations. So drop translations from
`manifests.js`, and support a new `manifests-i18n.js` which only the
shell uses.

This isolates translations from different pages from another.
Concretely, subscription-manager-cockpit and our systemd page both
translate "$0 important hit" differently, and even to different data
types (in s-m it results in an array, in systemd in a normal string).
This caused a page crash, and also wrong strings, as s-m's translations
are really not expected to be used on the Overview page.

This also speeds up the loading of frames, as they now don't have to go
through umpteen `cockpit.locale()` calls any more.

Note that this still leaves i18n conflicts in the shell itself, so this
isn't a full fix, just an "80%" mitigation.

Fixes cockpit-project#21486
@martinpitt martinpitt marked this pull request as ready for review January 13, 2025 16:31
@martinpitt martinpitt requested a review from jelly January 13, 2025 16:31
@martinpitt
Copy link
Member Author

Meh, NFS regressions on rawhide, twice in a row. Will take a look today.

Copy link
Member

@jelly jelly left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@martinpitt martinpitt merged commit f48fea8 into cockpit-project:main Jan 14, 2025
84 of 87 checks passed
@martinpitt martinpitt deleted the ngettext branch January 14, 2025 08:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

insights status oops in zh-CN and -TW
2 participants