How are translations handled 2024?

Dears, I was just about to update a translation in System Settings Doctype but was not able to find the translation *.csv in the frappe/frappe repo as I was used to.

Please let me know where and how I can add translations to the core. Thank you.

Short answer: the file is now called [lang].po (e.g. de.po for German) and translations can be added comfortably via the crowdin UI:

Here’s how you can manage po files for your custom apps (this is largely automated for frappe, erpnext, hrms and lms):

https://frappeframework.com/docs/user/en/bench/reference#translation-management

Here’s the PR that introduced this, with further info in the description:

If you find it more comfortable to translate directly in the ERPNext/Frappe UI, there’s In-Context Translation. In order to use this, you have to enable the Language “In-Context Translation” / “eo”, select this for your current user and use the modal to log into your Crowdin account.

3 Likes

@rmeyer Would this work for .tsx files (React apps) as well? I’ve added translation functions in my React app, but I’m not sure if the PO files will get generated for those strings. They are wrapped as __(“String”) in the app.

@rmeyer I would add Hungarian translation and translate as I was done on
https://translate.erpnext.com/

As today you and others using in Hungarian language, if ever want, is almost all my work, I just want to keep it updated.
Is it possible to add Hungarian and put me editor + approval ?

Would appreciate any positive response.

Yes, in principle strings can be extracted from any file type. Check frappe’s babel_extractors.csv, which maps file paths to extractor functions. You’ll have to add one for .tsx. This can either be a real .tsx parser or you can use the existing pattern matcher for html-like templates (Jinja, JS Microtemplates).

So, for example, you’d create [app]/babel_extractors.csv and add the following line:

**.tsx,frappe.gettext.extractors.html_template.extract

This has some limitations compared to a real parser: backticks as quotes, the context parameter and translation statements formatted over multiple lines might not work as expected.

1 Like

Hey guys, believe it or not, this might be one of the most critical things to get right with frappe / erpnext, specially in the website / frontend part.

I’m still wondering how can we translate the following in a webshop:

  • Categories
  • Attributes
  • Variants
  • Products / Items
  • Prev & Next ( Switch Page Buttons )

Are there any solutions yet for dynamic variables?

Done :white_check_mark:

1 Like

How can I keep my custom translations when upgrading? For example, it is essential to retain the translations I have completed when translations on Crowdin have not been merged in a timely manner or when there is a need for personalization.

Custom translations via the Translation doctype or via custom apps are always retained.