-
Notifications
You must be signed in to change notification settings - Fork 334
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
Character Count 'count message' cannot be customised or translated #1681
Comments
Have there been any developments on this issue recently? We need to be able to supply a version of this component with the message translated to Welsh and this is not currently possible. |
The HMRC approach is to have Being able to set the text directly would be another solution but it de-centralises the default text in Welsh. If you need Welsh content provided I'm sure HMRC can help. |
Hi Matthew, Unfortunately at the minute we don't have a solution for localisation / internationalisation. For now, we suggest that you copy the Javascript for this component into your service's codebase and make the adjustments required for the service you’re working on. |
If we raise a PR to allow this content to be set would that be appropriate? That feels consistent with the other components. Edit for clarity: I'm talking about the user specifying whatever content they want to replace phrases like "You can enter up to" - in our use-case we'd put in the Welsh translation |
@natcarey We're going to need to consider internalisation/localisation as part of a wider piece of work to ensure the approach will work for all Javascript components including more complex ones in the future. This is related to #1708 and #1722. So for now we won't be able to accept a contribution on this but thanks so much for offering to work on it, it's much appreciated 🙌 If you wanted to leave any thoughts on either of the above linked issues please feel free to do so. |
Thanks, I'll take a look at those other issues. |
Application Platform Services also have the need for this to be translatable for applications such as the SA-Filing years where a Welsh equivalent of the app is a requirement. |
The solution will need to be able to accurately count characters and not bytes. The GDS Notify team recently updated their internal character counting to more accurately reflect the number of non English characters, so might be worth chatting with @quis ? |
Another +1 for this. Can we get this fixed without having to wait for an entire internationalisation design review? Even just exposing a js variable with a stringformat for the message would be an improvement - then at least our apps can override the text without having to fork the entire project. It would be hacky, yes, but still better than the current situation. |
We do not currently have a way to pass configuration variables into a component, other than through data attributes. Can you expand on what you mean by a stringformat? Do you have an example of what that might look like? |
Actually data attributes should be fine. If we can pass a template in as an attribute, and the js can evaluate that instead of building its own hard-coded string, then we're good. E.g. we could pass |
Hello, any progress on this issue? If not, do you recommend copying the CharacterCount code into application codebase and make the the required changes? |
@girishkamat We’re currently preparing for this work but cannot unfortunately give a timeline. For now, we suggest that you copy the Javascript for this component into your service’s codebase and make the adjustments required for the service you’re working on. Thanks for your patience. |
Hi all, This has been completed as part of our work on localisation and should be available in an upcoming release. Thanks for your feedback (and patience!) |
The Character Count contains hardcoded English strings in both the template:
govuk-frontend/src/govuk/components/character-count/template.njk
Line 29 in 12f0d6c
… and the JavaScript:
govuk-frontend/src/govuk/components/character-count/character-count.js
Lines 147 to 159 in 12f0d6c
This means this text cannot be customised or translated (for example into Welsh) without forking the JavaScript for the component.
The text was updated successfully, but these errors were encountered: