WeblateOrg / weblate

Web based localization tool with tight version control integration.
https://weblate.org/
GNU General Public License v3.0
4.63k stars 1.02k forks source link

Language code style setting is ignored #4100

Closed Niklas81 closed 4 years ago

Niklas81 commented 4 years ago

As previously described in #3746 and #3285: From component -> Manage -> Settings -> Files I change the last setting Language code style to BCP style using hyphen as a separator, including country code, but this has no effect. When new files are generated, they are created as e.g. bn_BD_common.json for Bengali Bangladesh. Same file is generated when I change this setting to BCP style using hyphen as a separator

To Reproduce

This is done on a fresh installation of Weblate 4.1.1 running under Docker on my local machine, using image weblate/weblate:latest that was pulled from Docker hub 9 days ago.

Below is a screenshot of this settings page.

Weblate-component-settings-files

Expected behavior I was expecting the file bn-BD_common.json to be created.

Server configuration and status

Output of docker-compose exec weblate weblate list_versions:

* Weblate: 4.1.1
 * Django: 3.0.7
 * siphashc: 1.3
 * Whoosh: 2.7.4
 * translate-toolkit: 3.0.0
 * lxml: 4.5.1
 * Pillow: 7.1.2
 * bleach: 3.1.5
 * python-dateutil: 2.8.1
 * social-auth-core: 3.3.3
 * social-auth-app-django: 3.4.0
 * django-crispy-forms: 1.9.1
 * oauthlib: 3.1.0
 * django-compressor: 2.4
 * djangorestframework: 3.11.0
 * 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.1
 * celery: 4.4.5
 * kombu: 4.6.10
 * translation-finder: 2.1
 * html2text: 2020.1.16
 * pycairo: 1.16.2
 * pygobject: 3.30.4
 * diff-match-patch: 20181111
 * requests: 2.24.0
 * django-redis: 4.12.1
 * hiredis: 1.0.1
 * sentry_sdk: 0.15.1
 * Cython: 0.29.20
 * misaka: 2.1.1
 * GitPython: 3.1.3
 * 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.6
 * zeep: 3.4.0
 * aeidon: 1.7.0
 * iniparse: 0.5
 * mysqlclient: 1.4.6
 * Mercurial: 5.4.1
 * git-svn: 2.20.1
 * git-review: 1.28.0
 * hub: 2.13.0
 * lab: 0.16
 * Redis server: 5.0.9
 * PostgreSQL server: 11.8
 * Database backends: django.db.backends.postgresql
 * Cache backends: default:RedisCache, avatar:FileBasedCache
 * Email setup: django.core.mail.backends.smtp.EmailBackend: smtp.yandex.com
 * OS encoding: filesystem=utf-8, default=utf-8
 * Celery: redis://cache:6379/1, redis://cache:6379/1, regular
 * Platform: Linux 5.7.5-arch1-1 (x86_64)

Weblate deploy checks

Output of docker-compose exec --user weblate weblate weblate check --deploy:

SystemCheckError: System check identified some issues:

CRITICALS:
?: (weblate.E003) Cannot send e-mail ([Errno 99] Cannot assign requested address), please check EMAIL_* settings.
    HINT: https://docs.weblate.org/en/weblate-4.1.1/admin/install.html#out-mail

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.1.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.1.1/admin/backup.html

System check identified 7 issues (1 silenced).

This bug was marked as fixed in version 4.1; however the bug appears to still be alive and well.. :smile:

nijel commented 4 years ago

The problem is slightly different here - the Bengali is spoken in India and Bangladesh, so there is not a one country to choose in this case. Weblate cannot address such ambiguity for you and you should choose language with country that matches your expectation.

github-actions[bot] commented 4 years ago

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

Niklas81 commented 4 years ago

The issue here is that an underscore _ is used as a separator instead of a hyphen -. As stated in my bug report, this occurs also when country code is supposed to be incuded in the name of that file that's created. For my usage, I will still not need this to work as I need the countrycode to be in lower case letters anyway - so I have to create new language files outside of Weblate. This remains however an unresolved issue as the language code style clearly states that a hyphen should be used: BCP style using hyphen as a separator, including country code.

nijel commented 4 years ago

Ah, sorry for misunderstanding the initial post. Anyway the issue should be fixed by a36ba0cdd616c7db5083029758ff060690161bde

Niklas81 commented 4 years ago

Cool, thanks!