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

Making DATE_FORMAT translatable. #2033

Merged
merged 3 commits into from Sep 6, 2015
Merged

Making DATE_FORMAT translatable. #2033

merged 3 commits into from Sep 6, 2015

Conversation

felixfontein
Copy link
Contributor

@felixfontein felixfontein commented Sep 6, 2015

(fixes #2032)

@felixfontein felixfontein self-assigned this Sep 6, 2015
@@ -140,7 +140,7 @@ TIMEZONE = ${TIMEZONE}
# Note that this does not affect DATE_FORMAT.
# FORCE_ISO8601 = False

# Date format used to display post dates.
# (Translatable) Date format used to display post dates.
Copy link
Member

@Kwpolska Kwpolska Sep 6, 2015

Choose a reason for hiding this comment

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

put the (translatable) tag, lower case, at the end of this line

Copy link
Contributor Author

@felixfontein felixfontein Sep 6, 2015

Choose a reason for hiding this comment

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

Changed that. There are some other places (unrelated to my edits) where it still is at the beginning of the line.

'extra_head_data',)
'extra_head_data',
'date_format',
'js_date_format',)
Copy link
Member

@Kwpolska Kwpolska Sep 6, 2015

Choose a reason for hiding this comment

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

I’m afraid the tests fail because JS_DATE_FORMAT is not that easy, you would need special casing to do json.dumps() when the translatable context is evaluated and drop the _GLOBAL_CONTEXT setting.

Copy link
Contributor Author

@felixfontein felixfontein Sep 6, 2015

Choose a reason for hiding this comment

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

I now did the json.dumps() before creating the TranslatableSetting object creations. This way, I only have to change a bit in nikola.py, but not in all places where _GLOBAL_CONTEXT is converted to a local context (that happens several times in nikola.py and in at least four plugins).

Kwpolska added a commit that referenced this pull request Sep 6, 2015
@Kwpolska Kwpolska merged commit 621f2ee into master Sep 6, 2015
@Kwpolska Kwpolska deleted the localize-date-format branch Sep 6, 2015
@felixfontein
Copy link
Contributor Author

felixfontein commented Sep 6, 2015

Thanks for merging!

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.

DATE_FORMAT should be translatable.
2 participants