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

Feature: add Welsh localisation #233

Closed
ijdickinson opened this issue Jul 30, 2020 · 1 comment
Closed

Feature: add Welsh localisation #233

ijdickinson opened this issue Jul 30, 2020 · 1 comment

Comments

@ijdickinson
Copy link
Contributor

Allow UKHPI users to select a presentation language, with permitted options en-GB and cy. Switch all copy, in both Rails and the JavaScript code, including error messages and other feedback items to come from a message catalogue. Arrange to have a version of the message catalogue translated into Welsh.

ijdickinson added a commit that referenced this issue Aug 6, 2020
WIP on #233, refactoring all English copy into the `en.yml` message
catalogue, so that it can switched to other locales.
ijdickinson added a commit that referenced this issue Aug 6, 2020
Continuing #233, extracted search results message catalogue items
ijdickinson added a commit that referenced this issue Aug 6, 2020
Continuing #233, extracting text from the Rails comparison page
ijdickinson added a commit that referenced this issue Aug 6, 2020
Continuing to add support for #233, this commit adds a language switcher
element to the secondary navigation bar. The base application controller
now inspects the user's language choice, whether by URL parameter or by
HTTP header, and sets the `I18n.locale` accordingly.
ijdickinson added a commit that referenced this issue Aug 6, 2020
Continuing #233, this commit adds a `lang` param to each of the menu
entries in the main navigation menu, so that if a user selects Welsh on
one page that choice is preserved as they navigate to other pages.

This required adding basic behaviours and state-container objects for
some of the simpler routes (e.g. changelog, landing) and adding a new
route for the `about UKHPI` page, which will have to migrate from the
landing page project.
ijdickinson added a commit that referenced this issue Aug 6, 2020
Part of #233, if we have a name specific to the current locale then use
that, otherwise default to English
ijdickinson added a commit that referenced this issue Aug 6, 2020
Adds the key pieces of `vue-i18n` to the use of Vue for runtime
internationalization. The messages are taken from the existing Rails
message catalogue files (`./config/locales`), which required adding a
YAML loader and configuring webpack to use it.

As proof-of-concept, we translate one table label in a single-location
view.

Issue #233
ijdickinson added a commit that referenced this issue Aug 7, 2020
Continuing #233, this commit moves more of the JavaScript-managed text
into the message catalogue
ijdickinson added a commit that referenced this issue Aug 7, 2020
Ensure that setting the current state of the application in the
navigation bar preserves the current language setting. #233
ijdickinson added a commit that referenced this issue Aug 7, 2020
This commit continues #233 by extracting text from the JavaScript
browse view into the message catalogues
ijdickinson added a commit that referenced this issue Aug 7, 2020
Continuing #233, this commit extracts text from the compare view
ijdickinson added a commit that referenced this issue Aug 10, 2020
Continuing #233, this commit handles more extraction of text into
message catalogues, focussing on the print views
ijdickinson added a commit that referenced this issue Aug 11, 2020
Interim progress on #233: reset the English text back to normal (i.e.
without the `*` marker) so that the tests will pass
ijdickinson added a commit that referenced this issue Aug 11, 2020
Continuing #233, copied the `:en` message catalogue to the `:cy`
catalogue, and added a marker to denote the forthcoming Welsh
translation.
ijdickinson added a commit that referenced this issue Aug 11, 2020
Continuing #233. Since the controllers now detect language based on the
`lang` parameter *or* the HTTP `Accept-language` header, we explicitly
simulate setting the `I18n.locale` in tests
ijdickinson added a commit that referenced this issue Aug 13, 2020
For larger units of copy, we will have a whole-page translation carried
out by the translators. This commit selects an en or cy partial for the
landing page, based on the current locale selection.

Github issue #233
ijdickinson added a commit that referenced this issue Aug 13, 2020
Adding some missing text extractions that were spotted by
@bogdanadrianmarc during PR review

Github issue #233
ijdickinson added a commit that referenced this issue Sep 11, 2020
Continuing progress on #233, this commit imports the Welsh localisation
strings from the translator into the message catalogue.
ijdickinson added a commit that referenced this issue Sep 11, 2020
Further progress on #233 - this commit adds the locale formatting for
D3, so that the x-axis of the indicator graphs is correctly labelled
with Welsh month names in the Welsh locale
ijdickinson added a commit that referenced this issue Sep 18, 2020
This commit addresses feedback from the Welsh translation changes in
issue #233. Specifically, we need to apply Welsh consonant mutations in
some cases. The mechanism this commit adds is possibly more than is
needed for the presenting issue, but we are expecting more mutions to be
needed in future.

