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

Translates expression for duration #449

Merged
merged 2 commits into from
Jul 14, 2021
Merged

Translates expression for duration #449

merged 2 commits into from
Jul 14, 2021

Conversation

jtrain
Copy link
Contributor

@jtrain jtrain commented Jul 14, 2021

I am running django 3.2 and noticed that the execution time is blank. e.g.

image

https://docs.djangoproject.com/en/2.2/topics/i18n/translation/#blocktrans-template-tag
The django docs are clear that expressions should be bound to a local variable before being used inside the translation tag.

I've chosen to use the older format for the expression binding since this should cover a wider range of django installs newer format because it is also available for a wide range of django installs.

image

Fixes incorrect translation of expression with blocktrans introduced in PR #345.
Django docs show that expressions must be bound to a variable before
being used inside a blocktrans (now blocktranslate since 3.1)

https://docs.djangoproject.com/en/2.2/topics/i18n/translation/#blocktrans-template-tag
This newer format is easier to read, and available since at least django
1.8.
@marksweb
Copy link
Collaborator

@jtrain Thank you for your contribution.

Is this basically django 2.2+ compatible?

@jtrain
Copy link
Contributor Author

jtrain commented Jul 14, 2021

I haven't had to make any other changes on django 3.2, its working very nicely.

If you are asking if this specific change is compatible with 2.2+ then yes, in fact it is 1.8+ compatible.

@jtrain
Copy link
Contributor Author

jtrain commented Jul 14, 2021

Here are the docs for 1.8 blocktrans https://docs.djangoproject.com/en/1.8/topics/i18n/translation/#blocktrans-template-tag, I used this syntax.

@marksweb marksweb merged commit 6f7c38c into explorerhq:master Jul 14, 2021
@marksweb
Copy link
Collaborator

Fantastic - Thank you @jtrain!

@jtrain jtrain deleted the fix-duration-blocktrans branch July 15, 2021 00:01
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