How to use the fusion-plugin-i18n.I18nToken.optional function in fusion-plugin-i18n

To help you get started, we’ve selected a few fusion-plugin-i18n examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github fusionjs / fusionjs / fusion-plugin-rpc / src / browser.js View on Github external
const pluginFactory: () => RPCPluginType = () =>
  createPlugin({
    deps: {
      fetch: FetchToken,
      emitter: UniversalEventsToken,
      i18n: I18nToken.optional,
      rpcConfig: RPCHandlersConfigToken.optional,
    },
    provides: deps => {
      const {fetch = window.fetch, emitter, rpcConfig, i18n} = deps;

      return {
        from: ctx => {
          const locale = (i18n && i18n.from(ctx).locale) || '';
          const localeCode = typeof locale === 'string' ? locale : locale.code;
          return new RPC({
            fetch,
            emitter,
            rpcConfig,
            localeCode,
          });
        },

fusion-plugin-i18n

Adds I18n (Internationalization) support to a FusionJS app

MIT
Latest version published 2 years ago

Package Health Score

54 / 100
Full package analysis

Popular fusion-plugin-i18n functions

Similar packages