Repository navigation
Translate plugin settingsSchema labels the same way as admin page labels #3965
mohammadhosry
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Problem
Native plugins can already localize their admin page labels.
resolvePluginPageLabel(packages/admin/src/components/Sidebar.tsx) runs each declared label through the shared Lingui instance, so a plugin that loads its own catalog, as the React admin docs describe, gets translated sidebar and command-palette items.The auto-generated settings form does not do this.
SettingFieldInputinpackages/admin/src/components/PluginSettings.tsxrendersfield.label,field.description,field.placeholderand select option labels as they are, with this comment:Page labels are localized, though, so the comment and the behaviour disagree.
The result: on an Arabic admin (and soon Hebrew), a plugin's own pages can be fully translated while its Settings page stays in English. The only workaround today is to drop
settingsSchemaand hand-build a settings page with get and save routes, which duplicates what the auto-form already does.Proposal
Pass settings-schema strings through the same translation step as page labels:
label,description,placeholderand select option labels, with the English text as the message ID. Plugins without a catalog see no change, because a missing ID falls back to the literal string. Then update the comment above and the translation section of the React admin docs to say settings labels are covered.Open question
Lingui treats a missing ID as a message, so a label containing
{…}would be read as a placeholder. Page labels already have this behaviour. Should settings strings be escaped, or is documenting it enough?If this direction works for you, I'm happy to open the PR with tests.
All reactions