send translated strings to javascript

This commit is contained in:
Zachary Chai
2016-11-10 12:16:33 -05:00
parent c32b513d6c
commit c7d2c8f27e
7 changed files with 32 additions and 30 deletions

View File

@ -1,2 +1,17 @@
module ApplicationHelper
def client_translations
locale = I18n.locale
if locale.length < 4
fallback_locale = I18n.fallbacks[locale].second
end
if fallback_locale
I18n.locale = fallback_locale
translations = I18n.t('.')
I18n.locale = locale
else
translations = I18n.t('.')
end
translations[:client]
end
end