DemocracyClub / UK-Polling-Stations

:earth_africa: A website to help people find their UK polling station
https://wheredoivote.co.uk/
BSD 3-Clause "New" or "Revised" License
33 stars 30 forks source link

Support for a Welsh translation #3133

Open alexdutton opened 3 years ago

alexdutton commented 3 years ago

Overview

Democracy Club has a mandate via the Electoral Commission to provide this service in Welsh.

Django has good translation support, and it is mostly straightforward from a how-to-implement perspective.

We can get the framework in place, and then merge translations later.

I'd recommend we should not assume Welsh is not the only alternative language we will ever support, and design accordingly.

Previous issues for background

134 — Discussion about how to approach having a Welsh translation

244 — Copy edits for Welsh site from April 2016

High-level checklist

Open questions

Site logo

We can either

We can also present both the English and non-English translations in the logo space if we'd prefer, with something like:

{% get_current_language as LANGUAGE_CODE %}
<img src={% static site_logo %}" alt="">
<span class="site-title-en">Where Do I Vote?</span>
{% if LANGUAGE_CODE != "en" %}
<span class="site-title-non-en">{% translate "Where Do I Vote?" %}</span>
{% endif %}

Council names

Do these need translating? I suspect we'd need another column on the council table for translations (probably a hstore for code→text pairs).

To source the translations, we could use this GOV.UK register, but it's about to be deprecated.

We could instead source alternative labels from Wikidata. This would involve:

@chris48s mentioned something in #134 about place names in context, so we'd need to seek advice from a fluent speaker about how to approach this.

Making everything translatable

This may take some rephrasing work, so that the Welsh translations provide a good context for e.g. council names.

I've noticed that the directions processing doesn't do plurals right, so that may need some work.

Language selection

By default, Django pays attention to the Accept-Language header, so will respect the browser's language preferences.

We can also use the set_language redirect view to let a user select an alternative language explicitly. There would be some design work to work out how to present this? (e.g. a drop-down, or "English | Welsh" links in the corner).

alexdutton commented 3 years ago

(Because it's fun and after hours…) here's a first pass for a Wikidata SPARQL query for Welsh council names

The tricky bit will be differentiating authorities from other things that have jurisdiction over an administrative area. Would also need to restrict to things that are still extant.