Internationalization (i18n) & Taxes
Relevant source files
The following files were used as context for generating this wiki page:
PrestaShop translates content into many languages and localizes settings for various countries to provide a global e-commerce experience. The system handles localized data through XML language definitions, administrative interfaces for currency management, and a translation service for both frontend and backend components.
Sources: README.md:14-16, install-dev/langs/en/data/cms.xml
Localization and Multi-language Data
The software stores localized content for system entities, such as CMS pages, in language-specific XML files. These files define metadata, titles, and content for standard pages like Delivery, Legal Notice, and Terms and Conditions.
Language Data Structures
Each language pack contains an entity_cms structure that maps localized strings to specific page identifiers.
| Field | Description |
|---|---|
| meta_title | The localized title used for browser tabs and SEO. |
| meta_description | The localized summary for search engine results. |
| content | The full HTML content of the page in the target language. |
| link_rewrite | The URL-friendly slug for the localized page. |
Sources: install-dev/langs/en/data/cms.xml:4-10, install-dev/langs/uk/data/cms.xml:4-10
Currency Management
The Internationalization system manages currencies through the Back Office (BO) Localization interface. This allows administrators to add official currencies, filter them by ISO code, and remove them from the store.
Currency Workflow
The following diagram illustrates the process of managing a currency via the administrative interface.
The workflow ensures that currency data is validated and persists in the system for pricing and tax calculations.
Sources: tests/UI/commonTests/BO/international/currency.ts:39-71, tests/UI/commonTests/BO/international/currency.ts:114-135
Translation Service
The software uses a translator component to render localized strings dynamically in templates. This service handles translation keys and replacements for variables within strings.
Key Translation Methods
- trans(): Retrieves the translated string for a given key, optional parameters, and a specific domain (e.g., 'Install').
// Example of dynamic translation in a view
$this->translator->trans('I agree to the above terms and conditions.', [], 'Install');
Sources: install-dev/theme/views/license.php:12, install-dev/theme/views/license.php:23
Automated Localization Testing
The project includes specific test suites to verify Internationalization features. These tests utilize Playwright and Mocha to simulate user interactions within the Back Office.
| Test Script | Description |
|---|---|
test:cldr | Runs tests related to the Common Locale Data Repository. |
test:functional:BO:international | Executes functional tests for the International Back Office section. |
Sources: tests/UI/package.json:34-35, tests/UI/package.json:67-71
Licenses and Legal Localization
PrestaShop localizes legal agreements depending on the component type. The core software follows the Open Software License (OSL 3.0), while themes and modules use the Academic Free License (AFL 3.0). The installation process requires explicit agreement to these localized terms.
Sources: install-dev/theme/views/license.php:13-14, README.md:154-155
Internationalization ensures that the store adapts to local requirements by providing translated CMS content, managed currencies, and localized legal disclosures, all verified through automated UI testing campaigns.