Skip to content
This repository has been archived by the owner on Aug 28, 2019. It is now read-only.

Multilingual support #155

Open
avarabyeu opened this issue May 24, 2016 · 2 comments
Open

Multilingual support #155

avarabyeu opened this issue May 24, 2016 · 2 comments

Comments

@avarabyeu
Copy link

First of all, thanks for such a great theme! Is it possible to add localization support?

@avarabyeu avarabyeu changed the title Localization support Multilingual support May 24, 2016
@mmistakes
Copy link
Owner

Sure. I probably won't have the time to do it since I'm not actively adding new features for this theme. But if you wanted to submit a PR I'd look at it.

I've tackled this in my other themes so I'd be looking for something similar if I was to merge it in.

Anything beyond localizing simple text strings pushes things into plugin territory and I'd like to avoid that since it's best left for the user to decide if they want to add it.

@maxpou
Copy link

maxpou commented May 26, 2016

Hi,
If you want, I already implement a kind of multilingual feature on my own blog. My blog is still in French, but I add the ability of adding post in English.

  1. First, I've created a lang attribute on my post's mardown files.

    layout: post
    title: my title
    description: "en"
    tags: ["a", "b", "c"]
    lang: en
    image:
    
  2. Then, when I loop on articles, I check if lang is defined to put a flag.
    Look: (template file)

    {% for post in site.posts %}
    //...
        {% if post.lang == "en" %}
            <li class="entry-title">
                <a href="{{ site.url }}{{ post.url }}" title="{{ post.title }}"><img src="{{ site.url }}/images/uk-flag.png" alt="english article"> {{ post.title }}</a>
            </li>
        {% else %}
            <li class="entry-title">
                <a href="{{ site.url }}{{ post.url }}" title="{{ post.title }}">{{ post.title }}</a>
            </li>
        {% endif %}
    //...
    {% endfor %}

Here's the result: http://maxpou.fr (look line: "Vagrant, Symfony and Windows are not incompatibles")

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

3 participants