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

Use Babel instead of system locale to format dates #3126

Merged
merged 10 commits into from Aug 6, 2018
Merged

Conversation

@Kwpolska
Copy link
Member

@Kwpolska Kwpolska commented Jul 30, 2018

  • Fixes issues #2606 and #3121.
  • Also fixes the locale situation for users who have incomplete locales or misconfigured systems.
  • Supersedes the babeldates plugin for v7.
  • Adds a few extra nifty features with date formatting (but not much else).
  • Removes a lot of ugly and dead code.

I’m not a fan of how the threading support currently looks in LocaleBorg, but without it, everything goes awry. Also, our translators may need to fix the date strings if (a) my guesses were wrong or (b) the CLDR data isn’t perfect in the context (cf. Polish translation of Posts for {month_year}.)

Kwpolska added 6 commits Jul 28, 2018
Signed-off-by: Chris Warrick <kwpolska@gmail.com>
Signed-off-by: Chris Warrick <kwpolska@gmail.com>
Signed-off-by: Chris Warrick <kwpolska@gmail.com>
Signed-off-by: Chris Warrick <kwpolska@gmail.com>
Signed-off-by: Chris Warrick <kwpolska@gmail.com>
Signed-off-by: Chris Warrick <kwpolska@gmail.com>
@Kwpolska Kwpolska added this to the v8.0.0 milestone Jul 30, 2018
@Kwpolska Kwpolska added this to To Do in Version 8 via automation Jul 30, 2018
@Kwpolska Kwpolska requested review from ralsina and felixfontein Jul 30, 2018
Kwpolska added 2 commits Jul 31, 2018
Signed-off-by: Chris Warrick <kwpolska@gmail.com>
Signed-off-by: Chris Warrick <kwpolska@gmail.com>
@getnikola getnikola deleted a comment Jul 31, 2018
@getnikola getnikola deleted a comment Jul 31, 2018
@getnikola getnikola deleted a comment Jul 31, 2018
.. slug: tests
.. date: 2012/03/30 23:00
The Nikola Test Suite
Copy link
Contributor

@felixfontein felixfontein Jul 31, 2018

Is there a reason why you removed the tests README.rst completely?

Copy link
Contributor

@felixfontein felixfontein Jul 31, 2018

Ok, I see: "Remove terribly outdated test documentation"
Makes sense :)

Copy link
Member Author

@Kwpolska Kwpolska Jul 31, 2018

The document is fairly outdated, and after removing the now-irrelevant parts, it wouldn’t really be useful for anything.

Copy link
Contributor

@felixfontein felixfontein left a comment

LGTM. The only huge downside is that now it is impossible to override date formatting in a plugin. At the moment I have absolutely no idea how serious that is, since I have no idea how easy / hard / impossible it is to add new locales to babel on the fly or modify existing ones. If that is easy enough (and doesn't require ugly monkey-patchig), removing the ability to override date formatting should be no problem.

@Kwpolska
Copy link
Member Author

@Kwpolska Kwpolska commented Jul 31, 2018

@felixfontein Babel supports basically all locales spoken by humans and some of the obscure ones, too. Data from CLDR is used in many products, and some customizations are doable in the locale itself message files. I don’t think supporting overrides is worth it, especially at the price of added complexity (what if the plugin needs thread-safety, like locale did?)

Signed-off-by: Chris Warrick <kwpolska@gmail.com>
@getnikola getnikola deleted a comment Jul 31, 2018
@getnikola getnikola deleted a comment Jul 31, 2018
@felixfontein
Copy link
Contributor

@felixfontein felixfontein commented Aug 1, 2018

@Kwpolska Unfortunately there are languages/dialects where CLDR is not sufficient, or where no official spelling exists and spelling can vary by individual persons. An example is Swiss German (locale gsw). I checked the CLDR month names, they are mostly OK, except the one for October, which contains two "o"s, and I don't like that and don't want to have that in my blog :) Currently I'm using a custom date formatter for that (since Python doesn't know about gsw anyway), but if that is removed I'll have to rework my themes to stop using Nikola's date formatting facilities, and also have to fork the archives plugin to be able to control the archive names.

I understand the argument about complexity, but I would shove that burden to the plugin. If the plugin really needs thread safety, it has to do that by itself.

Signed-off-by: Chris Warrick <kwpolska@gmail.com>
@Kwpolska
Copy link
Member Author

@Kwpolska Kwpolska commented Aug 1, 2018

I added a minimalistic solution for this in commit 4d14b50.

@getnikola getnikola deleted a comment Aug 1, 2018
@getnikola getnikola deleted a comment Aug 1, 2018
@Kwpolska
Copy link
Member Author

@Kwpolska Kwpolska commented Aug 6, 2018

@ralsina, @felixfontein: could you please review?

ralsina
ralsina approved these changes Aug 6, 2018
Copy link
Member

@ralsina ralsina left a comment

LGTM, much simpler!

@Kwpolska Kwpolska merged commit 3c45bdb into master Aug 6, 2018
3 of 5 checks passed
Version 8 automation moved this from To Do to Done Aug 6, 2018
@Kwpolska Kwpolska deleted the babel-instead-of-locale branch Aug 6, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Version 8
  
Done
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants