diaspora/app/helpers/language_helper.rb
Richard afec5977e9 Started converting the help section into a backbone view. Things missing are: some urls which were calculated and inserted into the yml, all the pre-existing erb templates are still there, it's still at /faq/faq, nothing has been tested, some of the questions don't collapse and expand.
changed the locales to have the hard coded urls in them because they can no longer be calculated server side. this is pretty crap because i'm going to have to change it for all the languages now so i might change my mind about this later.

deleted some unused views.
2014-02-09 16:00:15 +01:00

42 lines
1.1 KiB
Ruby

module LanguageHelper
def available_language_options
options = []
AVAILABLE_LANGUAGES.each do |locale, language|
options << [language, locale]
end
options.sort_by { |o| o[0] }
end
def get_javascript_strings_for(language)
defaults = I18n.t('javascripts', :locale => DEFAULT_LANGUAGE)
if language != DEFAULT_LANGUAGE
translations = I18n.t('javascripts', :locale => language)
defaults.deep_merge!(translations)
end
defaults['pluralization_rule'] = I18n.t('i18n.plural.js_rule', :locale => language)
defaults['pod_name'] = pod_name
defaults
end
def get_diaspora_section_strings_for(section, language)
defaults = I18n.t(section, :locale => DEFAULT_LANGUAGE)
if language != DEFAULT_LANGUAGE
translations = I18n.t(section, :locale => language)
defaults.deep_merge!(translations)
end
defaults
end
def direction_for(string)
return '' unless string.respond_to?(:cleaned_is_rtl?)
string.cleaned_is_rtl? ? 'rtl' : 'ltr'
end
def rtl?
@rtl ||= RTL_LANGUAGES.include?(I18n.locale.to_s)
end
end