Open dvtate opened 2 months ago
Good finding, thank you :+1:
Maybe that problem could be solved by adding a translation check on transifex: https://help.transifex.com/en/articles/6241794-setting-translation-checks#h_317a8b70f5
@dvtate Can you provide the list of defective placeholders? I will fix them. Minutes ago I added translation checks and if it works like intended it should fix the issue.
I pulled and re-ran the script and here's the list of invalid placeholders: list.txt
I'm not sure how to check the bundles in the dist/
folder but it seems there's there's still some problems there.
I used the attached python script to generate this list translation_check.py.txt
My script might not be checking all the translations
⚠️ This issue respects the following points: ⚠️
Bug description
I was uploading some files to my Nextcloud instance which I have the language set to Danish and noticed this message "{sekunder} sekunder tilbage". I assumed the translator mistakenly translated the template parameter causing it to not get substituted.
After seeing this I didn't find it in the any of the l10n/*.json files but did find it in some compiled javascript files in
dist/
which seems suspicious:Why does this happen??
I also found some problems in the l10n json files. (for example)
So I threw together a script to get all the translations with fields not in the original English version.
I think we should include this script (or some better-written version of it) as a CI/unit test before releasing.
check_translations.py
```python import subprocess import glob import os import json import re translation_dirs = (subprocess .check_output([ 'find', '.', '-type', 'd', '-name', 'l10n' ]) .decode('utf-8') .split('\n')) files = [ # [file path, parsed json] ] for d in translation_dirs: for path in glob.glob(d + "/*.json"): if os.stat(path).st_size != 0: with open(path) as file: try: files.append([path, json.load(file)]) except Exception as e: print('json load failed: ', e) for t in files: for t_en in t[1]['translations']: t_to = t[1]['translations'][t_en] en_fields = re.findall('\\{([^}]+)\\}', t_en) if type(t_to) == list: # plurals? for tt in t_to: for f in re.findall('\\{([^}]+)\\}', tt): if f not in en_fields: print(t[0] + ': invalid field {' + f + '}') else: for f in re.findall('\\{([^}]+)\\}', t_to): if f not in en_fields: print(t[0] + ': invalid field {' + f + '}') ```Steps to reproduce
Expected behavior
Translations should probably not translate the template params
Installation method
Other Community project
Nextcloud Server version
29
Operating system
Other
PHP engine version
PHP 8.2
Web server
Nginx
Database engine version
MariaDB
Is this bug present after an update or on a fresh install?
None
Are you using the Nextcloud Server Encryption module?
None
What user-backends are you using?
Configuration report
List of activated Apps
No response
Nextcloud Signing status
No response
Nextcloud Logs
No response
Additional info
I have installed nextcloud from the Arch Linux repos