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

feat: Translation preparation for the project templates #1672

Open
wants to merge 11 commits into
base: main
Choose a base branch
from

Conversation

marksweb
Copy link
Contributor

This adds translations tags to the project level templates (those not corresponding to an app name) as suggested in #1648

Copy link
Member

@bmispelon bmispelon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks again for this herculean work (and not sisyphean I hope 😁 ).

I spotted a few issues, can you also make sure the branch is rebased on the latest main, to make sure we've picked up all latest changes?

Thanks! ✨

djangoproject/templates/base_community.html Outdated Show resolved Hide resolved
djangoproject/templates/base_community.html Outdated Show resolved Hide resolved
djangoproject/templates/diversity/changes.html Outdated Show resolved Hide resolved
djangoproject/templates/diversity/changes.html Outdated Show resolved Hide resolved
djangoproject/templates/donate_thanks.html Show resolved Hide resolved
djangoproject/templates/overview.html Outdated Show resolved Hide resolved
djangoproject/templates/overview.html Show resolved Hide resolved
djangoproject/templates/start.html Outdated Show resolved Hide resolved
djangoproject/templates/start.html Outdated Show resolved Hide resolved
Copy link
Member

@bmispelon bmispelon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some tests for the new template tag would be nice

releases/templatetags/date_format.py Show resolved Hide resolved

@override_settings(LANGUAGE_CODE="nn")
def test_isodate_translated(self):
self.assertEqual(isodate("2005-07-21"), "juli 21, 2005")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh this is interesting. On my machine this test fails:

======================================================================
FAIL: test_isodate_translated (releases.tests.TestTemplateTags.test_isodate_translated)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/tisba/Programming/djangoproject.com/venv/lib/python3.12/site-packages/django/test/utils.py", line 443, in inner
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/home/tisba/Programming/djangoproject.com/releases/tests.py", line 78, in test_isodate_translated
    self.assertEqual(isodate("2005-07-21"), "juli 21, 2005")
AssertionError: '21. juli 2005' != 'juli 21, 2005'
- 21. juli 2005
+ juli 21, 2005


----------------------------------------------------------------------

As far as I know, the correct version should be "21. juli 2005" (see the source code for the nn format in Django: https://github.com/django/django/blob/main/django/conf/locale/nn/formats.py#L5). That means something funny is going on with the way the CI is setting up the locale for the tests.

Does that test work as-is on your own machine?

Copy link
Contributor Author

@marksweb marksweb Nov 2, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah the example you provided didn't work for me so I put in what the test compared to.

Why is there a difference though?! 😱😬 The whole point of these formats is that they're standardised

Copy link
Contributor Author

@marksweb marksweb Nov 2, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The only thing I could think of was that the django upgrade had merged and I'd not ran this against the latest, but just rebased against main and cleaned out my tox dir and I'm still seeing tests pass. :needmytinfoilhatemojihere:

py312-tests: OK ✔ in 12.68 seconds
py312-flake8: commands[0]> flake8
py312-flake8: OK ✔ in 0.8 seconds
py312-black: OK ✔ in 0 seconds
py312-isort: commands[0]> make isort-check
python -m isort --check accounts aggregator blog contact dashboard djangoproject docs foundation fundraising legacy members releases svntogit tracdb
  py312-tests: OK (12.68=setup[0.01]+cmd[12.67] seconds)
  py312-flake8: OK (0.80=setup[0.00]+cmd[0.79] seconds)
  py312-black: OK (0.00 seconds)
  py312-isort: OK (0.36=setup[0.00]+cmd[0.36] seconds)
  congratulations :) (13.89 seconds)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There must be a difference in the system configuration between tox/you on one side, and me on the other (I suspect I have some nn-related locale stuff installed on my system which might play a role here). I'm going to dig a little bit more ⛏️

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I certainly dont have anything setup for languages on my machine. It's very much vanilla macOS for an English speaking user.

(Our education system did a terrible job of trying to teach me French and Spanish for a few years 😂)

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.

2 participants