
Security News
ESLint Adds Official Support for Linting HTML
ESLint now supports HTML linting with 48 new rules, expanding its language plugin system to cover more of the modern web development stack.
@shopify/i18next-shopify
Advanced tools
i18nFormat plugin to use Shopify's translation format with i18next
@shopify/i18next-shopify
This package is an i18nFormat
plugin for the i18next library. It allows developers to use the same format used by Shopify apps and themes for localization.
Key features include:
{}
and double {{}}
curly brace mustache formats{ "keyWithCount": { "one": "value" } }
instead of { "keyWithCount_one": "value" }
t("key", { businessName: <strong>Shopify</strong> })
ordinal
as number (e.g. t("key", { ordinal: 1 })
) or using the interpolation variable ordinal
as boolean and count
as number (e.g. t("key", { ordinal: true, count: 1 })
)
ordinal
is explicitly set to 0
and count
is also explicitly set, the plugin will treat this as cardinal pluralization (e.g. t("key", { count: 1, ordinal: 0 }
))Getting Started
Example
License
Contributing
References
$ npm install @shopify/i18next-shopify
or
$ yarn add @shopify/i18next-shopify
Warning The
Intl.PluralRules
API is required for this plugin's plural handling. If your target environments do not support this API, you may need to polyfill it. This plugin's plural handling is not compatible with i18next's fallback to JSON format v3 plural handling.
import i18next from "i18next";
import ShopifyFormat from "@shopify/i18next-shopify";
i18next.use(ShopifyFormat).init(i18nextOptions);
import i18next from "i18next";
import ShopifyFormat from "@shopify/i18next-shopify";
i18next.use(ShopifyFormat).init({
lng: "en",
resources: {
en: {
translation: {
hello: "Hello {{casualName}}!",
products: {
"0": "I have no products.",
"1": "I have a single product.",
one: "I have {{count}} product.",
other: "I have {{count}} products.",
},
},
}
}
});
i18next.t("hello", { casualName: "Shopify" }); // -> Hello Shopify!
i18next.t("products", { count: 2 }); // -> I have 2 products!
Want to make i18next-shopify better for everyone? We'd love your help! Please start off by reading our Code of Conduct.
Bugs are tracked at GitHub issues. Search open issues to see if someone else has reported a similar bug. If it's something new, open an issue. We'll use the issue to have a conversation about the problem you want to fix. You may also suggest features using GitHub issues.
When creating a new issue, please ensure the issue is clear and include additional details to help maintainers reproduce it:
Use a clear and descriptive title for the issue to identify the problem.
Useful commands:
yarn install
to install development dependenciesyarn test
to run the test suiteyarn tdd
to run tests after files are updatedyarn lint
to run the linteryarn changeset
to generate a changesetHow to contribute:
yarn changeset add --empty
Thank you for your interest in contributing!
0.2.11
FAQs
i18nFormat plugin to use Shopify's translation format with i18next
We found that @shopify/i18next-shopify demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
ESLint now supports HTML linting with 48 new rules, expanding its language plugin system to cover more of the modern web development stack.
Security News
CISA is discontinuing official RSS support for KEV and cybersecurity alerts, shifting updates to email and social media, disrupting automation workflows.
Security News
The MCP community is launching an official registry to standardize AI tool discovery and let agents dynamically find and install MCP servers.