grunt-assemble-i18n icon indicating copy to clipboard operation
grunt-assemble-i18n copied to clipboard

Add documentation

Open rauberdaniel opened this issue 10 years ago • 30 comments

Please add some basic documentation about how to install and use this plugin.

rauberdaniel avatar Mar 25 '14 11:03 rauberdaniel

:+1:

Valid request, I was already thinking of doing it (as we're using it in production). Will definitely happen soon :)

ain avatar Mar 25 '14 11:03 ain

@ain if you're going to add some documentation, take a look at verb and grunt-verb

doowb avatar Mar 25 '14 13:03 doowb

Hello,

Thanks for your work. Any news about some basic documentation?

AoDev avatar Jun 17 '14 12:06 AoDev

Yes, I've just today, on our performance intensive compilation, added options for unikeys and gc which helped me to cut memory consumption by 6x. I'll push a PR at the earliest possibility and once PRs get merged, also add the docu.

ain avatar Jun 18 '14 08:06 ain

Thank you. My project main feature is based on i18n support and content translation. So I chose Assemble and the i18n middleware which should be a good fit :)

AoDev avatar Jun 18 '14 09:06 AoDev

Yes. That's exactly the nature of our project too, as you can see at http://sennheiser-momentum.com ;)

ain avatar Jun 18 '14 09:06 ain

:+1:

jonschlinkert avatar Jun 18 '14 18:06 jonschlinkert

Any updates on this, or alternatively can someone point me to an example project?

Thanks!

NotBobTheBuilder avatar Jul 08 '14 14:07 NotBobTheBuilder

Really sorry about that. We rely on it heavily so I should be doing the documentation but I am crazy busy

Here's where we use it.

https://github.com/wet-boew/wet-boew/blob/master/Gruntfile.coffee#L401-L413

LaurentGoderre avatar Jul 08 '14 14:07 LaurentGoderre

Note that the list of languages comes from another task that takes a csv and creates the JSON files.

LaurentGoderre avatar Jul 08 '14 14:07 LaurentGoderre

+1 for having a little documentation for this. Starred and watched this useful project.

nobitagit avatar Aug 26 '14 15:08 nobitagit

Great. What's the status? I have no idea how this works, would love an example at least... :-)

kluplau avatar Jan 13 '15 08:01 kluplau

I should get on it but I can help you with your use case in the meantime

LaurentGoderre avatar Jan 13 '15 14:01 LaurentGoderre

Thanks. I want to add a module for a specific language, so I would like to check if a translation is defined, and if it was, I would render the module. How can I make that check?

kluplau avatar Jan 20 '15 15:01 kluplau

The way this works, you have to specify in the Gruntfile which languages your support. You can do that by specifying it manually or by using grunt file matching to list he languages you have. Do you have a repo I can look at?

Btw, here's one of our tasks for this middleware. We use a list of langauge from a task that splits a csv file to seperate .json file for each language

https://github.com/wet-boew/wet-boew/blob/master/Gruntfile.coffee#L461-L473

LaurentGoderre avatar Jan 20 '15 16:01 LaurentGoderre

Thanks. That wasn't exact what I was looking for tho. I use your test-example from Github, and uses the permalink-version.

What I would like, is that if the description in fr.json wan't entered, then the description block shouldn't be rendered. This way I can have the languages controlling what elements there is on the page. For example, in Denmark there is a strict cookie law, which means that each page has to have a overlay of some kind that explains how you use cookies. But on most other languages, that's not required.

Somthing like:

{{i18n exist="description"}}
{{i18n "description}}
{{/i18n}}

Can that be achievable?

kluplau avatar Jan 20 '15 16:01 kluplau

That use case is not supported at least not in this syntax...let me think about this one

LaurentGoderre avatar Jan 20 '15 17:01 LaurentGoderre

Have you had any chance to look at it?

kluplau avatar Jan 27 '15 23:01 kluplau

Is that the only difference you need? Would you still have one template driving the generation of pages in multiple languages?

LaurentGoderre avatar Jan 27 '15 23:01 LaurentGoderre

Yes. Why? Do you think that's a poor approach?

kluplau avatar Jan 27 '15 23:01 kluplau

No no, I don't think it should be too hard. I should have something tomorrow

LaurentGoderre avatar Jan 28 '15 00:01 LaurentGoderre

Hi again. How's it going? I was wondering another thing as well. Is it possible to support Pages Collections, with different layouts? http://assemble.io/docs/Pages-Collections.html

kluplau avatar Jan 29 '15 13:01 kluplau

@Blueblau layouts aren't the scope of i18n, but yes you can.

ain avatar Jan 29 '15 14:01 ain

@ain Great. How would I achieve this? I'm used to do this in regular Assemble, but I failed to figure out how to do it with i18n.

How can I achieve this?

kluplau avatar Jan 29 '15 17:01 kluplau

@LaurentGoderre Have you had a chance to look at this? @ain Do you have a solution/approach I can try out?

kluplau avatar Feb 03 '15 09:02 kluplau

Perhaps it's not the most elegant solution but this works

---
title: Home
heading: 'Yo, Assemble!'
lead: Welcome to my blog!
warning: '<%= i18n[language].warning %>'
---
<div class="jumbotron">
  <h1>{{ heading }}</h1>
  {{#if warning}}<p>{{warning}}</p>{{/if}}
  <p>{{{i18n "paragraph"}}}</p>
</div>

LaurentGoderre avatar Feb 04 '15 22:02 LaurentGoderre

Here's the repo that I promised (sorry for the delay)

https://github.com/LaurentGoderre/i18n-demo

LaurentGoderre avatar Feb 04 '15 22:02 LaurentGoderre

@LaurentGoderre Thanks for the demo is very clear. but you can use Markdown instead of YML?

fixcl avatar Feb 25 '15 15:02 fixcl

I believe you can. BTW, both are not mutually exclusive, the code between --- is what is called front matter and can be used on Handlebars or Markdown files and can either be in YAML or JSON syntax

LaurentGoderre avatar Feb 25 '15 16:02 LaurentGoderre

Documentation coming any time soon?

Evand3r avatar Mar 24 '21 14:03 Evand3r