How to use @shopify/i18n - 1 common examples

To help you get started, we’ve selected a few @shopify/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 Shopify / quilt / packages / react-i18n / src / utilities / translate.tsx View on Github external
) {
    const count = replacements[PLURALIZATION_KEY_NAME];

    if (typeof count === 'number') {
      const group = memoizedPluralRules(locale).select(count);
      result = result[group];

      additionalReplacements[PLURALIZATION_KEY_NAME] = memoizedNumberFormatter(
        locale,
      ).format(count);
    }
  }

  const processedString =
    typeof result === 'string' && pseudotranslate
      ? pseudotranslateString(result, {
          ...PSEUDOTRANSLATE_OPTIONS,
          toLocale:
            typeof pseudotranslate === 'boolean' ? undefined : pseudotranslate,
        })
      : result;

  if (typeof processedString === 'string') {
    return updateStringWithReplacements(processedString, {
      ...replacements,
      ...additionalReplacements,
    });
  } else {
    return MISSING_TRANSLATION;
  }
}

@shopify/i18n

Generic i18n-related utilities

MIT
Latest version published 2 years ago

Package Health Score

72 / 100
Full package analysis

Popular @shopify/i18n functions

Similar packages