Closed muniter closed 3 years ago
I can confirm this! It is broken since a long time. Even more broken in 13-beta! see this issue
I dug into the code and fixed the encoding stuff, but than it always OVERRIDES all my previous translations in myapp/translations/de.csv
and does not realize that I already translated some of the strings.
This is a long broken
@stephenBDT I'm running a thread on the forum about the issues of translating, If you want to check it out. https://discuss.erpnext.com/t/translation-not-working-for-custom-apps/64522
def write_csv_file(path, app_messages, lang_dict): """Write translation CSV file.
:param path: File path, usually `[app]/translations`.
:param app_messages: Translatable strings for this app.
:param lang_dict: Full translated dict.
"""
app_messages.sort(key = lambda x: x[1])
from csv import writer
# with open(path, 'wb') as msgfile:
with open(path, 'w', encoding='utf-8') as msgfile:
w = writer(msgfile, lineterminator='\n')
for p, m in app_messages:
t = lang_dict.get(m, '')
# strip whitespaces
t = re.sub('{\s?([0-9]+)\s?}', "{\g<1>}", t)
# w.writerow([p.encode('utf-8') if p else '', m.encode('utf-8'), t.encode('utf-8')])
w.writerow([p if p else '',m, t])
Description of the issue
I'm trying to update some translations after using the
get-untranslated
command, I edit the new file, when It's time to update the translation it crashes. I reported a month ago the error onget-untranslated
https://github.com/frappe/frappe/issues/11488 now It works getting the untranslated strings, but the next part of the process is broken.Seems to be related to the same issue of mismatch of types on opening and writing. It would be really nice for this to be fixed seems for over a year It has been impossible to do translations as explained in the documentation
It would be really important for a complete process to be tested before submitting a fix that leads to another road block, meaning exporting untranslated strings, translating, updating and seeing if they show up in the UI (Which I haven't been able to do)
Context information (for bug reports)
Output of
bench version
Steps to reproduce the issue
bench get-untranslated es ./my-trans
bench update-translations es ./my-trans.csv ./my-completed-trans.csv
Observed result
Expected result
Stacktrace / full error message
Additional information
Running under docker, with provided devcontainers set up.