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

Add translations for all govuk components #814

Merged
merged 4 commits into from
Jul 28, 2016

Conversation

NickColley
Copy link
Contributor

Continues the work done in #505

Moves the language translation config files back into the conventional place rather than in the view directory.

@@ -24,14 +24,15 @@ def govuk_component_docs
end

def govuk_available_locales
locale_files = Rails.root.join('app', 'views', 'locales', '*.yml')
locale_files = Rails.root.join("config", "locales", "*.yml")
locales = Dir[locale_files].map { |file| File.basename(file, '.yml') }
render :json => locales
end

def govuk_locales
return error_404 unless params[:locale].match(/^[a-z]{2}(-[a-z0-9]{2,3})?$/)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That regular expression will allow something like pt-p1p, which ISO-639 are we using and which ISO is that regex trying to accommodate?

https://en.wikipedia.org/wiki/ISO_639

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not familiar with the internals of the i18n for Rails so not sure, this seems like a sanity check but maybe something like https://github.com/tigrish/iso#tags would be more appropriate.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a bit of a mixture of ISO-639 standards and one or two non-standard locales. I think this is reasonable as a simple check.

@gpeng gpeng merged commit e8a0dbf into master Jul 28, 2016
@gpeng gpeng deleted the Add-translations-for-all-GOVUK-Components branch July 28, 2016 16:34
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

Successfully merging this pull request may close these issues.

3 participants