How to use the @shopgate/engage/core.i18n.init function in @shopgate/engage

To help you get started, we’ve selected a few @shopgate/engage 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 shopgate / pwa / libraries / common / components / I18n / components / FormatPrice / spec.jsx View on Github external
describe('', () => {
  const locales = {
    greeting: 'Hello {price}',
  };
  const price = 1234.56;
  const formattedPrice = '€1,234.56';
  const currency = 'EUR';
  const lang = 'en-US';

  i18n.init({
    locales,
    lang,
  });

  describe('Given the component was mounted to the DOM', () => {
    let renderedElement;
    it('should match snapshot', () => {
      renderedElement = mount((
        
          <div>
            <span>
              
            </span>
            <span>
              
                </span></div>
github shopgate / pwa / libraries / common / components / I18n / components / Translate / spec.jsx View on Github external
describe('', () =&gt; {
  const locales = {
    greeting: 'Hello {name}',
  };

  i18n.init({
    locales,
    lang: 'en-US',
  });

  describe('Given the component was mounted to the DOM', () =&gt; {
    let renderedElement;

    it('should match snapshot', () =&gt; {
      renderedElement = mount((
        
          
        
      ));
      expect(renderedElement).toMatchSnapshot();
    });
github shopgate / pwa / libraries / common / components / I18n / components / Placeholder / spec.jsx View on Github external
describe('', () =&gt; {
  const locales = {
    greeting: 'Hello {world}',
  };
  const lang = 'en-US';

  i18n.init({
    locales,
    lang,
  });

  describe('Given the component was mounted to the DOM', () =&gt; {
    let renderedElement;
    it('should render', () =&gt; {
      renderedElement = mount((
        
          
            
              <strong>WORLD</strong>
            
            /
github shopgate / pwa / libraries / common / components / I18n / components / FormatNumber / spec.jsx View on Github external
describe('i18n ready', () => {
    i18n.init({
      locales: {},
      lang: 'en-US',
    });

    const pairs = [
      [1, '1.00', 2],
      [0.1, '0.10', 2],
      [1, '1.000', 3],
      [1, '1', 0],
    ];

    /**
     * Makes a component.
     * @param {number} number Number
     * @param {number} fractions Decimal points.
     * @returns {Object}
github shopgate / pwa / libraries / common / components / I18n / components / FormatDate / spec.jsx View on Github external
describe('', () =&gt; {
  const locales = {
    greeting: 'Hello {date}',
  };
  const lang = 'en-US';
  const timestamp = 123456789000;
  const formattedDate = 'Nov 29, 1973';
  const format = 'medium';

  i18n.init({
    locales,
    lang,
  });

  describe('Given the component was mounted to the DOM', () =&gt; {
    let renderedElement;
    it('should match snapshot', () =&gt; {
      renderedElement = mount((
        
          <div>
            <span>
              
            </span>
            <span>
              
                </span></div>
github shopgate / pwa / themes / theme-gmd / index.jsx View on Github external
* -------------------------------------------------------------------------
 */
import '@shopgate/pwa-common/styles/reset';
import React from 'react';
import { render } from 'react-dom';
import { configureStore } from '@shopgate/pwa-common/store';
import { appWillStart } from '@shopgate/pwa-common/action-creators/app';
import { i18n } from '@shopgate/engage/core';
import smoothscroll from 'smoothscroll-polyfill';
import fetchClientInformation from '@shopgate/pwa-common/actions/client/fetchClientInformation';
import locales from './locale';
import reducers from './pages/reducers';
import subscribers from './pages/subscribers';
import Pages from './pages';

i18n.init({
  locales,
  lang: process.env.LOCALE,
});

smoothscroll.polyfill();

const store = configureStore(reducers, subscribers);

store.dispatch(appWillStart(`${window.location.pathname}${window.location.search}`));
store.dispatch(fetchClientInformation());

render(, document.getElementById('root'));
github shopgate / pwa / libraries / common / components / I18n / components / I18nProvider / spec.jsx View on Github external
describe('', () =&gt; {
  const locales = {
    greeting: 'Guten Tag {name}',
  };
  const lang = 'de-DE';

  i18nHelper.init({
    locales,
    lang,
  });

  describe('Given the component was mounted to the DOM', () =&gt; {
    let renderedElement;
    let renderedInstance;
    it('should match snapshot', () =&gt; {
      renderedElement = shallow();
      renderedInstance = renderedElement.instance();
      expect(renderedElement).toMatchSnapshot();
    });

    it('should provide access to i18n via context', () =&gt; {
      const { i18n } = renderedInstance.getChildContext();
      expect(i18n).toEqual(renderedInstance.getI18nInstance);
github shopgate / pwa / themes / theme-ios11 / index.jsx View on Github external
* -------------------------------------------------------------------------
 */
import '@shopgate/pwa-common/styles/reset';
import React from 'react';
import { render } from 'react-dom';
import { configureStore } from '@shopgate/pwa-common/store';
import { appWillStart } from '@shopgate/pwa-common/action-creators/app';
import fetchClientInformation from '@shopgate/pwa-common/actions/client/fetchClientInformation';
import { i18n } from '@shopgate/engage/core';
import smoothscroll from 'smoothscroll-polyfill';
import locales from './locale';
import reducers from './pages/reducers';
import subscribers from './pages/subscribers';
import Pages from './pages';

i18n.init({
  locales,
  lang: process.env.LOCALE,
});

smoothscroll.polyfill();

const store = configureStore(reducers, subscribers);

store.dispatch(appWillStart(`${window.location.pathname}${window.location.search}`));
store.dispatch(fetchClientInformation());

render(, document.getElementById('root'));