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

unable to use language dictionaries #16

Open
sburke56 opened this issue Jun 25, 2015 · 6 comments
Open

unable to use language dictionaries #16

sburke56 opened this issue Jun 25, 2015 · 6 comments

Comments

@sburke56
Copy link

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
Copy link

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
Copy link

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
Copy link
Author

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
#16 (comment)
.

@taringamberini
Copy link

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:

  • what I configured: looking to source code
  • why I configured it: looking to commits' message (I'm a fan of commit messages ).

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

@sburke56
Copy link
Author

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
Copy link

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

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

No branches or pull requests

2 participants