PrestaShop Introduces a New Translation System

PrestaShop introduces a new Prestashop translation system - Knowband

PrestaShop is a well-known open-source e-commerce platform which has released PrestaShop version 1.7.6, which includes a new Prestashop translation system meant to enhance online stores’ multilingual capabilities. This new system offers improved accuracy, efficacy, and user-friendliness, and addresses the drawbacks of previous translation techniques. In this blog post, we will provide a thorough technical explanation of PrestaShop’s new translation system, highlighting its features, architecture, and benefits.

Context and Purpose:-

The ability to offer information in many languages is essential for addressing a varied customer base as e-commerce continues to grow globally and conventional translation systems frequently suffer from errors, inefficiencies, and human labor.

Classic vs. New Prestashop Translation System

Difference between Classic and New Prestashop Translation System - Knowband

Classic Translation System: –

The classic translation system in PrestaShop was primarily file-based and less flexible:

  • File-Based Translations: Translations were stored in PHP files, which could be cumbersome to manage.
  • Limited Context Awareness: The classic system lacked robust context handling, leading to potential translation inconsistencies.
  • Manual Updates: Translating and updating content required significant manual effort, especially for larger stores.

New Translation System: –

The new Prestashop translation system offers several improvements:

  • Symfony Translation Component: Utilizes Symfony’s robust framework for handling translations efficiently.
  • XLIFF Translation Files: Employs the XLIFF (XML Localization Interchange File Format) standard, making translations easier to manage and more consistent.
  • Database Storage: Centralizes translation data, improving management and performance.
  • Contextual Awareness: Ensures that translations are accurate within their specific usage context.

Demonstrating the New Prestashop Translation System with a Demo Module

Let’s walk through creating a demo module to showcase the new translation system for Prestashop. We’ll call this module ‘kbdemotranslation’.

Step 1: Setting Up the Module Structure

First, create the basic structure of your PrestaShop module. Your directory structure should look like this:

Basic structure of your PrestaShop module - Knowband

Step 2: Setting Up the Module’s Main File

Create the main module file kbdemotranslation.php:

Setting Up the Module's Main File - Knowband

Therefore, in this main module file, we define the module class, its metadata, and the basic installation and uninstallation methods. The getContent() method is where we assign the translated strings to Smarty variables and render the configuration template.

Here, ‘Modules.Kbdemotranslation.Kbdemotranslation’ is the translation domain of the text.

Step 3: Creating the Template File 

Create custom template file named ‘configure.tpl’ in the views/templates/admin directory of the module:

Creating the Template File - Knowband

This template file displays the translated strings assigned in the getContent method. The ‘nofilter’ modifier is used to ensure that HTML tags in the translations are rendered correctly.

Step 4: Adding Translations via the PrestaShop Back Office

With the module structure and files in place, the next step is to add translations via the PrestaShop back office. Here’s how you can do it:

  • Access the Translation Interface: Go to your PrestaShop back office, and navigate to “International” > “Translations.”
  • Select the Module to Translate: Under “Modify translations,” choose “Installed modules translations” from the dropdown menu, select your language, and choose the ‘kbdemotranslation’ module.

Adding Translations via the PrestaShop Back Office - Knowband

  • Add Translations: You will see a list of translatable strings. Add translations for the strings “Demo Translation Module,” “A module to demonstrate the new translation system in PrestaShop,” “Hello World,” and “Your order will be delivered soon.”

Add translation via New translation system in PrestaShop

Further, after adding translations, these translations will be stored in the database and automatically applied when the module is used.

Translation Domain:

The translation domain used by PrestaShop is below-

Modules.Nameofthemodule.Specificpart

  • Here ‘Modules’ refer to the name of the modules directory. This part will always be the same.
  • ‘Nameofthemodule’ refers to the name of the module for which you want to add the translations. There are some rules to define this part-
    The first letter will always be in Upper Case, and all other alphabets will be in lower case. And (A-z, 0-9) characters are allowed in this part.
  • ‘Specificpart’ is for the developers to define to what section the translation belongs. And in this part, underscores, dots, and dashes are allowed.

Conclusion

Moreover, the new Prestashop translation system represents a significant advancement in managing multilingual content for e-commerce stores. By addressing the challenges of traditional translation methods and introducing innovative features, PrestaShop provides merchants and developers with a powerful tool to enhance their global reach. Hence, the system’s technical robustness ensures improved efficiency, accuracy, and scalability, making it an essential component for any business looking to expand its international presence.

You can also explore a wide range of Prestashop, Opencart, WooCommerce, Shopify, and Magento 2 ready-to-use eCommerce extensions.

In case you have queries/suggestions, you can reach out to our technical support portal at our email address support@knowband.com.

Take a look at our bestseller module One Page Supercheckout for Prestashop and Android and iOS App Maker for Prestashop.

Recommended blog: 

All You Need to Know About New Prestashop 8.1.5

Which One To Choose: PrestaShop 1.7 or PrestaShop 8.1?

Adrienne

We are professionals in the eCommerce industry, specializing in plugin development. With years of experience, We provide the best plugins for platforms like - Magento, Prestashop, OpenCart and Shopify. We also offer custom module development and customization services for websites and modules. Our team remains at the forefront of industry trends, delivering cutting-edge solutions to enhance eCommerce website functionality. With a customer-centric approach, our company is trusted partner for eCommerce plugin solutions.

Leave a Reply

Your email address will not be published. Required fields are marked *