alphagov / govuk-frontend-docs

Technical documentation for GOV.UK Frontend
https://frontend.design-system.service.gov.uk/
36 stars 11 forks source link

Create documentation for localisation - passing translations via JavaScript #196

Closed claireashworth closed 2 years ago

claireashworth commented 2 years ago

What

Documentation is needed for the work which allows users to override hardcoded strings in our component JavaScript (internationalisation) #1708

There are two ways for users of GOV.UK Frontend to pass translations - via data-attributes or via JavaScript. The data-attributes approach will be documented in the Design System website, as the "primary" option for translating component JavaScript.

The second approach (passing translations via JavaScript) is more technical and may be less commonly used - we should document this approach in the Frontend Docs site. This is what this ticket covers.

Why

Who needs to know about this

Tech Writer; Developers

Done when

Documentation approved by subject matter expert as accurately representing what the user needs to do.

vanitabarrett commented 2 years ago

A group of us caught up today to talk about where some of this information might live. We talked about how this is the first time we're really having to include technical information of this depth, so wondered if it was better suited for the Frontend Docs. We kind of already have an example (with the Nunjucks macro options) of showing component-level information in the Design System, so we could follow the same pattern (although we know there are issues with this information being hidden away).

Questions:

Several people noted that this is just the first example of many where we might need to document info like this in the Design System (e.g: JS API work).

Proposal:

Next steps:

vanitabarrett commented 2 years ago

Going to move this into Blocked while the pre-release is out for testing

vanitabarrett commented 2 years ago

I've edited the scope of this card to only apply to localisation documentation we want to add to the Frontend Docs site. There will be a separate card for documentation in the Design System site.

vanitabarrett commented 2 years ago

Moving this back into the Sprint Backlog, as we've only really started the Design System part of the documentation.

domoscargin commented 2 years ago

We've decided that config passed via data attributes should always take precedence over config passed via JavaScript initialisation (https://github.com/alphagov/govuk-frontend/issues/2781). We should consider documenting this somewhere.

claireashworth commented 2 years ago

This has gone for 2i review with another tech writer

claireashworth commented 2 years ago

2i done and approved for publishing