From 6e9d2f2d4d33fa11c63b87a6fca5d1797eaf3e82 Mon Sep 17 00:00:00 2001 From: Eric Date: Wed, 17 Jun 2020 17:27:50 -0500 Subject: [PATCH] Make sure to only create javascript locales if Houdini has a translation for it --- app/javascript/i18n.js.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/javascript/i18n.js.erb b/app/javascript/i18n.js.erb index b54f2db7..cea03a8a 100644 --- a/app/javascript/i18n.js.erb +++ b/app/javascript/i18n.js.erb @@ -1,7 +1,7 @@ const I18n = require('i18n-js'); I18n.translations = I18n.translations || {}; -<% I18n::JS::translations.each do |k,v| %> +<% I18n::JS::translations.select{|k,v| Houdini.intl.available_locales.map{|i| i.to_s}.include?(k.to_s)}.each do |k,v| %> I18n.translations['<%= k %>'] = I18n.extend((I18n.translations['<%= k %>'] || {}),<%= JSON.generate(v) %>); <% end %> module.exports = I18n; \ No newline at end of file