ONSdigital / sdg-theme

Jekyll Theme for Sustainable Development Goals website
MIT License
2 stars 7 forks source link

Multilingual support #2

Open brockfanning opened 6 years ago

brockfanning commented 6 years ago

This PR was created to propose multilingual functionality. However, additional tweaks and improvements have been added. Here is a list of everything included in this PR:

  1. Replacing words/phrases with variable references
  2. A multilingual.html include to set various variables to be used throughout the platform
  3. A language-toggle for the nav bar, and associated styling
    • Included is a tweak to the accessibility toggle on mobile - only one of the 2 accessibility buttons will display on mobile. This was to make room for the mobile language switcher.
  4. Mechanism for javascript translation
  5. Includes code from a few PRs that were submitted to the sdg-indicators repo, including:
  6. A couple of improvements that were made in sdg-indicators after this repository was created:
    • Indicator sorting with the indicator_sort_order field
    • HTML map embedding with the embedded_map_html field
  7. Allows for control of the main navigation through the _config.yml file.
  8. Hides empty metadata fields and graph footer items on indicator pages
  9. On indicator pages, display the goal title in the H1, rather than duplicating the indicator title which is also in the H2.
  10. To allow for custom chart types:
    • does not require either "line" or "bar", and instead allows any chart type
    • allow for overrides of Chart.js configuration, based on the existence of a global variable
    • include an example of a custom Chart.js type: "binary" (for yes/no graphs)
  11. First draft of some documentation (docs folder)

The multilingual functionality relies on a "translations" object in the site data, which is fed by an external data source built by the sdg-translations repository. Here is an example from config.yml that accomplishes that.

More details are here: https://github.com/ONSdigital/sdg-indicators/issues/2807

brockfanning commented 6 years ago

I've edited this PR's description, as it now may be suitable for merging. Though, it's admittedly a very large PR.

brockfanning commented 6 years ago

FYI, this PR includes both of the functionality changes that were added to sdg-indicators after the point that this repository was created:

  1. Indicator sorting with the indicator_sort_order field
  2. HTML map embedding with the embedded_map_html field
brockfanning commented 6 years ago

@dougmet Thanks for moving this repository over. Not sure if you're available for any code reviews or testing - but just in case - calling your attention to this PR. A working example is available here. No worries if you are otherwise occupied! :)

Norric1Admin commented 6 years ago

@shaneporter Please could you give me admin access to this repo, so I can merge Brock's pull request? Many thanks, Chris (ONS SDGs team)

shaneporter commented 6 years ago

Is this something you can help with @dougmet? Cheers.

dougmet commented 5 years ago

Hi @brockfanning @shaneporter I'll do my best.

dougmet commented 5 years ago

Hi @Norric1Admin . After the transfer I needed someone from ONSdigital to make me an admin but never got it. Probably not appropriate now for me so will see who I can contact.

Norric1Admin commented 5 years ago

@brockfanning Is the sdg-theme repo still used for anything, or can this be deleted?