Make sure to only create javascript locales if Houdini has a translation for it

This commit is contained in:
Eric 2020-06-17 17:27:50 -05:00 committed by Eric Schultz
parent ba7af72598
commit 6e9d2f2d4d

View file

@ -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;