octopress / multilingual

Write elegant multi-language Jekyll sites
MIT License
69 stars 15 forks source link

unable to use language dictionaries #16

Open sburke56 opened 9 years ago

sburke56 commented 9 years ago

I was unable to use the language dictionary features and therefore abandoned using the plugin.

I specified lang:en in the _config.yml Ultimately what I did was have one languages.yml file that has both my languages and accessed the title in my layout file. This worked so I'm not sure why something like the octopress-multilingual plugin didn't work when trying to split up the languages to their own separate files. Accessing the language title like in the docs with "{{ lang.title }} => English title" didn't generate anything.

languages.yml en: gde-quickstart: title: 'GDE Quick Start Guide v2.1' cn: gde-quickstart: title: 'GDE快速入门指南v2.1'

layout file accessed the page title {{ site.data.languages[page.lang].gde-quickstart.title }}

taringamberini commented 9 years ago

With a source/_data/lang_en.yml:

gde-quickstart: Quick Start Guide
title: GDE Quick Start Guide v2.1

and a source/:data/lang_cn.yml:

gde-quickstart: 快速入门指南
title: GDE快速入门指南v2.1

If you wrote the following:

<p>lang.gde-quickstart is {{ lang.gde-quickstart }}</p>

<p>lang.title is {{ lang.title }}</p>

in pages and posts with the yaml front lang: en you should get:

<p>lang.gde-quickstart is Quick Start Guide</p>

<p>lang.title is GDE Quick Start Guide v2.1</p>

and in pages and posts with the yaml front lang: cn you should get:

<p>lang.gde-quickstart is 快速入门指南</p>

<p>lang.title is GDE快速入门指南v2.1</p>

Could you test if these work for you?

taringamberini commented 9 years ago

Hi @sburke56 have you tested the the language dictionary features as I've suggested?

It's one of the few things of this plugin that works as documented.

sburke56 commented 9 years ago

I haven't got to it yet. I will pin this and try to get to it. The site is already up with a work around but I'll try and get this tested. On Mon, Jul 27, 2015 at 10:41 AM Tàrin Gamberìni notifications@github.com wrote:

Hi @sburke56 https://github.com/sburke56 have you tested the the language dictionary features as I've suggested?

It's one of the few things of this plugin that works as documented.

— Reply to this email directly or view it on GitHub https://github.com/octopress/multilingual/issues/16#issuecomment-125229690 .

taringamberini commented 9 years ago

Hi @sburke56

I've just deployed my octopress multilingual site at https://taringamberini.github.io and you can find my octopress site sources on the source branch at https://github.com/taringamberini/taringamberini.github.io/tree/source so you can see:

If you have any questions I'll be happy to help you, Tarin

sburke56 commented 9 years ago

I tested it again. Still no dice. When I set up my language files like the documentation my layouts don't have access to the global var "lang". Possibly it's user error but I'm not sure.

source/_data/lang_en.yml source/_data/lang_cn.yml

lang_en.yml title: English title

lang_cn.yml title: Chinese title

When I put the following in my layout file the lang.title doesn't show up. The site.data.lang_en.title shows up but that doesn't allow me to write only one set of code for the layout.

{{ lang.title }}
English: {{ site.data.lang_en.title }}
Chinese: {{ site.data.lang_cn.title }}
taringamberini commented 9 years ago

Hi @sburke56,

To exclude problems with your ruby and gems installations would you like to generate my site?

$ git clone https://github.com/taringamberini/taringamberini.github.io.git
$ cd taringamberini.github.io/
$ git checkout source
$ rake generate (or to get more info: jekyll build --trace)
$ rake preview

Hi, Tarin