Skip to content

Commit

Permalink
Show languages in switcher in their locale
Browse files Browse the repository at this point in the history
It is better to show the language option in the readers language as they
then have a better chance of recognising it.

Only show language options that we have started translating the system
into. The hebrew and korean are just extracted from surveyor at the
moment.
  • Loading branch information
pkqk committed Oct 22, 2015
1 parent dedbfbe commit a8057ef
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 12 deletions.
6 changes: 3 additions & 3 deletions app/helpers/application_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,8 @@ def jurisdiction_options_for_select(default=nil)
end

def locale_options_for_select(selected=nil)
locales = I18n.available_locales.each_with_object({}) do |locale, memo|
memo[t("locales.#{locale}")] = locale
locales = ::LANGUAGES.each_with_object({}) do |locale, memo|
memo[t("locales.#{locale}", locale: locale)] = locale
end
options_for_select(locales, selected)
end
Expand All @@ -117,7 +117,7 @@ def certificate_locale_links(jurisdiction)
return unless locales.present?

links = locales.map do |locale|
locale_name = I18n.translate("locales.#{locale}")
locale_name = I18n.translate("locales.#{locale}", locale: locale)

if locale == I18n.locale.to_s
content_tag(:div, locale_name, class: 'badge badge-inverse')
Expand Down
1 change: 1 addition & 0 deletions config/initializers/locales.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@
I18n.fallbacks.map('fr' => 'en')

JURISDICTION_LANGS = YAML.load_file('surveys/translations/jurisdiction_languages.yml')
LANGUAGES = JURISDICTION_LANGS.map(&:last).flatten.uniq.sort
4 changes: 2 additions & 2 deletions config/locales/website_cs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ cs:
user:
short_name: Krátká forma jména nebo přezdívka
locales:
en: angličtina
cs: čeština
cs: Čeština
en: Angličtina
interface:
select: "Vyberte si…"
5 changes: 3 additions & 2 deletions config/locales/website_de.yml
Original file line number Diff line number Diff line change
Expand Up @@ -432,8 +432,9 @@ de:
short_name: Short name or preferred way of being addressed

locales:
en: English
cs: Czech
cs: Tschechisch
de: Deutsch
en: Englisch

interface:
select: "Please select…"
4 changes: 2 additions & 2 deletions config/locales/website_el.yml
Original file line number Diff line number Diff line change
Expand Up @@ -432,8 +432,8 @@ el:
short_name: Short name or preferred way of being addressed

locales:
en: English
cs: Czech
el: Ελληνικά
en: Αγγλικά

interface:
select: "Please select…"
7 changes: 6 additions & 1 deletion config/locales/website_en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -462,9 +462,14 @@ en:
short_name: Short name or preferred way of being addressed

locales:
en: English
cs: Czech
de: German
el: Greek
en: English
es: Spanish
it: Italian
ro: Romanian
zh: Chinese

interface:
select: "Please select…"
7 changes: 7 additions & 0 deletions config/locales/website_es.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
es:
data_kitten:
rights: Derechos
locales:
en: Inglés
es: Español
it: Italiano
4 changes: 2 additions & 2 deletions config/locales/website_it.yml
Original file line number Diff line number Diff line change
Expand Up @@ -435,8 +435,8 @@ it:
short_name: Short name or preferred way of being addressed

locales:
en: English
cs: Czech
en: Inglese
it: Italiano

interface:
select: "Please select…"

0 comments on commit a8057ef

Please sign in to comment.