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

Add translations to QATrack+ #620

Open
wants to merge 86 commits into
base: translations
Choose a base branch
from

Conversation

leducvin
Copy link

This pull request is for a first version of QATrack+ with working translations and an initial partial translation to French.

In this work, the following was done:

  • locale directories were created in the root of the project and in each app subdirectory to be translated; this allows Django to find the message files and generate per-app message files instead of one big message files for all strings
  • in settings.py:
  • message files were generated with django-admin makemessages (or alternatively python manage.py makemessages)
  • messages were compiled with django-admin compilemessages (or alternatively python manage.py compilemessages)
  • message files were commited to repo, but compiled message files were not
  • makefile was updated with minor changes to yapf and flake8 targets and new targets messages and make-messages
  • rudimentary docs for using the translations were added
  • in urls.py, path('i18n/', include('django.conf.urls.i18n')), was added. This could be considered for future use and could be removed or commented out for the moment. See https://docs.djangoproject.com/en/2.2/topics/i18n/translation/#the-set-language-redirect-view

For the moment, the language is set globally via local_settings.py by using, for example, LANGUAGE_CODE = "fr".
There is support in Django for using a display language based on the browser preferences or by including a widget in the frontend, but this was not activated at present.

LANGUAGE_CODE = "en" was added to test_settings.py so that tests would pass even if another language is used in local_settings.py.

The partial translations to French were made using a local instance of Weblate.

Note that as per the developer guide, yapf was run, which produced a lot of diffs.

Message will now only show after 3 failed pings. Ping interval is
configurable with PING_INTERVAL_S setting and message
is less intrusive.
Some reports were not taking into account the active status
of the unit as well as the active status of the UTC. This patch
resolves that problem.

Fixes issue qatrackplus#554
…n attempt to alleviate auto save contention exceptions in SQL Server
@leducvin
Copy link
Author

Update

Added localization of datetime formats

To do so, dates.py needed to be changed to use Django's utils.formats.get_format() instead of using settings.FORMAT[0] directly.

Note: there are some hard-coded datetime formats in a couple of the templates, e.g.:

  • {{ something|date:"Y-m-d H:i:s" }}
  • {{ something|date:"dMy" }}

We should probably find a way in the future that these can be customized in the future. For the moment, they are being localized by Django when a view is rendered, but they can be a little inconsistent with the choices made by the translator in qatrack/formats.

Included more detailed docs on translations

Basic instructions on how to add a translation, and a new entry in the config docs for translating the DATETIME_HELP variable.

Translating DATETIME_HELP, which provides help tooltip in the frontend, required redefining it in local_settings.py to override the default value for English provided in settings.py. There may be a better way to do this.

@randlet
Copy link
Contributor

randlet commented Jul 8, 2022

Awesome! I have currently merged this in the branch 3.2.0_translations. A few minor merge conflicts but overall the merge went very smoothly. I'm out of time for now but will test things more later and merge into 3.2.0.

Thanks for all the hard work that went into this so far!

@randlet randlet mentioned this pull request Jul 19, 2022
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

Successfully merging this pull request may close these issues.

None yet

3 participants