Multilingual website feature

Hi Max, I read your post about the multi-lingual support, it had website as well. Please can you tell me more about it. I am about to start the multi-lingual website project so if that is something you are already doing then I will stop right now. :slight_smile:

I saw the PR but it has nothing about the multi-lingual support to website.

Hi @KanchanChauhan!

Since I enabled the Translation in a record-level for ERPNext, and frappe, I take care of enable jinja templates translation also.

In the multi-lingual request you will be able to translate almost all field contents, so let’s think in Website Page.

The requirements to turn one WebSite multi-lingual are:

  • Enable translation in to Content Fields (By Default, I already make a patch for that, but patch dont work for new instances)

  • Translate all the page content, to the target languages, in case of an tranlation of an “Text Editor”, each HTML tag into the translatded content matter.

    Let suppose:
    en: Original Text
    pt-BR: Texto Original
    es: Contenido Original

  • Build an localization Menu, on the menu, you only need to pass an URL argument _lang= with the target language, eg: to translate the website to Brazilian Portuguese,

Sorry for annoying you again Max, I was trying to get it working. This is what I did.

Where am I going wrong. Actually it looks like jinja template is not working.


@KanchanChauhan, I dont think you got nothing wrong, I think that the issue is regard of the changes that netchampfaris made into the project to merge it into the core.

Look this

And this

Various aspects of my original code, that ensure the multi-lingual behavior, have been removed, by netchampfaris on pull request acceptation.

Sorry, for this, but I make my post, with the features that I already delivered for frappe, not in basis of what was accepted and what was not.

@KanchanChauhan can I turn this topic public?

Since, the thing that you discovered, maybe will affect others into the future?

yeah I saw that, your patch is also removed to update existing fields.

So I was able to get the translation working in website. :slight_smile:

My next question is how do we translate the menus and also the URL. We will need a language selector as well. I will work these things and connect with you to discuss further if that is ok with you.

1 Like

@KanchanChauhan Ok, in case of doubts, I’m available.

Is this possible nowadays by default? Can we make multi-lingual websites like with many other CMS? This has been a little bit of bottleneck here. :wink:

Someone know if we can use url redirection with nginx to get website translation work. I mean is it possible to configure nginx for when user add /en/ or /fr/ it will add parameters _lang in url automatically?


The Multilingual PR had a lot of changes affecting different parts of the framework, what we did was break the PR into small features and merged it.

Understand that changes in core framework are very sensitive. If there are any problems, they could multiply in ERPNext.

So, the current website module translates some of the text and not everything. We can fix them one by one if we list down these things.


It this my implementation of NGINX url rewrite from add language support in the website section of Erpnext.


Do we have any documentation link for this “Multilingual PR split into small features” because I can’t visually see this multilingual stuff appearing anywhere in the system? Using v10.1.28 (master).

Hi Max, it has been a long time but I can report what @KanchanChauhan described in his post with photos worked for me in ERPNext 14. I am actually loving it!

I added the following code to the website script to change website language and remember the choice with a cookie. With this code and the Translation solution I can get everything I have inside brackets translated on the webpages I create like {{_(“Some text I want to translate.”) }}

// add language picker in navbar
$("#navbarSupportedContent").after("<select id='language-select' class='form-control' style='margin-left: 10px; width: auto;'><option value='en'>English</option><option value='de'>Deutsch</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.translate.set_preferred_language_cookie", {
    preferred_language: this.value
  }).then(function() {
    var preferred_language = frappe.get_cookie("preferred_language");
    var english_translation = window.location.href.split("?").shift().split("/").pop() + '?_lang=en'; // add the path to the english translation
    var german_translation = window.location.href.split("?").shift().split("/").pop() + '?_lang=de'; // add the pathto the german translation
    if (preferred_language === "en" && english_translation){
        window.location = english_translation;
    } else if (preferred_language === "de" && german_translation){
        window.location = german_translation;

var english_translation = window.location.href.split("?").shift().split("/").pop() + '?_lang=en'; // add the path to the english translation
var german_translation = window.location.href.split("?").shift().split("/").pop() + '?_lang=de'; // add the pathto the german translation

if(preferred_language === "en" && window.location.href.split("?").pop() !== "_lang=en" ){
    window.location.href = english_translation;
    } else if (preferred_language === "de" && window.location.href.split("?").pop() !== "_lang=de" ){
        window.location.href = german_translation;

My question is, although this method of translation works for most things, can I use it to translate Footer items I arrange in the Website Settings?
This format there doesn’t work {{_(“Privacy Policy”) }}

Best Regards

1 Like