Try ERPNext Buy Support Partners Foundation Foundation Members

How to translate custom apps?

Hi there,

sorry to post, but i can’t find other post on how to translate a custom app. I got infos at:

https://frappe.github.io/frappe/user/en/guides/basics/translations

but can’t figure out how to it work.

Should I add translates/[lang].csv into the custom app?

Thx in advance

You need to export the untranslated text first, make of copy of it and replace the text with translated text and import it back into the system.

Just follow these steps:

  1. To find untranslated strings, run bench get-untranslated [lang] [path]
  2. Add the translated strings in another file in the same order
  3. run bench update-translations [lang] [path of untranslated strings] [path of translated strings]

Let us know if you get any errors.

3 Likes

@KanchanChauhan thanks for the hint, it’s not clear what the [path] is referred to, can you post some examples?

[path] would be path of file like/Users/xyz/Documents/2016-06-17

Sorry i’m not getting you …let me explain …

I’ve a custom app and i’d like to translate from english to italian:

DocType name
DocType field name and option for Select if present

How to do that?

Thx in advance

getting an error:

bench get-untranslated it /home/frappe/frappe-bench/apps/myapp/myapp/myapp/doctype/cash_ward_refuse/cash_ward_refuse.py
Traceback (most recent call last):
  File "/usr/lib/python2.7/runpy.py", line 174, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 79, in <module>
    main()
  File "/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 16, in main
    click.Group(commands=commands)(prog_name='bench')
  File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 716, in __call__
    return self.main(*args, **kwargs)
  File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 696, in main
    rv = self.invoke(ctx)
  File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 1060, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 1060, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 889, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 534, in invoke
    return callback(*args, **kwargs)
  File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/decorators.py", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/commands/__init__.py", line 24, in _func
    ret = f(frappe._dict(ctx.obj), *args, **kwargs)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/commands/translate.py", line 50, in get_untranslated
    frappe.translate.get_untranslated(lang, untranslated_file, get_all=all)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/translate.py", line 576, in get_untranslated
    messages.extend(get_messages_for_app(app))
  File "/home/frappe/frappe-bench/apps/frappe/frappe/translate.py", line 300, in get_messages_for_app
    messages.extend(get_messages_from_custom_fields(app_name=app))
  File "/home/frappe/frappe-bench/apps/frappe/frappe/translate.py", line 407, in get_messages_from_custom_fields
    if cf['fieldtype'] == 'Selection' and cf.get('options'):
KeyError: u'fieldtype'

Hi,

Did you get any solution, facing same issue, want to translate custom app to other language? It may not be a custom translation, google translation would also work. Any quick fix?

Actually I’m using custom translations …check for translation l’installazione not search bar

I have similar issues.
I only want to translate the strings of my custom app. Not other frappe strings…
If i do bench get-untranslated I do get all the untranslated stings.
I can not see an --app option for this command?!

How do I make this app specific?!

Thank you

Its not supported to translate a certain app,
so you can do the following:

bench get-untranslated
bench update-translations [lang] [source-path] [source-path] 

You see above I used the same file for translation,
after this you will find a translations file in each app and you can translate the app you need.

Warning: this could mess up Erpnext and Frappe translations so either take a backup of all apps translation files, or translate locally.

Please Help me to understand this…
I run

bench get-untranslated ./ToBeTranslated

I get 420 missing translations and an accordingly long file.
I only want to translate some of those Strings for my app.
So when using the ToBeTranslated File as first [source-path] , how does the second `[source-path] has to look like when running

bench update-translations [lang] [source-path] [source-path] 

With everything I tried so far, I got the csv file without any translations.
That also would be fine, If I knew that I can translate in this csv without having to worry that it will be overridden as soon as I get more strings…
Also now I only get the strings that should be translated that origninate from a file in my .csv file.
No more do I see any strings that come from DocTypes…
What am I doing wrong?

Thank you