How to add translation to custom application?

I’ve created an application with bench new-app test. How can I generate translation files for it now? There is no languages.txt inside

Have you tried adding a csv file inside the translation folder? (e.g. with erpnext)

solved the problem. In order to translate application, you have to follow these steps:

  • First you execute the following command to generate a text file with untranslated content:
bench get-untranslated --app {appname} {lang} {output_file}
  • Then you translate it from english to your language and from text file to .csv. Basically, for a file like:
Back
Sheep
Work

You should make a translation file like:

Back, Zurück,
Sheep, Schafe,
Work, Arbeit,
  • And then you move the .csv you’ve made to the apps/{appname}/{appname}/translations/{lang}.csv (if there is no ‘translations’ directory available, you have to create it) and restart bench.

  • Now, choosing the language you’ve translated app to in account’s profile settings should show you the application with translated lines instead of the english defaults.