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

i18n support #1809

Closed
jamiefolsom opened this issue Dec 11, 2013 · 9 comments
Closed

i18n support #1809

jamiefolsom opened this issue Dec 11, 2013 · 9 comments

Comments

@jamiefolsom
Copy link

Not sure how to label this as a feature, question or suggestion. I am curious if jekyll 2.0 will have first-class support for i18n in templates, posts, and metadata. Thanks.

@parkr
Copy link
Member

parkr commented Dec 11, 2013

We haven't found a solution that works well yet. Do you have a proposition?

@jamiefolsom
Copy link
Author

For our purposes, this would be great:

  • if _en.yml and _fr.yml contain translated strings (about: "about", about: "à propos de")
  • if a single index.html template contains translatable tokens (<%= t.about %>)
  • if a page using that template contains frontmatter, like

languages: 
  - en
  - fr

  • building the site would output /en/index.html and /fr/index.html with those strings swapped.

I haven't dug into this problem yet, to be honest, so maybe it's possible and just not documented, but I thought I'd ask.

Thanks.

@yevon-cn
Copy link

Good feature.

I think that i18n can be supported by javascript, it is another choice.

If in jekyll, it seems one file must be built to two files.

My suggestion is that:

  • If necessary can add a directory named '_i18ns'.
  • In templates, as @jamiefolsom say, write files like en.yml etc, then in templates write {{ site.i18n.about }} to use.
  • In posts, we can write posts like 2013-12-14-title.en.md etc, templates also can be written like this.
  • When building site, en files will be built in /_site/en/ and so on.
  • And also can set a variable like {{ site.i18n.language }} to get current language to show something different.
  • In _config.yml, can set which languages can be support, then jekyll will build related files to relevant directory.

@jashank
Copy link
Contributor

jashank commented Feb 4, 2014

Will some mechanism be exposed (through Liquid, say) so that a Convertible (a Page, a Post, etc.) knows it has alternative languages available? Or should a Convertible know how to handle multilingual outputs? And for posts or pages that are only available in one language (for instance, a en and jp website where some posts are only in jp), how do we handle that?

Could this be generalised to handle cases where project documentation for multiple versions should remain available (for instance, twbs/bootstrap's mechanism to select between v2 and v3 documentation) and being easily able to switch between versions of a single page?

@benbalter
Copy link
Contributor

Perhaps we could queue this up for a 2.5 or 3.0 target? Would love to at least figure out a sane path forward. Some prior discussions elsewhere:

@benbalter benbalter changed the title i18n support? i18n support Apr 28, 2014
@parkr
Copy link
Member

parkr commented Apr 28, 2014

What do you think about applying Collections to this? Create an i18n collection which contains each language as a separate YML then select from that YML the key related to the string you're interested in?

@mscharley
Copy link
Contributor

I think the biggest issue for any i18n implementation in Jekyll will be content negotiation; namely, there isn't any unless you arrange for it with your HTTP server. Is there anything at all we can offer in this regard? If not, I think it's worth keeping in mind the options available to server owners in this regard so we don't make it harder to get this going. For instance, I believe Apache can easily be setup to pick between /index.en.html and /index.de.html when a user makes a request for /index.html.

With that out of the way, I think @parkr's idea is good for managing internationalizing the interface and layout of your website, but what is your plan for content? Should each page/post/whatever specify what language it is via YAML headmatter and then jekyll will use that value to pluck something out of the i18n collection? What would that look like for posts in particular which read a lot of information out of the filename?

@jamiefolsom
Copy link
Author

In Jekyll or not, what I want to give users is an explicit choice between content in two languages. I don't want to let the server choose the locale based on a browser preference or geolocation. Just my deux centimes.

@mscharley
Copy link
Contributor

Absolutely, giving the user absolute choice after they've loaded a page is
very important. So is giving the user a sensible default language based on
their browser settings.

On 29 April 2014 06:46, Jamie Folsom [email protected] wrote:

In Jekyll or not, what I want to give users is an explicit choice between
content in two languages. I don't want to let the server choose the locale
based on a browser preference or geolocation. Just my deux centimes.


Reply to this email directly or view it on GitHubhttps://github.com//issues/1809#issuecomment-41611291
.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

7 participants