Translating Custom Apps

Hello,

I can’t translate any external custom apps for some reason.

I’m trying to translate some Webshop Modals / Popups and It just won’t work.

Already did the following:

  • Moved the file from templates/generators/item to public/js
  • Added the Translation Tags __(‘Example’),
  • Added import ‘./js/item_configure’ to web.bundle.js
  • Confirmed that web_include_js = “web.bundle.js” is present in hooks.py
  • Ran bench build and bench build-message-files
  • Also tried bench get-untranslated, but the JS strings and variables are still not there.
  • Checked the pt.csv for the translations and they’re not there.
  • Translations are not working when visiting the page.

Any tips?

Hi.

You can translate custom apps in Frappe using CSV files. Here’s an example from a custom app, check_run.

The translations are stored in the standard translations folder with locale-specific CSV files. For example, here’s the British English file: check_run/translations/en-GB.csv

Separately, I also maintain a GitHub Action to help translate Markdown files in the docs/ folder of your app. This is useful if you want multilingual documentation alongside your app: translate-docs GitHub Action

2 Likes

Thank you for your help,

Can you use that method to also translate Javascript?

HTML just translates perfectly, but when it comes to Javascript it simply doesn’t parse the translation strings. If I do bench get-untranslated, those untranslated strings will never show up.

File in question: