diff --git a/app/javascript/lang/index.js b/app/javascript/lang/index.js index 0009be25..5b03d723 100644 --- a/app/javascript/lang/index.js +++ b/app/javascript/lang/index.js @@ -6,7 +6,11 @@ Vue.use(VueI18n) const localeEn = require('../../../config/locales/en.yml') const localeCy = require('../../../config/locales/cy.yml') +// The locale is passed via the window.ukhpi structure +// directly from Rails +const currentLocale = window.ukhpi.locale || 'en' + export default new VueI18n({ - locale: 'en', + locale: currentLocale, messages: { ...localeEn, ...localeCy } }) diff --git a/app/views/layouts/webpack_application.html.haml b/app/views/layouts/webpack_application.html.haml index 32758f52..e42a6639 100644 --- a/app/views/layouts/webpack_application.html.haml +++ b/app/views/layouts/webpack_application.html.haml @@ -11,6 +11,7 @@ window.ukhpi = window.ukhpi || {}; window.ukhpi.environment = '#{ENV["DEPLOYMENT_ENVIRONMENT"] || Rails.env}'; window.ukhpi.version = '#{Version::VERSION}'; + window.ukhpi.locale = '#{I18n.locale}'; = stylesheet_link_tag 'application', media: 'all' = csrf_meta_tags diff --git a/config/locales/cy.yml b/config/locales/cy.yml index e457adfd..2cccc022 100644 --- a/config/locales/cy.yml +++ b/config/locales/cy.yml @@ -132,6 +132,12 @@ cy: js: action: download: "# Download this data" + data_graph: "# See data graph" + data_table: "# See data table" + compare: "# Compare with location ..." + + graph: + no_data: "# Sorry, there is no %{label} data available for %{location}. Please select a different location." # old-------------