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

Allow users to override hardcoded strings in our component JavaScript (internationalisation) #1708

Closed
25 of 26 tasks
Tracked by #1389
hannalaakso opened this issue Jan 22, 2020 · 4 comments
Closed
25 of 26 tasks
Tracked by #1389
Labels
epic Epics are used in planning project boards to group related stories javascript localisation

Comments

@hannalaakso
Copy link
Member

hannalaakso commented Jan 22, 2020

What

Allow strings in our component JavaScript to be customised/changed, to allow for text in other languages, e.g: Welsh.

Why

Some service teams have a requirement to provide their services in Welsh as well as English (and other teams support a wider range of language translations too). At the moment, service teams are stuck with some elements of the page in English unless they manually copy our JavaScript into their application, which isn't ideal.

Related issues:

This work is also closely related to how we allow users to set and configure JavaScript options. We should keep in mind that it may be simpler to develop a solution for internationalisation that also works for setting all configurable JavaScript options.

Who needs to know about this

Developers; Tech Writer

Done when

Prep & Research

Missing Nunjucks translations

Translating hardcoded strings in JS

Documentation

Stretch Goals

@nataliecarey
Copy link
Contributor

At HMRC we only have one component which requires this, we've implemented it with data- attributes. The Nunjucks component takes arguments for the content and passes them through to the JS via the dom element which gets instantiated.

The component which does this is a pure JS component which is activated by a custom meta tag. https://github.com/hmrc/hmrc-frontend/blob/master/src/components/timeout-dialog/template.njk

I'd suggest that the user of a component shouldn't need to know which content is produced by JS and which isn't. Providing them all via the component parameters is my attempt to achieve that.

@jamesalfei
Copy link

At DVLA, we require frontend component localisation for supporting the welsh language. This is, in most cases, done within our application but on components such as the text area character count, this is done within the GOVUK frontend via Javascript. This means we cannot localise the text on these components.

This issue was present in 2018 when a PR was opened (and subsequently declined) in favour of a more common approach: #1038

This consistent approach across all components will allow localisation and allow us to offer our customers fully internationalised pages, rather than a mix of Welsh and English which we currently have due to this component.

Note, we are fully aware that we can bring the code in-house and modify it to our needs, but this would mean more overhead to keep up to date with the centralised repo. This is something we want to try and avoid if at all possible.

@vanitabarrett vanitabarrett changed the title Have a consistent way of setting JavaScript options on components Allow users to override hardcoded strings in our component JavaScript Mar 1, 2022
@vanitabarrett vanitabarrett changed the title Allow users to override hardcoded strings in our component JavaScript Allow users to override hardcoded strings in our component JavaScript (internationalisation) Mar 1, 2022
@domoscargin
Copy link
Contributor

Re: prioritsation of config passed by data attributes and config passed by JavaScript, we've decided that data attributes should always take precedence over config passed by JavaScript.

#2781

@36degrees
Copy link
Contributor

I'm calling this done – the only unticked items are only tangentially unrelated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
epic Epics are used in planning project boards to group related stories javascript localisation
Projects
None yet
7 participants