Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Java Properties components fail with project-wide JSON Customize Add-on #11476

Closed
2 tasks done
fkressmann opened this issue Apr 24, 2024 · 2 comments
Closed
2 tasks done
Assignees
Labels
bug Something is broken.
Milestone

Comments

@fkressmann
Copy link

Describe the issue

Situation: One project with multiple components. Some of them using file format 'Java Properties (UTF-8)', some of them 'Json nested structure file'.
Previously all JSON components had the JSON customize Add-on installed.

Now that project-wide Add-ons are available:
When installing the 'Customize JSON output' Add-on project-wide, my Java components fail parsing. I detected this this morning cause I got a lot of emails during the night, probably from scheduled tasks checking out the repos.
Error message in the emails: 'Translation' object has no attribute 'file_format'

When going to the component settings and trying to save, I get the following error on the Monolingual base language file field: Could not parse translation base file: 'Translation' object has no attribute 'file_format'

After uninstalling this Add-on project-wide and putting it again on the individual JSON components, all works fine again.

I'm not entirely sure if this is a bug or expected behavior. I would expect the JSON Add-on to just ignore non-json components - but one could argue that the Add-on needs o be installed on every component if it does not apply to all components of the project...

What do you guys think?

As always, thanks and have a nice day!
/Felix

I already tried

  • I've read and searched the documentation.
  • I've searched for similar filed issues in this repository.

Steps to reproduce the behavior

  1. Have a project with JSON and Java components
  2. Add the 'Customize JSON output' project-wide
  3. Go back to the project page, the Java components will soon appear 'locked'
  4. Edit a Java component, go to 'Files' tab, try to save, error message comes up

Expected behavior

Project- or site-wide Add-ons ignore components which they (more or less obviously) don't apply to.

Screenshots

No response

Exception traceback

gunicorn stderr | [2024-04-24 07:02:08,258: ERROR/462] project/component/en: failed storage post-load add-on: weblate.json.customize: 'javautf8file' object has no attribute 'dump_args'
gunicorn stderr | [2024-04-24 07:02:08,258: WARNING/462] add-on weblate.json.customize failed: AttributeError: 'javautf8file' object has no attribute 'dump_args'
gunicorn stderr | [2024-04-24 07:02:08,258: WARNING/462] Template parse error: AttributeError: 'Translation' object has no attribute 'file_format'

How do you run Weblate?

Docker container

Weblate versions

Weblate: 5.5
Django: 5.0.4
siphashc: 2.4.1
translate-toolkit: 3.12.2
lxml: 5.2.1
pillow: 10.3.0
nh3: 0.2.17
python-dateutil: 2.9.0.post0
social-auth-core: 4.5.3
social-auth-app-django: 5.4.0
django-crispy-forms: 2.1
oauthlib: 3.2.2
django-compressor: 4.4
djangorestframework: 3.15.1
django-filter: 24.2
django-appconf: 1.0.6
user-agents: 2.2.0
filelock: 3.13.4
rapidfuzz: 3.8.1
openpyxl: 3.1.2
celery: 5.4.0
django-celery-beat: 2.6.0
kombu: 5.3.7
translation-finder: 2.16
weblate-language-data: 2024.3
html2text: 2024.2.26
pycairo: 1.26.0
PyGObject: 3.48.2
diff-match-patch: 20230430
requests: 2.31.0
django-redis: 5.4.0
hiredis: 2.3.2
sentry-sdk: 1.45.0
Cython: 3.0.10
misaka: 2.1.1
GitPython: 3.1.43
borgbackup: 1.2.8
pyparsing: 3.1.2
ahocorasick_rs: 0.22.0
python-redis-lock: 4.0.0
charset-normalizer: 3.3.2
Python: 3.12.3
Git: 2.39.2
psycopg: 3.1.18
psycopg-binary: 3.1.18
phply: 1.2.6
ruamel.yaml: 0.18.6
tesserocr: 2.6.3
boto3: 1.34.88
zeep: 4.2.1
aeidon: 1.14.1
iniparse: 0.5
mysqlclient: 2.2.4
Mercurial: 6.7.2
git-svn: 2.39.2
git-review: 2.4.0
PostgreSQL server: 15.5
Database backends: django.db.backends.postgresql
PostgreSQL implementation: psycopg3 (binary)
Cache backends: default:RedisCache, avatar:FileBasedCache
Email setup: django.core.mail.backends.smtp.EmailBackend: email-smtp.eu-west-1.amazonaws.com
OS encoding: filesystem=utf-8, default=utf-8
Celery: redis://:ARdsfGs5gsA6GdgRs3gmddds5g63FAWRG63tg@tool-weblate-cache:6379/1, redis://:ARdsfGs5gsA6GdgRs3gmddds5g63FAWRG63tg@tool-weblate-cache:6379/1, regular
Platform: Linux 5.14.0-284.50.1.el9_2.x86_64 (x86_64)

Weblate deploy checks

System check identified some issues:

INFOS:
?: (weblate.I021) Error collection is not set up, it is highly recommended for production use
	HINT: https://docs.weblate.org/en/weblate-5.5/admin/install.html#collecting-errors

System check identified 1 issue (1 silenced).

Additional context

No response

@nijel nijel added the bug Something is broken. label Apr 24, 2024
@nijel nijel added this to the 5.5.1 milestone Apr 24, 2024
@nijel nijel self-assigned this Apr 24, 2024
@nijel
Copy link
Member

nijel commented Apr 24, 2024

@ParthS007 Another case not covered in the PR, working on a fix.

@nijel nijel closed this as completed in 61fbc98 Apr 24, 2024
Copy link

Thank you for your report; the issue you have reported has just been fixed.

  • In case you see a problem with the fix, please comment on this issue.
  • In case you see a similar problem, please open a separate issue.
  • If you are happy with the outcome, don’t hesitate to support Weblate by making a donation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something is broken.
Projects
None yet
Development

No branches or pull requests

2 participants