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

[feature request]languages behave the same as categories #1393

Closed
22decembre opened this Issue Jul 7, 2014 · 20 comments

Comments

Projects
None yet
4 participants
@22decembre
Copy link

22decembre commented Jul 7, 2014

I would suggest that languages could behave the same way as categories (or close to).

For each language on the blog, a repository should be created with the locale code, and inside, index pages generated, as are those from the root. Those pages would be generated only with the articles belonging to the concerned language. All the rest is the same : same theme, same links...

So we should have :
/de/index.html (+ index1,2...html)
/fr/index.html
/en/ ----

and so on. I say repository cause I find it more beautiful, but it can be plain html pages, so it would work the same as categories.

The benefit of it other the i18n_subsites plugin is that the static content (pictures especially or even videos) is not copied to each subsite but remain shared, as well as other pages. To me it looks more simple.

@22decembre

This comment has been minimized.

Copy link

22decembre commented Jul 8, 2014

So, actually, what I would like to have is a LANG_ARCHIVE_SAVE_AS config option, like the TAG, CATEGORY, or AUTHOR...

@smartass101

This comment has been minimized.

Copy link
Contributor

smartass101 commented Jul 8, 2014

the i18n_susbsites plugin is getting rewritten and I actually have some experimental version that can share the static files, just haven't had the time to complete it.
I suggest you close this bug and move conversation to getpelican/pelican-plugins#180

@22decembre

This comment has been minimized.

Copy link

22decembre commented Jul 9, 2014

The fact is that the plugin reconstitue a complete subsite, whereas I actually intend just to have a language feed (already done) and a language index.html.

I understand you want to support your plugin but I don't see the need for it. I tried it once again (two minutes ago) and it doesn't do what I want.

@22decembre 22decembre changed the title languages behave the same as categories [feature request]languages behave the same as categories Aug 10, 2014

@CNBorn

This comment has been minimized.

Copy link

CNBorn commented Aug 17, 2014

@22decembre I came to the same idea this weekend and messing around with the code today. I've got a prototype which is working but still got some tests to get covered in order to make this a convincing pullrequest. Please feel free to check it out at https://github.com/CNBorn/pelican/commit/fe642e741fbfaff59408577a4df6464db55a2ca6

@22decembre

This comment has been minimized.

Copy link

22decembre commented Aug 20, 2014

I will try to test this evening !

@CNBorn

This comment has been minimized.

Copy link

CNBorn commented Aug 20, 2014

@22decembre May have to implement #1404 as well otherwise all articles other than default lang will not be in their normal url {slug}.html but as {slug}-{lang}.html

@22decembre

This comment has been minimized.

Copy link

22decembre commented Aug 20, 2014

Here is what I have done :

  • I created a virtualenv in /tmp
  • I installed pelican using pip (like I did for my actual blog).
  • I coppied your modified files.

I tried first to clone your own repo, but had some pain to make it work. So this is why I prefered to stick to the common setup.

After that, I copied my content folder in the virtualenv, like in my own blog, and tried to run pelican.

I found two mistakes : in the generator.py files, there is two 'except Exception, e:' that is said wrong syntax. I changed them to 'except Exception as e:'.

After that, I tried again to run pelican, and it complained like this : ImportError: cannot import name 'DEFAULT_CONFIG'.

I stopped at this point.

@CNBorn

This comment has been minimized.

Copy link

CNBorn commented Aug 22, 2014

@22decembre I've done my modifications based on 3.5dev which is the current master of pelican main repo.
Instead of installing official pelican from pip, this patched version of pelican can be installed by this command in your virtualenv
pip install git+https://github.com/CNBorn/pelican.git@lang

You can report it if you have any problems, I'll check it out.

@CNBorn

This comment has been minimized.

Copy link

CNBorn commented Aug 24, 2014

@22decembre I've updated my branch of code, check it out here. You can still using the pip installation method above this comment to get your pelican-dev in pip updated. (I'm going to submit a pull-request but went into a unittest problem #1442 once it got solved I'll post these changes as a PR)

To enabling this feature I would recommend to have an additional line in your config files to solve problem indicated in #1404

ARTICLE_LANG_SAVE_AS = ARTICLE_SAVE_AS

This helps pelican generated articles other than default-lang will be put in normal path like other articles. (Enabling this feature ususally means we are running a multi-lang blog)

Also you would like to check the template since most of them are implemented by the 'default-lang' way. If your template's base.html has line like this one:

you should replace it like:

in order to make this template serves better for your multi-language blog.

@CNBorn

This comment has been minimized.

Copy link

CNBorn commented Aug 26, 2014

@22decembre I've implemented this feature in a separate pelican plugin - pelican-langcategory, you can check it out to see if it can fit your needs.

@22decembre

This comment has been minimized.

Copy link

22decembre commented Aug 26, 2014

Thanks, will figure out what I do, now a bit tired and at the same lots of stuff…

Any way thanks for work.

@22decembre

This comment has been minimized.

Copy link

22decembre commented Aug 28, 2014

Seems to work. You can browse http://www.22decembre.eu/en/ or fr/ to check.

I think I have to modify slightly the theme in order to show languages options.
Just one thing : the plugin seems to work entirely as a category system. It means that on the top, we have this sentence "article in category "" ". but category is void. This is to be taken into account for my theme modif. Maybe you have something to do as well !

Anyway, thanks for your work ! It's already useful and exactly what I was searching.

@CNBorn

This comment has been minimized.

Copy link

CNBorn commented Aug 28, 2014

@22decembre Thanks for your feedback! It is great to hear that is useful!

The template point is where I'm missing, in the plugin, by default it looks for 'category' template to generate the language specific pages. I think a 'language' template will be used if it is found, otherwise the 'category' template will be used.

Is this plan seems OK to you? If it is OK, I'll put that code in the plugin repo.

@22decembre

This comment has been minimized.

Copy link

22decembre commented Aug 28, 2014

I will work on a template.

I think you should require/look if there's a general option already for language template.

Appart, I think you should place it in the plugin repo.

@22decembre

This comment has been minimized.

Copy link

22decembre commented Aug 29, 2014

Maybe you should find a better name for the plugin also !

@CNBorn

This comment has been minimized.

Copy link

CNBorn commented Aug 29, 2014

@22decembre Any suggestions for the plugin name?

BTW I'm going to let the plugin to use 'language' template by default, if it is not found, then fallback to 'category' template. Basically, these two templates are same except for title and text in it. Is it sensible to you?

@22decembre

This comment has been minimized.

Copy link

22decembre commented Aug 29, 2014

I believe it's the good way to do it.

I think to work a bit on my template tomorrow. Then blog post. I will mention your pluging in.

@22decembre

This comment has been minimized.

Copy link

22decembre commented Aug 29, 2014

No idea on the name. Maybe we should ask ideas to other persons.

@CNBorn

This comment has been minimized.

Copy link

CNBorn commented Sep 13, 2014

Should we close this issue? Since anyone who are interested in this can use pelican-langcategory now.

@justinmayer

This comment has been minimized.

Copy link
Member

justinmayer commented Sep 13, 2014

If there is further discussion to be had here, please open an issue in the Pelican Plugins repository. That way the focus can be on Tyler's plugin instead of Pelican core.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment