Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
ryanwilsonperkin opened this issue Jun 13, 2023 · 1 comment
Open

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

ryanwilsonperkin opened this issue Jun 13, 2023 · 1 comment

Comments

@ryanwilsonperkin
Copy link
Member

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.

@ryanrphillips
Copy link

Any update on this one? Encountered the same issue today.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants