-
-
Notifications
You must be signed in to change notification settings - Fork 953
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
base: main
Are you sure you want to change the base?
Conversation
9c7f27b
to
cdf8bb4
Compare
There was a problem hiding this 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! ✨
349010b
to
f8f84af
Compare
There was a problem hiding this 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/tests.py
Outdated
|
||
@override_settings(LANGUAGE_CODE="nn") | ||
def test_isodate_translated(self): | ||
self.assertEqual(isodate("2005-07-21"), "juli 21, 2005") |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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)
There was a problem hiding this comment.
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 ⛏️
There was a problem hiding this comment.
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 😂)
Co-authored-by: Baptiste Mispelon <[email protected]>
for more information, see https://pre-commit.ci
8fbeb81
to
f3d6ec7
Compare
This adds translations tags to the project level templates (those not corresponding to an app name) as suggested in #1648