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

stringsdict: Plural form zero is unsupported #6368

Closed
1 task done
x-sheep opened this issue Aug 2, 2021 · 7 comments
Closed
1 task done

stringsdict: Plural form zero is unsupported #6368

x-sheep opened this issue Aug 2, 2021 · 7 comments
Assignees
Labels
enhancement Adding or requesting a new feature.
Milestone

Comments

@x-sheep
Copy link

x-sheep commented Aug 2, 2021

Describe the issue

I'm trying the stringsdict support in the bleeding edge version (as implemented in translate/translate#4398, see also #623).

The stringsdict implementation allows the category zero to be used in all languages, but Weblate does not recognize this, and only uses the categories as defined in CLDR. This leads to a mismatch between the keys being displayed and the attached values.

I already tried

  • I've read and searched the docs and did not find the answer there.
    If you didn’t try already, try to search there what you wrote above.

To Reproduce the issue

Steps to reproduce the behavior:

  1. Create a iOS project with a stringsdict file in English.
  2. Create a translation component with the stringsdict format.
  3. Edit the string with the attached plural.
  4. Observe an incorrect number of edit fields.

Expected behavior

Three fields should be displayed:

  • English, Zero
  • English, Singular
  • English, Plural

Screenshots

Screenshot 2021-08-02 at 11 15 16

Server configuration and status

Weblate installation: Docker

 * Weblate: 4.8-1a32f00020
 * Django: 3.2.5
 * siphashc: 2.1
 * translate-toolkit: 3.3.6
 * lxml: 4.6.3
 * Pillow: 8.3.1
 * bleach: 3.3.1
 * python-dateutil: 2.8.2
 * social-auth-core: 4.1.0
 * social-auth-app-django: 4.0.0
 * django-crispy-forms: 1.12.0
 * oauthlib: 3.1.1
 * django-compressor: 2.4.1
 * djangorestframework: 3.12.4
 * django-filter: 2.4.0
 * django-appconf: 1.0.4
 * user-agents: 2.2.0
 * filelock: 3.0.12
 * setuptools: 40.8.0
 * jellyfish: 0.8.2
 * openpyxl: 3.0.7
 * celery: 5.1.2
 * kombu: 5.1.0
 * translation-finder: 2.9
 * weblate-language-data: 2021.5
 * html2text: 2020.1.16
 * pycairo: 1.16.2
 * pygobject: 3.30.4
 * diff-match-patch: 20200713
 * requests: 2.26.0
 * django-redis: 5.0.0
 * hiredis: 2.0.0
 * sentry_sdk: 1.3.1
 * Cython: 0.29.24
 * misaka: 2.1.1
 * GitPython: 3.1.18
 * borgbackup: 1.1.17
 * pyparsing: 2.4.7
 * pyahocorasick: 1.4.2
 * python-redis-lock: 3.7.0
 * Python: 3.7.3
 * Git: 2.20.1
 * psycopg2: 2.9.1
 * psycopg2-binary: 2.9.1
 * phply: 1.2.5
 * chardet: 4.0.0
 * ruamel.yaml: 0.17.10
 * tesserocr: 2.5.2
 * akismet: 1.1
 * boto3: 1.18.11
 * zeep: 4.0.0
 * aeidon: 1.9
 * iniparse: 0.5
 * mysqlclient: 2.0.3
 * Mercurial: 5.8.1
 * git-svn: 2.20.1
 * git-review: 2.1.0
 * Redis server: 6.2.3
 * PostgreSQL server: 13.3
 * Database backends: django.db.backends.postgresql
 * Cache backends: default:RedisCache, avatar:FileBasedCache
 * Email setup: django.core.mail.backends.dummy.EmailBackend: 127.0.0.1
 * OS encoding: filesystem=utf-8, default=utf-8
 * Celery: redis://cache:6379/1, redis://cache:6379/1, regular
 * Platform: Linux 5.10.25-linuxkit (x86_64)

Weblate deploy checks

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/latest/admin/install.html#collecting-errors
?: (weblate.I028) Backups are not configured, it is highly recommended for production use
        HINT: https://docs.weblate.org/en/latest/admin/backup.html
@nijel nijel added the enhancement Adding or requesting a new feature. label Aug 2, 2021
@nijel nijel added this to the 4.8 milestone Aug 2, 2021
@nijel nijel self-assigned this Aug 2, 2021
@nijel nijel closed this as completed in f6de4e4 Aug 2, 2021
@github-actions
Copy link

github-actions bot commented Aug 2, 2021

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.

nijel added a commit that referenced this issue Aug 2, 2021
@x-sheep
Copy link
Author

x-sheep commented Aug 3, 2021

I still only see two edit fields instead of three. While "Zero" and "Singular" are correctly labeled, the other category is still dropped.

I only ran docker compose pull to upgrade to the latest bleeding version.

@nijel
Copy link
Member

nijel commented Aug 3, 2021

You will have to recreate affected components to apply this fix (weblate loadpo --force project/component might work as well, but I'm not sure with that).

@x-sheep
Copy link
Author

x-sheep commented Aug 3, 2021

I already recreated the component manually. weblate loadpo --force (my component) ran successfully, but didn't fix the problem:

Screenshot 2021-08-03 at 14 53 17

nijel added a commit that referenced this issue Aug 5, 2021
@nijel
Copy link
Member

nijel commented Aug 5, 2021

Ah, there is one more thing missing. I've just fixed it in git, you can apply the fix in the database right now:

weblate shell -c 'from weblate.lang.models import Plural; from django.db.models import F; Plural.objects.filter(source=Plural.SOURCE_STRINGSDICT).update(number=F("number") + 1)'

@x-sheep
Copy link
Author

x-sheep commented Aug 6, 2021

After running the fix listed above, everything works 👍

@nijel
Copy link
Member

nijel commented Aug 6, 2021

Great, thanks for testing this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Adding or requesting a new feature.
Projects
None yet
Development

No branches or pull requests

2 participants