Feature Showcase: Website Mulitilanguage Support (Internationalization)

We are currently adding multilanguage support (internationalization) to the ERPNext website. This is what we have planned, we are looking forward to your feedback.

Adding the Language Picker to the Navigation on the Website

I would integrate this language picker https://bootsnipp.com/snippets/mprMM flag icons can be defined in the backend but we would suggest using https://www.gosquared.com/resources/flag-icons/ which is under MIT license. The flags would be in the current Language DocType, we should also consider uploading the flag icons with 25px to Frappe Core for usage wherever people want and populating the Flags field with those by default.

Currently the navigation looks like this:

I would add the language picker betweeen the login and the navigation like this mockup (collapsed):

When the user clicks the language they can pick among the available language options (expanded):

Adding Languages to Website Settings

  1. In Website Settings add a new section called Website Languages
  2. Add checkboxes Enable Multilanguage Support and Display Language Picker in Top Bar. Without Multilanguage Support being enabled we hide the language features in blogs, knowledge base and pages.
  3. Add a new child table Website Languages with fields Language (Link: Language), Route (Data), Default (Check, unique)

The route would be a default prefix that is added to the individual Web Page, Help Article or Blog Post route for example the “Company History” pages route in English would be route “/en” and then “company-history” so www.website.com/en/company-history while the German could be www.website.com/de/unternehmensgeschichte. This is SEO friendly.

Changes in Other DocTypes

This example is for Web Page, similar procedure would have to be done for Help Article and for Blog Post.

  1. In Web Page add Language (Link: Language [javascript limited to children in Website Languages child table]) and show it in list view if Website Settings -> Enable Multilanguage Support == TRUE.
  2. When creating a new Web Page by default put in the default language from Website Settings -> Website Languages -> default.
  3. If Web Page Language not the default language, add new field Translation of Web Page (Link: Web Page) which will link the translations with its parent.
  4. In Web Page show linked translations in Dashboard

How Language Switching Works

  1. If the user is logged in we also change his language preference in his user under /me
  2. Open the page of the translation of the source site, if you are on the home page in English you should switch to the home page in German. If you are on the contact page in English you should switch to that in German. If there is no translation for that site display the default languages site.

I’m surprised there has been no response to this topic. this looks like a great addition! I was just searching for how to set internationalization up with Erpnext and came across this post. sadly I see it is not in erpnext v12?

@nostahl There is open PR to solve this issue:

I want to share a workaround for multilingual support in website that I am using.

For simplicity, it is assumed that only two languages are used: English and Spanish.

First, in every Web Page add a custom metatag that set the link to another Web Page in the other language. For example, if you have a Web Page in English you have to set a metatag (Web Page > Meta Tags Section > Add Custom Tags) that sets the link to the Spanish Web Page, like this:

Do the same for every Web Page that you want to add multilingual support.

Secondly, add the following script in Website Script:

// add language picker in navbar
$("#navbarSupportedContent").after("<select id='language-select' class='form-control' style='width: auto;'><option value='es'>Español</option><option value='en'>English</option></select>")

// get the preferred language in this session and set it on the language picker
var preferred_language = frappe.get_cookie("preferred_language")
if (preferred_language){

// whenever the language changes, redirect to its corresponding page in the other language
$('#language-select').on('change', function() {
  frappe.call("frappe.translate.set_preferred_language_cookie", {
    preferred_language: this.value
  }).then(function() {
    var preferred_language = frappe.get_cookie("preferred_language")
    var english_version = $('meta[name=english_version]').prop('content'); // get the link to the english version
    var spanish_version = $('meta[name=spanish_version]').prop('content'); // get the link to the spanish version
    if (preferred_language === "en" && english_version){
        window.location.pathname = english_version
    } else if (preferred_language === "es" && spanish_version){
        window.location.pathname = spanish_version

That’s it. Whenever the user change the language, is redirected to the link for the web page in the corresponding language.

Hope this helps.


Nice idea.