kurtsson / jekyll-multiple-languages-plugin

I18n support for Jekyll and Octopress
MIT License
925 stars 202 forks source link

exclude_from_localizations modifies site.static_files #70

Closed kleuter closed 8 years ago

kleuter commented 8 years ago

Is that normal? I think no. Specially when your code relies on site.static_files variable (my case)

Anthony-Gaudino commented 8 years ago

Hi @kleuter,

I never used the site.static_files and so I did a test and it does seems that when using the exclude_from_localizations, the site.static_files data is only available on the main website language and appears empty when accessed on a translated website.

Is this the problem you have?

kleuter commented 8 years ago

Hi, Anthony

My images folder is a part of the website and all image files appear in site.static_files. More info When I use exclude_from_localizations to avoid copying of all my images for every language, site.static_files no longer contains them.

Anthony-Gaudino commented 8 years ago

@kleuter, so this seems to be precisely what I found too, the site.static_files is empty for every sublaguange but is filled for the main language.

I will try to find out what is causing this.

Anthony-Gaudino commented 8 years ago

@kleuter, version 1.5.1 has been released containing the fix for this issue.

Please check if it solves your problem so that I can close the issue.

kleuter commented 8 years ago

Anthony-Gaudino, I confirm it works now, thanks a lot!

Though, another issue appeared: I exclude folder "assets" but some files are still copied to translation folders. Specifically these 2: assets/css/all.scss (copied as _site/ru/assets/css/all.css) and assets/js/all.js (copied as _site/ru/assets/js/all.js)

_config.yml:

# jekyll-multiple-languages-plugin configuration
languages: ["en", "ru"]
exclude_from_localizations: ["favicon.ico", "assets"]
Anthony-Gaudino commented 8 years ago

@kleuter, please try deleting your _site directory and rebuilding the website.

On my tests it works well, if the files still appear after deleting the _site and rebuilding, then I would like to see your site, if there's sensitive data, you can try recreating a minimal site that has the error, then just zip it and attach to this issue.

kleuter commented 8 years ago

@Anthony-Gaudino, here's reproducible minimal site, just run jekyll build on it https://www.dropbox.com/s/p7vq7n03ppzaj6s/multiple-languages_issue_minimal.zip?dl=0

Thanks!

Anthony-Gaudino commented 8 years ago

@kleuter, thank you.

The problem occurs because those two files have a front matter and are not treated as static files by Jekyll, but as pages instead.

I will try to think the best way to deal with this.

kleuter commented 8 years ago

Thank you, Anthony. Currently it's a not a big deal, and it's actually another issue, the current can be closed.

pke commented 4 years ago

I have run into this too and I think it is a big deal. The exclude_from_localizations just does not work as one would think. Could we not also ignore pages (files with front matter) that are listed in the array from being translated?

I would provide a PR to at least allow front-matter to specify: i18n: false to opt out the file from processing. Any pointers where in the code that should go? @kurtsson