Skip to content

Default formatters don't work when using this package #77

@ryanwilsonperkin

Description

@ryanwilsonperkin

When initializing i18next with this package, the default formatters don't appear to be working.

Codesandbox reproduction: https://codesandbox.io/s/i18next-shopify-formatters-not-working-qdt7h4

I'd like to be able to use code like this to use the currency formatter:

import i18next from 'i18next';
import {initReactI18next, useTranslation} from 'react-i18next';
import ShopifyFormat from '@shopify/i18next-shopify';

i18next
  .use(initReactI18next)
  .use(ShopifyFormat)
  .init({
    lng: "en",
    resources: {
      en: {
        translation: {
          intlNumber: "{{val, currency}}"
        }
      }
    }
  });
  
 export default function App() {
   const {t} = useTranslation();
   return t('intlNumber', {val: 123.45});
 }

This doesn't currently work, but removing the .use(ShopifyFormat) line will cause it to work correctly. It seems that the ShopifyFormat plugin is causing the default formatters for currency/date/etc to be removed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions