Multi-Language
Guide to configuring multi-language functionality in SaasCart
Multi-Language Support
To accommodate users from diverse regions, SaasCart includes built-in multi-language functionality, making the platform accessible worldwide. The language selection dropdown is located in the header.
How Does Multi-Language Functionality Work?
SaasCart uses the following packages to implement multi-language support:
accept-language
, react-i18next
, i18next
, i18next-browser-languagedetector
, and i18next-resources-to-backend
.
To install these packages, run:
You can find the language translation logic and design at the following path:
src/app/i18n/i18n-context.jsx
Implementing the Language Translate Feature
After installing the required packages, follow these steps to add multi-language support.
1. Set Up i18n-context.jsx
2. Configure settings.js
JSON Files for Language Translations
Create a JSON file for each language with translations for words or phrases.
Example JSON Files:
-
English (
/en/common.json
): -
Arabic (
/ar/common.json
): -
Spanish (
/es/common.json
): -
French (
/fr/common.json
):
Using the t
Function for Translations
To use a variable for translations, import useTranslation
from react-i18next
.
Warning: Ensure that translations are provided for each term in the JSON files to avoid missing translations.