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

Plural count and formula not saved on reboot for built-in locales #4487

Closed
TruffeCendree opened this issue Sep 11, 2020 · 6 comments
Closed
Assignees
Labels
bug Something is broken.
Milestone

Comments

@TruffeCendree
Copy link

TruffeCendree commented Sep 11, 2020

Describe the bug

Plural count and formula not saved on reboot for built-in locales.

To Reproduce

  • Edit a locale (eg. French) with the following settings : plural count: 3, plural formula: (n == 0) ? 0 : (n == 1 ? 1 : 2)
  • Restart the weblate instance (ex. docker-compose restart weblate)
  • French plural count and formula are restored to defaults.

Please note that I created a new locale (fr_US). For this locale, count and formula are persisted after reboot.

Screenshots

image

Server configuration and status

  • Weblate: 4.2.2
  • Django: 3.1.1
  • siphashc: 1.3
  • Whoosh: 2.7.4
  • translate-toolkit: 3.0.0
  • lxml: 4.5.2
  • Pillow: 7.2.0
  • bleach: 3.1.5
  • python-dateutil: 2.8.1
  • social-auth-core: 3.3.3
  • social-auth-app-django: 4.0.0
  • django-crispy-forms: 1.9.2
  • oauthlib: 3.1.0
  • django-compressor: 2.4
  • djangorestframework: 3.11.1
  • django-filter: 2.3.0
  • django-appconf: 1.0.4
  • user-agents: 2.1
  • filelock: 3.0.12
  • setuptools: 40.8.0
  • jellyfish: 0.8.2
  • openpyxl: 3.0.5
  • celery: 4.4.7
  • kombu: 4.6.11
  • translation-finder: 2.1
  • html2text: 2020.1.16
  • pycairo: 1.16.2
  • pygobject: 3.30.4
  • diff-match-patch: 20200713
  • requests: 2.24.0
  • django-redis: 4.12.1
  • hiredis: 1.1.0
  • sentry_sdk: 0.16.5
  • Cython: 0.29.21
  • misaka: 2.1.1
  • GitPython: 3.1.7
  • borgbackup: 1.1.13
  • pyparsing: 2.4.7
  • Python: 3.7.3
  • Git: 2.20.1
  • psycopg2: 2.8.5
  • psycopg2-binary: 2.8.5
  • phply: 1.2.5
  • chardet: 3.0.4
  • ruamel.yaml: 0.16.10
  • tesserocr: 2.5.1
  • akismet: 1.1
  • boto3: 1.14.53
  • zeep: 3.4.0
  • aeidon: 1.7.0
  • iniparse: 0.5
  • mysqlclient: 2.0.1
  • Mercurial: 5.5.1
  • git-svn: 2.20.1
  • git-review: 1.28.0
  • hub: 2.13.0
  • lab: 0.16
  • Redis server: 4.0.14
  • PostgreSQL server: 11.9
  • Database backends: django.db.backends.postgresql
  • Cache backends: default:RedisCache, avatar:FileBasedCache
  • Email setup: django.core.mail.backends.smtp.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.3.0-1035-aws (x86_64)
@TruffeCendree TruffeCendree changed the title Plural count and formula not saved on reboot for default locales Plural count and formula not saved on reboot for built-in locales Sep 11, 2020
@nijel
Copy link
Member

nijel commented Sep 11, 2020

The shipped language definitions are always synced on container startup using setuplang.

The language and plurals definitions are built on expectation that either file format includes the plural definition and if not, it sticks to CLDR.

@nijel nijel added the question This is more a question for the support than an issue. label Sep 11, 2020
@github-actions
Copy link

This issue looks like a support question. We try to answer these reasonably fast, but in case you are looking for faster resolution, please consider purchasing support subscription and make Weblate stronger.

@dada-amater
Copy link

Our plugin uses eval() for plural formula. It is written in PHP. We need to put brackets to the formula manually. Every time we reboot the service, we need to change it again. Is it possible to skip setuplang on reboot?

@nijel
Copy link
Member

nijel commented Oct 3, 2020

@dada-amater patches are welcome to make it configurable. Asking same question on several places is not that welcome.

Our plugin uses eval() for plural formula. It is written in PHP.

Your plugin is broken if it needs changing plural formula from Gettext. Use something that handles it correctly. For example, https://github.com/phpmyadmin/motranslator does it properly and safely (without using eval).

dada-amater referenced this issue in WeblateOrg/scripts Oct 3, 2020
Otherwise we miss language name updates.

See WeblateOrg/language-data#3
@nijel
Copy link
Member

nijel commented Oct 3, 2020

Revising this again and I think found the issue. There is implicit setuplang invocation on database migration which is supposed to add newly defined languages and not updating existing ones. This flag is however not honored for plurals, so these are updated always...

@nijel nijel self-assigned this Oct 3, 2020
@nijel nijel added bug Something is broken. and removed question This is more a question for the support than an issue. labels Oct 3, 2020
@nijel nijel added this to the 4.3 milestone Oct 3, 2020
@nijel nijel closed this as completed in 696ef59 Oct 3, 2020
@github-actions
Copy link

github-actions bot commented Oct 3, 2020

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, consider supporting Weblate by donating.

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

3 participants