dojo / widget-core

:rocket: Dojo 2 - widget authoring system.
http://dojo.io
Other
34 stars 39 forks source link

Async nature of i18n and Server Side Rendering #523

Closed sebilasse closed 6 years ago

sebilasse commented 7 years ago

As said, webcomponents and widgets are useless to me if they are not rendered by the server because "If it is not curlable it is not on the web" - So if I would open an i18n-page with a dojo2 app (e.g. //indieauth.com/de) I would expect that page to send a german curlable page.

Let there be a quick fix in dojo/widget-core/mixins/I18n --> localizeBundle it is only 4-5 more lines after const { locale } = this.properties; ::

if (has('host-node')) {
  const localMessages = require(resolveLocalePath(bundle.bundlePath, locale));
  setLocaleMessages(bundle, localMessages.default, locale);
}

Might be a workaround but then my server would deliver the correct messages for each i18n-widget !

sebilasse commented 7 years ago

@dylans After days it turns out now that I can't do SSR at all because I can't bring https://github.com/css-modules/css-modules-require-hook to work because of the issue https://github.com/postcss/postcss-import/issues/180 ... The new maintainer of postcss does not recommend it or sees it happen.

So the classes will never match the ones which are in the browser...

dylans commented 7 years ago

Cc @kitsonk and @tomdye to get their thoughts on how to proceed.

mwistrand commented 7 years ago

@sebilasse Thanks for raising this issue. At the moment we have our hands full addressing other issues in anticipation of beta3, but plan to begin considering SSR beyond that point. Since SSR will almost certainly involve multiple components across multiple Dojo 2 packages, we will hold off on any immediate changes until we can be confident in the ramifications those changes will have. We will continue to leave this issue open, however, to ensure that your concerns are effectively addressed by the final solution, whatever that may be.

matt-gadd commented 6 years ago

given the changes in i18n to bundle loading, I think this issue can now be closed.