diff --git a/app/helpers/language_links_helper.rb b/app/helpers/language_links_helper.rb index 1aee4ece5..a8c70a03c 100644 --- a/app/helpers/language_links_helper.rb +++ b/app/helpers/language_links_helper.rb @@ -1,7 +1,7 @@ module LanguageLinksHelper def language_link_tag(language_plus_code) language = language_plus_code.split(':').first - code = language_plus_code.split(':').second + code = language_plus_code.split(':').second.strip! link_to_unless(@current_lang == code, language, "?translate=#{code}", lang: code, class: 'notranslate button-small') do |language_text| content_tag(:a, language_text, lang: code, class: 'translate-active button-small') diff --git a/app/views/component/search/_languages.html.haml b/app/views/component/search/_languages.html.haml index cd3baafef..d06c14ee5 100644 --- a/app/views/component/search/_languages.html.haml +++ b/app/views/component/search/_languages.html.haml @@ -1,5 +1,6 @@ -%section#language-box - %ul - - SETTINGS[:language_links].each do |language_plus_code| - %li - = language_link_tag language_plus_code +- if SETTINGS[:language_links].present? + %section#language-box + %ul + - SETTINGS[:language_links].each do |language_plus_code| + %li + = language_link_tag language_plus_code diff --git a/config/settings.yml b/config/settings.yml index 5833374a4..1686bbd7e 100644 --- a/config/settings.yml +++ b/config/settings.yml @@ -211,26 +211,27 @@ info_box_terms: ################################################################### # -# LANGUAGE LINKS SETTINGS +# LANGUAGE TRANSLATION LINKS SETTINGS # ################################################################### -# This represents the 6 most common languages in your community. +# This represents the most common languages in your community. # The languages will appear at the top of the home page, and # clicking on each language will translate the text on the entire # site into that language using Google Translate. -# The format should be 'Language:code', as shown below. +# The format should be 'Language: code', as shown below. # To see a list of all supported languages and codes, read the # "Language reference" section in the Google Translate documentation: -# https://developers.google.com/translate/v2/using_rest - +# https://developers.google.com/translate/v2/using_rest#language-params +# If you do not wish to include any language translation links, +# comment out or delete all of the language settings shown. language_links: - - 'English:en' - - 'Español:es' - - 'Tagalog:tl' - - '中文:zh-CN' - - 'العربية:ar' - - 'Русский:ru' + - 'English: en' + - 'Español: es' + - 'Tagalog: tl' + - '中文: zh-CN' + - 'العربية: ar' + - 'Русский: ru' ###################### # @@ -306,11 +307,11 @@ test: custom: component/info_box/example_custom_template language_links: - - 'English:en' - - 'Español:es' - - 'Tagalog:tl' - - '中文:zh-CN' - - 'العربية:ar' - - 'Русский:ru' + - 'English: en' + - 'Español: es' + - 'Tagalog: tl' + - '中文: zh-CN' + - 'العربية: ar' + - 'Русский: ru' site_title: Ohana Web Search