Multilingual use -- translating content elegantly

We need to interact with customers and sell our products in at least two languages (English and French). This means our content needs to be multilingual: item names and descriptions especially, but some other data as well. Has anybody figured out a satisfying way to use ERPNext in that manner? I’ve been looking through the forum and finding posts about translating the interface, but very little about translating the data.

I know fields can be made translatable and translations for those fields can be created using the Translation doctype, but that approach is rather limited, as I understand it:

  • When translating, ERPNext seems to make no distinction between interface text and field contents: if no translations have been created for a translatable field, ERPNext will try to translate it by looking through the interface translation “dictionary”, which could have undesirable results (since translation in general can be very dependent on context).
  • Suppose I have a translatable field with a given value, and I create a translation for it. If I notice a typo in the original value and fix it, ERPNext doesn’t know how to translate it anymore, even though the translation I had created is still perfectly valid.
  • Translations are only tied to their original text and nothing else: if I translate the name of an item, there’s nothing in the database explicitly tying that translation to the item itself.

I have some rough ideas of how I might create my own content translation solution inside a custom app, but I’m still very new to ERPNext and am really curious to know:

  1. has anybody found/created some form of solution for this already?
  2. are there any translation improvements coming in ERPNext v16?

Thanks in advance for any responses.

Eric

1 Like

I came across this older discussion and wanted to add something that might help keep it going. I’ve had decent results using custom fields plus translations in the Translation doctype, but it gets messy for long descriptions. Has anyone tried using two separate item description fields and switching them with print formats or scripting? Curious if newer versions of ERPNext made this easier for anyone.

That’s what I wound up doing. For the Item doctype, I’ve added two custom fields: custom_item_name_en_us and custom_item_description_en_us (I’m filling the regular name and description fields in French, and using the custom fields to translate to English). Then I can create my own print formats which will display the right field based on the requested print language.

I was tempted to code my own multilingual content translation system, but for expediency’s sake, we settled on simple bilingual translation of a few critical fields. For other fields, we’re using the standard ERPNext dictionary translation system. We’re still at the development stage, so I can’t tell you how well (or not) this works in real-world conditions.

Here’s a Jinja snippet that displays translated item names for a Sales Order print format (not final formatting by far, just a quick test):

{% set lang_code = frappe[“lang”] %}
Print language is {{lang_code}}; item names in that language:

<ul>
    {% for row in doc.items %}
    <li>{% if lang_code == "fr-CA" %}
            {{frappe.db.get_value("Item", row.item_code, "item_name")}}
        {% elif lang_code[:2] == "en" %}
            {{frappe.db.get_value("Item", row.item_code, "custom_item_name_en_us")}}
        {% else %}
            [no translation available in that language]
        {% endif %}
    </li>
    {% endfor %}
</ul>

Haven’t tried version 16 yet, but based on the changelog, I’m not expecting significant improvements to the translation system.