This change addresses the feedback that some months should be mutated.
E.g:

    O Mai

should become:

    O Fai
ijdickinson added a commit that referenced this issue Sep 18, 2020
Eleri noticed some instances where word-wrap was wrapping lines
mid-word. #233
ijdickinson added a commit that referenced this issue Sep 25, 2020
This commit contributes to #233 by adding the correct translations for
rising/falling/steady prices on the UKHPI landing page
ijdickinson added a commit that referenced this issue Sep 25, 2020
This commit contributes to #233 by adding the Welsh translation for the
"about UKHPI" page
ijdickinson added a commit that referenced this issue Sep 25, 2020
ijdickinson added a commit that referenced this issue Sep 25, 2020
If appropriate, use the Welsh version of the OGL URL. #233

Also removed old 'about UKHPI' copy
ijdickinson added a commit that referenced this issue Sep 28, 2020
This commit continues #233 by fixing a couple of bugs introduced in the
mutations code:

- the preposition was not being recorded in non-JS HTML when the
  preposition was assumed
- the JS mutations code was incorrectly picking up the Welsh 'in'
  proposition when in English mode
ijdickinson added a commit that referenced this issue Sep 28, 2020
ijdickinson added a commit that referenced this issue Oct 2, 2020
ijdickinson added a commit that referenced this issue Oct 2, 2020
ijdickinson added a commit that referenced this issue Oct 2, 2020
This commit fixes a problem with the Welsh mutations for #233. In
JavaScript, we were not anchoring the regular expression, so the
mutations we being applied incorrectly to names of locations with
multiple capital letters.
ijdickinson added a commit that referenced this issue Oct 2, 2020
…ang-feedback

Further corrections to Welsh lang after feedback. Continues progress on #233
ijdickinson added a commit that referenced this issue Oct 5, 2020
Following feedback from the client, we're updating the abbreviations of
Welsh month names to be spelled out in more detail. #233
ijdickinson added a commit that referenced this issue Oct 6, 2020
This commit addresses the issue of missing Welsh location names in a
more nuanced way. #233

The core problem is that some locations do not have a name in Welsh in
the data (i.e. a lang tag of 'cy'). This may be because:

- the Welsh name and the English name are the same, e.g Gwynedd
- the location is in England, and there is not a standard Welsh name
  for that location. E.g Blackpool

The consequence of the missing Welsh names earlier in the project was
that those local authorities did not render on the map when in Welsh
language mode. This is undesirable for England, Scotland and NI, but
especialy problematic for Wales.

My first fix was to have the language table generator Rake task just
copy the English names to the Welsh name, where it would otherwise have
been missing. This addresses the map issue, but leads to a further
problem: in Welsh, we should mutate the consonants in some situations,
e.g. after prepositions 'o' and 'i'.  The copying fix removes the
distinction between English locations that do not have Welsh names and
those that do, meaning that we can't perform the mutation correctly. A
symptom of this problem is that "yn Blackpool" was mutated to
"ym Mlackpool". This is not correct.

My solution has been to adapt the Rake task to only copy the :en label
to the :cy label *if* the location is in Wales. The consequence of this
is that locations in England, Scotland and NI *may* not have a Welsh
language label. This is a major change of the invariant, because we can
no longer rely on, e.g. `labels[$locale]` to have a value. It does,
however mean that we can distinguish between non-Welsh locations that
have Welsh names (should be mutated) and non-Welsh locations that rely
on re-using the English name (no mutation).

While fixing these issues, I also noticed and addressed a couple of
others:

- missing GSS code for Northern Ireland
- redundant `features.json` file
- incorrect translations in print view

For the sake of simplicity, all of these are addressed in this commit.
ijdickinson added a commit that referenced this issue Oct 7, 2020
Because the "by property type" graphs can have up to five lines, the
mouseover caption needs to be abbreviated. We were not catching these
abbreviations for Welsh translation. #233
ijdickinson added a commit that referenced this issue Oct 7, 2020
@ijdickinson
Copy link
Contributor Author

Done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant