-
Notifications
You must be signed in to change notification settings - Fork 464
Pass language to slugify and unslugify. (WIP) #2284
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
Conversation
if _tag_slugified in slugged_tags[lang]: | ||
if tag not in self.posts_per_tag: | ||
# Tags that differ only in case | ||
other_tag = [existing for existing in self.posts_per_tag.keys() if utils.slugify(existing) == _tag_slugified][0] |
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.
missing , lang
here.
I’m 👎 for this. You just wasted your time implementing a tiny obscure feature. |
It is important for a german site since it is the grammatically correct representation. Wordpress supports it since Version 3.6: before, most people used a plugin. To implement this as a plugin would be ok for me. there is a python module that does what we want:
|
@davidak: this Python module cannot be used for all languages since for most it would be simply wrong. Also, I wonder how well it works for languages such as Chinese and Japanese. My goal is to not change Nikola's default behavior, but to just enable this to be changed by plugins without writing a really insane plugin (which does post preprocessing etc.). Such a plugin could use this Python module for the German language, though. About WordPress: I wonder why they only support de_DE and not also de_CH and de_AT. Also, the current version of WordPress uses similar translations for Danish (da_DK). |
that was my intention. |
This looks ok to me, and changes no behaviour. If noone sees a bug in the next 24 hours, I'll merge. |
@ralsina: maybe we should leave it open a bit longer, I'd like to do some more intense tests (like with a real blog :) ). I'm not sure yet when I'll have time for this, but probably not during the next 24h. |
(Note we currently use |
@@ -26,6 +26,7 @@ def test_getting_metadata_from_content(self): | |||
post = dummy() | |||
post.source_path = 'file_with_metadata' | |||
post.metadata_path = 'file_with_metadata.meta' | |||
post.default_lang = 'en' |
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.
Would be nicer to make a special post_dummy
object with default_lang = 'en'
already.
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.
I'm using dummy
now, since that's precisely used in these situations.
@felixfontain ok, let's give it a few days. I want to do a release before friday because I will then be unavailable for a few weeks. Then again, if it doesn't go in this release, it will go in the next one. |
Seems to work fine. I created a mini plugin for testing, for those who are interested, which can be put into the
The code (
I recommend to remove the So from my side, merging is fine. |
@ralsina: do you want to merge, or should I just do it myself? |
Pass language to slugify and unslugify. (WIP)
Merged, let's hope it works. |
Thanks for merging! |
First try on implementing passing of language to
slugify
andunslugify
; see discussion in #2273.