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

i18next JSON base language file wrong parsed #6869

Closed
2 tasks done
MAGICCC opened this issue Nov 25, 2021 · 5 comments
Closed
2 tasks done

i18next JSON base language file wrong parsed #6869

MAGICCC opened this issue Nov 25, 2021 · 5 comments

Comments

@MAGICCC
Copy link

MAGICCC commented Nov 25, 2021

Describe the issue

Hello,

I wanted to give this project a try and installed it as docker container and imported a project, but seems one string of the base language file got imported wrongly.
This is a nogo for obv reasons and I may need to check now all strings manually...
How can I fix the string in weblate?

I already tried

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

Steps to reproduce the behavior

  1. Import https://github.com/mailcow/mailcow-dockerized staging branch
  2. mailbox.booking_0 'converts to' mailbox.booking https://github.com/mailcow/mailcow-dockerized/blob/staging/data/web/lang/lang.en.json#L723

Expected behavior

Detects strings right

Screenshots

image

Exception traceback

N/A

How do you run Weblate?

Docker container

Weblate versions

  • Weblate: 4.9.1
  • Django: 3.2.9
  • siphashc: 2.1
  • translate-toolkit: 3.5.1
  • lxml: 4.6.4
  • Pillow: 8.4.0
  • bleach: 4.1.0
  • python-dateutil: 2.8.2
  • social-auth-core: 4.1.0
  • social-auth-app-django: 5.0.0
  • django-crispy-forms: 1.13.0
  • oauthlib: 3.1.1
  • django-compressor: 2.4.1
  • djangorestframework: 3.12.4
  • django-filter: 21.1
  • django-appconf: 1.0.5
  • user-agents: 2.2.0
  • filelock: 3.4.0
  • setuptools: 58.5.3
  • jellyfish: 0.8.9
  • openpyxl: 3.0.9
  • celery: 5.2.0
  • kombu: 5.2.2
  • translation-finder: 2.10
  • weblate-language-data: 2021.6
  • html2text: 2020.1.16
  • pycairo: 1.16.2
  • pygobject: 3.38.0
  • diff-match-patch: 20200713
  • requests: 2.26.0
  • django-redis: 5.0.0
  • hiredis: 2.0.0
  • sentry_sdk: 1.5.0
  • Cython: 0.29.24
  • misaka: 2.1.1
  • GitPython: 3.1.24
  • borgbackup: 1.1.17
  • pyparsing: 3.0.6
  • pyahocorasick: 1.4.2
  • python-redis-lock: 3.7.0
  • Python: 3.9.2
  • Git: 2.30.2
  • psycopg2: 2.9.2
  • psycopg2-binary: 2.9.2
  • phply: 1.2.5
  • chardet: 4.0.0
  • ruamel.yaml: 0.17.17
  • tesserocr: 2.5.2
  • akismet: 1.1
  • boto3: 1.20.10
  • zeep: 4.1.0
  • aeidon: 1.10.1
  • iniparse: 0.5
  • mysqlclient: 2.1.0
  • Mercurial: 5.9.3
  • git-svn: 2.30.2
  • git-review: 2.1.0
  • Redis server: 6.2.6
  • PostgreSQL server: 13.5
  • Database backends: django.db.backends.postgresql
  • Cache backends: default:RedisCache, avatar:FileBasedCache
  • Email setup: django.core.mail.backends.smtp.EmailBackend: hosted.mailcow.de
  • OS encoding: filesystem=utf-8, default=utf-8
  • Celery: redis://cache:6379/1, redis://cache:6379/1, regular
  • Platform: Linux 5.4.0-88-generic (x86_64)

Weblate deploy checks

System check identified some issues:

WARNINGS:
?: (security.W004) You have not set a value for the SECURE_HSTS_SECONDS setting. If your entire site is served only over SSL, you may want to consider setting a value and enabling HTTP Strict Transport Security. Be sure to read the documentation first; enabling HSTS carelessly can cause serious, irreversible problems.
?: (security.W008) Your SECURE_SSL_REDIRECT setting is not set to True. Unless your site should be available over both SSL and non-SSL connections, you may want to either set this setting True or configure a load balancer or reverse-proxy server to redirect all connections to HTTPS.
?: (security.W012) SESSION_COOKIE_SECURE is not set to True. Using a secure-only session cookie makes it more difficult for network traffic sniffers to hijack user sessions.
?: (security.W018) You should not have DEBUG set to True in deployment.

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

System check identified 6 issues (1 silenced).

Additional context

No response

@nijel
Copy link
Member

nijel commented Nov 25, 2021

Weblate currently supports i18next JSON v3 which uses numeric suffix for plurals (see https://www.i18next.com/misc/json-format). In case you are using v4, the key is valid, but support for this is missing in Weblate, see #6689

@MAGICCC
Copy link
Author

MAGICCC commented Nov 25, 2021

Thanks, wasnt aware of these versions.
Seems it uses v3, but why it cuts off the _0 and not e.g. the _1 here: https://github.com/mailcow/mailcow-dockerized/blob/staging/data/web/lang/lang.en.json#L796

@nijel
Copy link
Member

nijel commented Nov 26, 2021

If it finds _0, it looks for other plurals. If _0 is not present the keys are handled as they are, see https://github.com/translate/translate/blob/b19fb6be15461a1413f67625b158ab9c73369ce5/translate/storage/jsonl10n.py#L362-L364

@MAGICCC
Copy link
Author

MAGICCC commented Nov 26, 2021

Thanks!
I suppose I need to redo the files on my end because theres no plurals available...

@MAGICCC MAGICCC closed this as completed Nov 28, 2021
@github-actions
Copy link

The issue you have reported is now resolved. If you don’t feel it’s right, please follow its labels to get a clue for further steps.

  • 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.

nijel added a commit that referenced this issue Dec 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants