From c0f400a4d99622b99e7f5f748b5f9c4ca17926a2 Mon Sep 17 00:00:00 2001 From: rgarcia Date: Mon, 31 Oct 2016 11:14:05 +0100 Subject: [PATCH] =?UTF-8?q?Adds=20custom=20locale=20name=20for=20Portugu?= =?UTF-8?q?=C3=AAs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/locales_helper.rb | 8 ++++++++ app/views/shared/_locale_switcher.html.erb | 2 +- doc/locales/pt-br.yml | 3 +++ 3 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 app/helpers/locales_helper.rb diff --git a/app/helpers/locales_helper.rb b/app/helpers/locales_helper.rb new file mode 100644 index 000000000..7954cc908 --- /dev/null +++ b/app/helpers/locales_helper.rb @@ -0,0 +1,8 @@ +module LocalesHelper + + def name_for_locale(locale) + default = I18n.t("locale", locale: locale) + I18n.backend.translate(locale, "i18n.language.name", default: default) + end + +end diff --git a/app/views/shared/_locale_switcher.html.erb b/app/views/shared/_locale_switcher.html.erb index f29defcbd..af184fe48 100644 --- a/app/views/shared/_locale_switcher.html.erb +++ b/app/views/shared/_locale_switcher.html.erb @@ -8,7 +8,7 @@ <% I18n.available_locales.map do |loc| %> <% end %> diff --git a/doc/locales/pt-br.yml b/doc/locales/pt-br.yml index 9d2b3ee46..f3159cdc2 100644 --- a/doc/locales/pt-br.yml +++ b/doc/locales/pt-br.yml @@ -1,5 +1,8 @@ --- pt-BR: + i18n: + language: + name: Português account: show: change_credentials_link: Alterar meus dados pessoais