Onboard loads properly!

This commit is contained in:
Eric Schultz 2019-11-18 17:32:57 -06:00 committed by Eric Schultz
parent 1af1aac683
commit d95ebf53a3
4 changed files with 8 additions and 11 deletions

View file

@ -1,7 +1,8 @@
import I18n from 'i18n-js';
const I18n = require('i18n-js');
I18n.translations || (I18n.translations = {});
I18n.translations = I18n.translations || {};
<% I18n::JS::translations.each do |k,v| %>
<% byebug %>
I18n.translations[<%= k %>] = I18n.extend((I18n.translations[<%= k %>] || {}),<%= JSON.generate(v) %>);
I18n.translations['<%= k %>'] = I18n.extend((I18n.translations['<%= k %>'] || {}),<%= JSON.generate(v) %>);
<% end %>
module.exports = I18n;

View file

@ -6,8 +6,8 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
<title><%= "#{yield(:title)} - #{Settings.general.name}" %></title>
<script src="https://cdn.polyfill.io/v2/polyfill.js?features=default,Intl.~locale.en"></script>
<%= IncludeAsset.js '/client/js/i18n.js' %>
<script>
window.I18n = {}
I18n.defaultLocale = "<%= I18n.default_locale %>"
I18n.locale = "<%= I18n.locale %>"
window._csrf = "<%= form_authenticity_token %>"
@ -25,10 +25,6 @@
</head>
<body class="<%= @theme == 'minimal' ? 'minimal' : nil %>">
<%= render 'layouts/apified_header' %>
<%= IncludeAsset.js '/app/loading_indicator.js' %>
<%= IncludeAsset.js '/app/react.js' %>
<%= IncludeAsset.js '/app/react-dom.js' %>
<%= IncludeAsset.js '/app/vendor.js' %>
<%= yield :javascripts %>
<div class="site-content" role="main">
<%= yield %>

View file

@ -1,6 +1,6 @@
<% content_for :title, t("registration.get_started.header") %>
<% content_for :javascripts do %>
<%= IncludeAsset.js '/app/registration_pagex.js' %>
<%= javascript_pack_tag 'loading_indicator', 'i18n', 'registration_page' %>
<% end %>
<div id="outlet"></div>

View file

@ -12,7 +12,7 @@ import * as CustomAPIS from "../../lib/apis"
const enLocaleData = require('react-intl/locale-data/en');
const I18n = require('../../../../app/javascript/i18n.js.erb')
const localeData = [...enLocaleData]
I18n.translations.keys().filter((i:string) => i !== 'en').each((i:string) => {
Object.keys(I18n.translations).filter((i:string) => i !== 'en').forEach((i:string) => {
const data = [...require(`react-intl/locale-data/${i}`)]
localeData.concat(data)
})