-
Notifications
You must be signed in to change notification settings - Fork 23
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
Allow users to provide translations for hardcoded content in components #404
Comments
In the latest version of the pattern library you can configure translations for Sortable table when initialised with JavaScript: new MOJFrontend.SortableTable({
table: $table,
statusMessage: 'Trefnu yn ôl %heading% (%direction%)',
ascendingText: 'esgynnol',
descendingText: 'disgynnol',
}); However, this isn't documented, isn't very flexible, and isn't consistent with other components Components which still have English hard-coded:
Components where you can override the translation, but it's not consistent:
Other links:
|
Wow, well, that's handy to know I suppose. As you say, wish it was a bit easier to find that out! My service uses the multi-select as well so I guess that's still something to fix 😅 Thanks for the response 👍 |
Upstream Design System now has guidance for localisation so we can follow their lead. |
Summary
Allow english text provided by javascript to be customised or changed (for translation).
Motivation
During an accessibility audit we had the following issue raised.
The text is provided by the JS from MOJ frontend. Currently there is no functionality to support other languages.
Describe alternatives you've considered
I have made this change manually for our service in our copy of minified MOJ frontend. This is the only workaround available.
hmrc/agent-permissions-frontend#194
Ideally, users of MOJ frontend would have the capability to provide customised context for any strings used in messages.
Additional context
In different projects alternative languages are configured in different ways. HMRC Digital's platform is built with Scala/Play framework so typically content is defined in
messages
andmessages.cy
files.But govuk-frontend has been working on a similar issue with their JS alphagov/govuk-frontend#1708
The text was updated successfully, but these errors were encountered: