Open Source Platform for DTC, B2B Commerce, Marketplaces & Omnichannel. REST APIs, TypeScript SDKs, and production-ready Next.js storefront. Self-host it. Own your data. No vendor lock-in. Zero platform fees.
Ruby b2b-commercee-commerceecommerceecommerce-apiecommerce-frameworkecommerce-platformheadlessheadless-commerceheadless-ecommercemarketplacemulti-tenantmulti-vendormulti-vendor-ecommerceopen-sourcespree-commerce
add react-i18n
Damian Legawiec9d02070cc282
diff --git a/packages/admin/package.json b/packages/admin/package.jsonindex 60dc8c84dc..126443f2d9 100644--- a/packages/admin/package.json+++ b/packages/admin/package.json@@ -39,6 +39,7 @@"date-fns": "^4.1.0","date-fns-tz": "^3.2.0","flag-icons": "^7.5.0",+ "i18next": "^26.2.0","lucide-react": "^1.14.0","next-themes": "^0.4.6","react": "^19.2.6",@@ -46,6 +47,7 @@"react-day-picker": "^9.14.0","react-dom": "^19.2.6","react-hook-form": "^7.75.0",+ "react-i18next": "^17.0.8","recharts": "^3.8.1","shadcn": "^4.7.0","sonner": "^2.0.7",diff --git a/packages/admin/src/lib/i18n.ts b/packages/admin/src/lib/i18n.tsnew file mode 100644index 0000000000..7555ab6709--- /dev/null+++ b/packages/admin/src/lib/i18n.ts@@ -0,0 +1,23 @@+import i18n from 'i18next'+import { initReactI18next } from 'react-i18next'+import en from '@/locales/en.json'++// English-only at launch. Adding another locale = add a `<code>.json` next to+// `en.json` and load it here. Lazy chunks come later if/when the locale list+// grows enough to matter.+i18n.use(initReactI18next).init({+ resources: { en: { translation: en } },+ lng: 'en',+ fallbackLng: 'en',+ interpolation: { escapeValue: false },+ // Surface missing keys in dev so we notice gaps as we build pages; ship+ // silently humanizing the attribute in prod (a missing key shouldn't blow+ // up the UI).+ saveMissing: import.meta.env.DEV,+ missingKeyHandler: import.meta.env.DEV+ ? (_lngs, _ns, key) => console.warn(`[i18n] Missing key: ${key}`)+ : undefined,+})++export { default as i18n } from 'i18next'+export { Trans, useTranslation } from 'react-i18next'diff --git a/packages/admin/src/locales/en.json b/packages/admin/src/locales/en.jsonnew file mode 100644index 0000000000..deb463736a--- /dev/null+++ b/packages/admin/src/locales/en.json@@ -0,0 +1,331 @@+{+ "admin": {+ "actions": {+ "create": "Create",+ "save": "Save",+ "saving": "Saving…",+ "creating": "Creating…",+ "cancel": "Cancel",+ "delete": "Delete",+ "generate": "Generate"+ },+ "fields": {+ "name": { "label": "Name" },+ "label": { "label": "Label" },+ "description": { "label": "Description" },+ "code": { "label": "Code" },+ "email": { "label": "Email" },+ "password": { "label": "Password" },+ "first_name": { "label": "First name" },+ "last_name": { "label": "Last name" },+ "phone": { "label": "Phone" },+ "company": { "label": "Company" },+ "address1": { "label": "Address line 1" },+ "address2": { "label": "Address line 2" },+ "city": { "label": "City" },+ "zipcode": { "label": "Postal code" },+ "country_iso": { "label": "Country" },+ "state_abbr": { "label": "State / Province" },+ "state_name": { "label": "State / Province" },+ "starts_at": { "label": "Starts" },+ "expires_at": { "label": "Expires" },+ "active": { "label": "Active" },+ "kind": { "label": "Kind" },+ "amount": { "label": "Amount" },+ "currency": { "label": "Currency" },+ "quantity": { "label": "Quantity" },+ "customer_id": { "label": "Customer" },+ "role_id": { "label": "Role" },+ "role_ids": { "label": "Roles" },+ "slug": { "label": "Slug" },+ "meta_title": { "label": "Meta title" },+ "meta_description": { "label": "Meta description" },+ "tax_category_id": { "label": "Tax category" },++ "promotion": {+ "name": { "placeholder": "Summer Sale" },+ "description": { "placeholder": "Internal description (optional)" },+ "kind": { "label": "How is this promotion applied?" },+ "code": { "placeholder": "SUMMER2026" },+ "multi_codes": {+ "label": "Generate a batch of unique codes",+ "help": "Useful for one-time-use codes — each customer redeems a different code."+ },+ "number_of_codes": { "label": "Number of codes", "placeholder": "100" },+ "code_prefix": {+ "label": "Code prefix (optional)",+ "placeholder": "VIP",+ "help": "Each generated code will start with this prefix."+ },+ "starts_at": { "placeholder": "No start date" },+ "expires_at": { "placeholder": "No expiry" },+ "usage_limit": { "label": "Usage limit", "placeholder": "Unlimited" },+ "match_policy": { "label": "Match policy" }+ },++ "custom_field_definition": {+ "label": { "label": "Label", "placeholder": "e.g. Material" },+ "namespace": { "label": "Namespace", "placeholder": "custom" },+ "key": { "label": "Key", "placeholder": "e.g. material" },+ "field_type": { "label": "Type" },+ "storefront_visible": { "label": "Visible on storefront" }+ },++ "tax_category": {+ "name": { "placeholder": "e.g. Reduced rate" },+ "tax_code": {+ "label": "Tax code",+ "placeholder": "External tax provider code (Avalara, etc.)"+ },+ "description": { "placeholder": "Optional internal description" },+ "is_default": {+ "label": "Default",+ "help": "Setting this demotes the previous default. Products without an explicit category fall back to this one."+ }+ },++ "invitation_acceptance": {+ "password": { "label": "Password" },+ "password_confirmation": { "label": "Confirm password" }+ },++ "customer_group": {+ "name": { "placeholder": "e.g. VIP customers" },+ "description": { "placeholder": "Optional internal description" }+ },++ "stock_location": {+ "name": { "placeholder": "Brooklyn warehouse" },+ "admin_name": {+ "label": "Internal name",+ "placeholder": "Optional — shown only in the admin"+ },+ "kind": { "label": "Kind" },+ "active": {+ "label": "Active",+ "help": "Inactive locations don't appear in fulfillment selection."+ },+ "default": {+ "label": "Default location",+ "help": "New stock items propagate here. Only one location can be default."+ },+ "backorderable_default": {+ "label": "Backorderable by default",+ "help": "New stock items default to allowing backorders when out of stock."+ },+ "propagate_all_variants": {+ "label": "Auto-create stock items for all variants",+ "help": "Create stock items at this location for every product variant."+ },+ "pickup_enabled": {+ "label": "Allow customer pickup",+ "help": "Customers can pick orders up from this location at checkout."+ },+ "pickup_stock_policy": { "label": "Stock policy" },+ "pickup_ready_in_minutes": { "label": "Ready in (minutes)", "placeholder": "60" },+ "pickup_instructions": {+ "label": "Pickup instructions",+ "placeholder": "Where the customer should go to collect their order."+ }+ },++ "payment_method": {+ "type": { "label": "Provider" },+ "name": { "placeholder": "e.g. Credit card (Stripe)" },+ "description": { "placeholder": "Customer-facing description shown at checkout" },+ "storefront_visible": { "label": "Visible on storefront" },+ "active": {+ "label": "Active",+ "help": "Inactive methods are hidden from checkout."+ },+ "auto_capture": {+ "label": "Auto-capture",+ "help": "Capture funds automatically on authorization. When off, you must capture manually."+ }+ },++ "login": {+ "email": { "placeholder": "[email protected]" }+ },++ "option_type": {+ "name": {+ "label": "Internal name",+ "placeholder": "e.g. shirt-size",+ "help": "Lowercase identifier. Must be unique across the store."+ },+ "label": {+ "label": "Label",+ "placeholder": "e.g. Shirt size",+ "help": "Shown to customers on the storefront."+ },+ "kind": {+ "label": "Kind",+ "help": "Controls how the option renders on the storefront. Color swatch shows a hex color; buttons show a thumbnail image."+ },+ "filterable": {+ "label": "Filterable",+ "help": "Show this option as a filter in storefront product listings."+ }+ },++ "option_value": {+ "name": { "label": "Internal name", "placeholder": "e.g. small" },+ "label": { "label": "Label", "placeholder": "e.g. Small" },+ "color_code": { "label": "Color" },+ "image": { "label": "Image" }+ },++ "api_key": {+ "name": {+ "label": "Name",+ "placeholder": "Backend integration, Storefront prod, …"+ },+ "key_type": { "label": "Type" },+ "scopes": { "label": "Scopes" }+ },++ "store": {+ "name": { "label": "Store name" },+ "preferred_admin_locale": {+ "label": "Admin language",+ "placeholder": "Use the default language"+ },+ "preferred_timezone": { "label": "Timezone", "placeholder": "Select a timezone" },+ "preferred_unit_system": { "label": "Unit system" },+ "preferred_weight_unit": { "label": "Weight unit" }+ },++ "product": {+ "name": { "placeholder": "Product name" },+ "description": { "placeholder": "Write a product description…" },+ "status": { "label": "Status" },+ "make_active_at": { "label": "Make active at" },+ "available_on": { "label": "Available on" },+ "discontinue_on": { "label": "Discontinue on" },+ "category_ids": { "label": "Categories" },+ "tags": { "label": "Tags" }+ },++ "gift_card": {+ "code": {+ "label": "Code",+ "help": "Leave blank to auto-generate. For batches, this becomes the prefix."+ },+ "amount": { "label": "Amount" },+ "currency": { "label": "Currency" },+ "expires_at": { "label": "Expires", "placeholder": "No expiry" },+ "customer_id": { "label": "Customer" },+ "quantity": {+ "label": "Quantity",+ "help": "1 issues a single card. More than 1 issues a batch with auto-generated codes."+ }+ },++ "invitation": {+ "email": { "label": "Email" },+ "role_id": { "label": "Role" }+ },++ "admin_user": {+ "role_ids": { "label": "Roles" }+ },++ "customer": {+ "email": { "label": "Email" },+ "first_name": { "label": "First name" },+ "last_name": { "label": "Last name" },+ "phone": { "label": "Phone" },+ "tags": { "label": "Tags" },+ "accepts_email_marketing": { "label": "Subscribed to marketing" },+ "internal_note": {+ "label": "Internal note",+ "placeholder": "Staff-only context about this customer…"+ }+ },++ "address": {+ "label": { "label": "Label", "placeholder": "e.g. Home, Office" },+ "first_name": { "label": "First name" },+ "last_name": { "label": "Last name" },+ "address1": { "label": "Address" },+ "address2": { "label": "Apartment, suite, etc." },+ "city": { "label": "City" },+ "postal_code": { "label": "Postal code" },+ "phone": { "label": "Phone" },+ "is_default_billing": { "label": "Default billing address" },+ "is_default_shipping": { "label": "Default shipping address" }+ },++ "store_credit": {+ "amount": { "label": "Amount" },+ "currency": { "label": "Currency" },+ "category_id": { "label": "Category" },+ "memo": { "label": "Memo", "placeholder": "Reason for issuing this credit" }+ },++ "order": {+ "email": { "label": "Or use a guest email", "placeholder": "[email protected]" },+ "customer_note": { "label": "Customer note (visible to customer)" },+ "internal_note": { "label": "Internal note (staff only)" },+ "coupon_code": { "label": "Coupon code", "placeholder": "Optional" }+ }+ },+ "promotions": {+ "rules": {+ "country": {+ "label": "Countries",+ "search_placeholder": "Search countries…",+ "empty": "No countries match"+ },+ "product": {+ "label": "Products",+ "search_placeholder": "Search products by name…",+ "empty": "No products match",+ "match_policy": {+ "any": {+ "label": "Any of these products",+ "description": "Order must contain at least one."+ },+ "all": {+ "label": "All of these products",+ "description": "Order must contain every product."+ },+ "none": {+ "label": "None of these products",+ "description": "Order must not contain any of them."+ }+ }+ },+ "category": {+ "label": "Categories",+ "search_placeholder": "Search categories…",+ "empty": "No categories match",+ "match_policy": {+ "any": {+ "label": "Any of these categories",+ "description": "Order must contain a product in at least one."+ },+ "all": {+ "label": "All of these categories",+ "description": "Order must contain a product in every category."+ }+ }+ },+ "customer_group": {+ "label": "Customer groups",+ "search_placeholder": "Search customer groups…",+ "empty": "No customer groups match"+ },+ "customer": {+ "label": "Customers",+ "search_placeholder": "Search customers by name or email…",+ "empty": "No customers match"+ }+ }+ },+ "errors": {+ "required": "This field is required"+ }+ }+}diff --git a/pnpm-lock.yaml b/pnpm-lock.yamlindex 47a8941480..f00d79690c 100644--- a/pnpm-lock.yaml+++ b/pnpm-lock.yaml@@ -90,6 +90,9 @@ importers:flag-icons:specifier: ^7.5.0version: 7.5.0+ i18next:+ specifier: ^26.2.0+ version: 26.2.0([email protected])lucide-react:specifier: ^1.14.0version: 1.14.0([email protected])@@ -111,6 +114,9 @@ importers:react-hook-form:specifier: ^7.75.0version: 7.75.0([email protected])+ react-i18next:+ specifier: ^17.0.8+ version: 17.0.8([email protected]([email protected]))([email protected]([email protected]))([email protected])([email protected])recharts:specifier: ^3.8.1version: 3.8.1(@types/[email protected])([email protected]([email protected]))([email protected])([email protected])([email protected])@@ -2654,6 +2660,9 @@ packages:resolution: {integrity: sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg==}+ resolution: {integrity: sha512-KknJ50kTInJ7qIScF3jeaFRpMpE8/lfiTdzf/twXyPBLAGrLRTmkz3AdTnKeh40X8k9L2fdYwEp/42WGXIRGcg==}+resolution: {integrity: sha512-4FbRdAX+bSdmo4AUFuS0WNiPz8NgFt+r8ThgNWmlrjQjt1Q7ZR9+zTlce2859x4KSXrwIsaeTqDoKQmtP8pLmQ==}engines: {node: '>= 0.8'}@@ -2674,6 +2683,14 @@ packages:resolution: {integrity: sha512-eKCa6bwnJhvxj14kZk5NCPc6Hb6BdsU9DZcOnmQKSnO1VKrfV0zCvtttPZUsBvjmNDn8rpcJfpwSYnHBjc95MQ==}engines: {node: '>=18.18.0'}+ resolution: {integrity: sha512-zwBHldHdTmwN7r6UNc7lC6GWNN+YYg3DrRSeHR5PRRBf5QnJZcYHrQc0uaU26qZeYxR7iFZD+Y315dPnKP47wA==}+ peerDependencies:+ typescript: ^5 || ^6+ peerDependenciesMeta:+ typescript:+ optional: true+resolution: {integrity: sha512-im9DjEDQ55s9fL4EYzOAv0yMqmMBSZp6G0VvFyTMPKWxiSBHUj9NW/qqLmXUwXrrM7AvqSlTCfvqRb0cM8yYqw==}engines: {node: '>=0.10.0'}@@ -3396,6 +3413,22 @@ packages:peerDependencies:react: ^16.8.0 || ^17 || ^18 || ^19+ resolution: {integrity: sha512-0ooKbGLU8JXhe1zwpQUWIeXSgLPOfwJmgheWRIUpcoA0CpyabpGhayjdG+/eA5esC1AQ8h2jWpXjJfzQzeDOCw==}+ peerDependencies:+ i18next: '>= 26.2.0'+ react: '>= 16.8.0'+ react-dom: '*'+ react-native: '*'+ typescript: ^5 || ^6+ peerDependenciesMeta:+ react-dom:+ optional: true+ react-native:+ optional: true+ typescript:+ optional: true+resolution: {integrity: sha512-Dn0t8IQhCmeIT3wu+Apm1/YVsJXsGWi6k4sPdnBIdqMVtHtv0IGi6dcpNpNkNac0zB2uUAqNX3MHzN8c+z2rwQ==}@@ -3993,6 +4026,10 @@ packages:jsdom:optional: true+ resolution: {integrity: sha512-Dhxzh5HZuiHQhbvTW9AMetFfBHDMYpo23Uo9btPXgdYP+3T5S+p+jgNy7spra+veYhBP2dCSgxR/i2Y02h5/6w==}+ engines: {node: '>=0.10.0'}+resolution: {integrity: sha512-dpojBhNsCNN7T82Tm7k26A6G9ML3NkhDsnw9n/eoxSRlVBB4CEtIQ/KTCLI2Fwf3ataSXRhYFkQi3SlnFwPvPQ==}@@ -6318,6 +6355,10 @@ snapshots:+ dependencies:+ void-elements: 3.1.0+dependencies:depd: 2.0.0@@ -6339,6 +6380,10 @@ snapshots:+ optionalDependencies:+ typescript: 6.0.3+dependencies:safer-buffer: 2.1.2@@ -6955,6 +7000,17 @@ snapshots:dependencies:react: 19.2.6+ [email protected]([email protected]([email protected]))([email protected]([email protected]))([email protected])([email protected]):+ dependencies:+ '@babel/runtime': 7.29.2+ html-parse-stringify: 3.0.1+ i18next: 26.2.0([email protected])+ react: 19.2.6+ use-sync-external-store: 1.6.0([email protected])+ optionalDependencies:+ react-dom: 19.2.6([email protected])+ typescript: 6.0.3+@@ -7578,6 +7634,8 @@ snapshots:transitivePeerDependencies:- msw+ [email protected]: {}+