kurtsson / jekyll-multiple-languages-plugin

I18n support for Jekyll and Octopress
MIT License
926 stars 203 forks source link

Posts #18

Closed rschwietzke closed 5 years ago

rschwietzke commented 10 years ago

Hi,

all content of _posts seem to be ignored right now. When moved to _i18n, it copies the data incorrectly with _i18n ind the path name.

Expected: _site/en/news/2011-12-02-news-12.

When moved to _i18n (_i18n/en/_posts/news/2011-12-02-news-12.html) it becomes: _site/en/_i18n/en/2011-12-02-news-12. So the languages appears twice, the _18in is copied as well, and the topic subfolder is gone.

Any ideas? Maybe I am just doing it incorrectly.

Thanks, Rene

rschwietzke commented 10 years ago

I was able to fix this for me, but removing the "def read_posts(dir)" block completely and relying on the original processing of the posts. Of course, all links had to be build differently such as

<a href="/{{site.lang}}{{news.url}}">{% t news.title %}</a>

But I had to do that at some many places anyways, it does not make a difference.

Of course, this makes it impossible to have a post only in one language. Additionally the post header is localized normally, but the post content uses a if site.lang == 'en'.

kurtsson commented 10 years ago

Ok, please fix and send a pull request

duanefields commented 9 years ago

Willing to fix this on my fork, but I'm not sure I understand the original intention of this code. Does it expect you to have posts inside _i18n/_posts and _posts on the root? What's the desired effect?

    def read_posts(dir)
      if dir == ''
        read_posts("_i18n/#{self.config['lang']}/")
      else
        read_posts_org(dir)
      end
    end
  end

@kurtsson care to elaborate?

duanefields commented 9 years ago

But yes I see the same issue as @rschwietzke, commenting out the overide makes the post show up at all

skyairmj commented 9 years ago

I also encountered the same issue that Jekyll posts are not generated as original (https://github.com/jekyll/jekyll/blob/v2.5.3/lib/jekyll/site.rb).

After days of digging, it turned out the alias method in this plugin overrides the behaviour from the original Jekyll site class.

I'd suggest that post internationalisation should not be included in the plugin and changing the default behaviour of the original Jekyll be not a good idea, especially with the 'gems' directive in Jekyll's _config.yml.

ctruelson commented 9 years ago

In case users don't want to edit the gem to comment out the read_posts block, here's a PR that allows for adding "_posts" to the exclude_from_localization config

https://github.com/screeninteraction/jekyll-multiple-languages-plugin/pull/51

shushugah commented 5 years ago

With PR #51 merged, this issue can be closed.