jekyll-multiple-languages-plugin 1.4.1 → 1.4.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 12ebef5a7519f9a15242263259508847e3ad8365
4
- data.tar.gz: 809877cc83733ffb9f4592e4b3855e863dae1f2b
3
+ metadata.gz: a24d785fff6763046ceeea5785d3ad0000496f16
4
+ data.tar.gz: 6a5db73c7439aee25ceb892d34ebf8d6466c0d6f
5
5
  SHA512:
6
- metadata.gz: 1a43938402fd8d51dd1e4ad42fc22928faf7b85fe1896020b7f9c4db94423b458c1384afa1c7cd86c8cea56037bc4f548f73b05effa9cf54a4eeb63914ed973f
7
- data.tar.gz: 8de92a4cc1dbdef763f1dacf393cc3f9eefb89aa7e64018a0f33c5ea24ba96e87574232ca8e27e1774eb8c6222e473e73822c6b528313f50265d9aa4a10ccd80
6
+ metadata.gz: 540e03c839745d68f91383dcbee1026dedf31e6f7c6e5c02962dea1db63a71f34fd4647ab20db081e1f33f1148cd588c812ecb825ccb2d9d8b2fcc4861577b10
7
+ data.tar.gz: 9b5ae238698d5412448618779a616522c1e065912ee114ac5e36950b107d8a0cf97a5e4a6d8c0948502e5648f07ddaafdd51aaf5d360940471e733667dcda724
data/README.md CHANGED
@@ -1,46 +1,76 @@
1
1
  # Jekyll Multiple Languages Plugin
2
2
 
3
- Jekyll Multiple Languages is an internationalization plugin for [Jekyll](https://github.com/mojombo/jekyll). It compiles your Jekyll site for one or more languages with a similar approach as Rails does. The different sites will be stored in sub folders with the same name as the language it contains.
3
+ ![Jekyll Multiple Languages Plugin](brand/jekyll_multiple_languages_plugin_logo.png)
4
4
 
5
- The plugin was developed as an utility at [Screen Interaction](http://www.screeninteraction.com)
5
+ Jekyll Multiple Languages is an internationalization plugin for [Jekyll](https://github.com/mojombo/jekyll). It compiles your Jekyll site for one or more languages with a similar approach as Rails does. The different sites will be stored in subfolders with the same name as the language it contains.
6
+
7
+ The plugin was developed as a utility at [Screen Interaction](http://www.screeninteraction.com)
6
8
 
7
9
  ### Gem [![Gem Version](https://badge.fury.io/rb/jekyll-multiple-languages-plugin.png)](http://badge.fury.io/rb/jekyll-multiple-languages-plugin)
8
10
 
9
11
 
10
12
 
11
- ## Current Relese Notice
13
+ Table of Contents
14
+ -----------------
15
+ * [1\. Current Release Notice](#1-current-release-notice)
16
+ * [2\. Features](#2-features)
17
+ * [3\. Installation](#3-installation)
18
+ * [3\.1\. Using the gem](#31-using-the-gem)
19
+ * [3\.2\. Manually](#32-manually)
20
+ * [3\.3\. As a Git Submodule](#33-as-a-git-submodule)
21
+ * [4\. Configuration](#4-configuration)
22
+ * [4\.1\. \_config\.yml](#41-_configyml)
23
+ * [4\.2\. Folder structure](#42-folder-structure)
24
+ * [5\. Usage](#5-usage)
25
+ * [5\.1\. Translating strings](#51-translating-strings)
26
+ * [5\.2\. Including translated files](#52-including-translated-files)
27
+ * [5\.3\. Permalinks and Translating Links](#53-permalinks-and-translating-links)
28
+ * [5\.4\. i18n in templates](#54-i18n-in-templates)
29
+ * [5\.5\. Link between languages](#55-link-between-languages)
30
+ * [5\.6\. Creating pages](#56-creating-pages)
31
+ * [7\. Example website](#7-example-website)
32
+ * [7\.1\. Adding a new language](#71-adding-a-new-language)
33
+ * [7\.2\. Adding new page](#72-adding-new-page)
34
+ * [8\. Changelog](#8-changelog)
35
+ * [9\. Contributing](#9-contributing)
36
+ * [Contributors](#contributors)
37
+ * [Created by](#created-by)
38
+ * [Maintained by](#maintained-by)
39
+ * [10\. Other Language Plugins](#10-other-language-plugins)
40
+
41
+ ## 1. Current Release Notice
12
42
 
13
43
  1.4.1 is the current stable release.
14
44
 
15
45
  Users that update from older versions to 1.4.0 or newer must change their `_config.yml` for the plugin to be loaded. Please see the `Installation` section bellow for the new string used to load the plugin.
16
46
 
17
- The plugin now works with Jekyll 3, but it's backwards compatible with Jekyll 2.
47
+ The plugin now works with Jekyll 3, but it's backward compatible with Jekyll 2.
18
48
  Please note that it was only tested with Jekyll 2.5.3 and 3.1.3.
19
49
 
20
- The support for Octopress is dropped, but the plugin still should work with it since Octopress core is Jekyll.
21
- Octopress 3 now has it's own multi languages plugin: https://github.com/octopress/multilingual
50
+ The support for Octopress is dropped, but the plugin should still work with it since Octopress core is Jekyll.
51
+ Octopress 3 now has its own multi languages plugin: https://github.com/octopress/multilingual
22
52
 
23
53
 
24
54
 
25
- ## Features
55
+ ## 2. Features
26
56
  * Works with Jekyll 2.5.3 and 3.1.3
27
57
  * Supports multiple languages with the same code base.
28
58
  * Supports all template languages that your Liquid pipeline supports.
29
59
  * Uses [Liquid tags](https://github.com/Shopify/liquid) in your HTML for including translated strings.
30
60
  * Compiles the site multiple times for all supported languages into separate subfolders.
31
61
  * Works with the --watch flag turned on and will rebuild all languages automatically.
32
- * Contains an example web site thanks to [@davrandom](https://github.com/davrandom/)
62
+ * Contains an example website, thanks to [@davrandom](https://github.com/davrandom/)
33
63
  * Supports translated keys in YAML format
34
64
  * Supports translated template files
35
65
  * Supports translated links
36
66
 
37
67
 
38
68
 
39
- ## Installation
69
+ ## 3. Installation
40
70
 
41
- ### Using the gem
71
+ ### 3.1. Using the gem
42
72
 
43
- This plugin is available as a Rubygem, https://rubygems.org/gems/jekyll-multiple-languages-plugin.
73
+ This plugin is available as a Ruby gem, https://rubygems.org/gems/jekyll-multiple-languages-plugin.
44
74
 
45
75
  Add this line to your application's Gemfile:
46
76
 
@@ -60,12 +90,12 @@ gems:
60
90
  ```
61
91
  See the [Jekyll configuration documentation](http://jekyllrb.com/docs/configuration) for details.
62
92
 
63
- ### Manually
93
+ ### 3.2. Manually
64
94
  1. Download the repository with Git or your preferred method.
65
- 2. Inside your Jekyll `_plugins` folder create a new folder called `jekyll-multiple-languages-plugin`.
95
+ 2. Inside your Jekyll `_plugins` folder, create a new folder called `jekyll-multiple-languages-plugin`.
66
96
  3. Copy or link the directory `lib`, that is inside the downloaded repository, into your `_plugins/jekyll-multiple-languages-plugin` folder of your Jekyll project.
67
97
 
68
- ### As a Git Submodule
98
+ ### 3.3. As a Git Submodule
69
99
 
70
100
  If your Jekyll project is in a git repository, you can easily manage your plugins by utilizing git submodules.
71
101
 
@@ -84,15 +114,15 @@ $ git pull origin master
84
114
 
85
115
 
86
116
 
87
- ## Configuration
88
- ### _config.yml
117
+ ## 4. Configuration
118
+ ### 4.1. _config.yml
89
119
  Add the languages available in your website into your _config.yml (obligatory):
90
120
 
91
121
  ```yaml
92
122
  languages: ["sv", "en", "de", "fr"]
93
123
  ```
94
124
 
95
- The first language in the array will be the default language, English, German and French will be added in to separate subfolders.
125
+ The first language in the array will be the default language, English, German and French will be added into separate subfolders.
96
126
 
97
127
  To avoid redundancy, it is possible to exclude files and folders from being copied to the localization folders.
98
128
 
@@ -105,7 +135,7 @@ In code, these specific files should be referenced via `baseurl_root`. E.g.
105
135
  <link rel="stylesheet" href="{{ "/css/bootstrap.css" | prepend: site.baseurl_root }}"/>
106
136
  ```
107
137
 
108
- ### Folder structure
138
+ ### 4.2. Folder structure
109
139
  Create a folder called `_i18n` and add sub-folders for each language, using the same names used on the `languages` setting on the `_config.yml`:
110
140
 
111
141
  - /_i18n/sv.yml
@@ -119,9 +149,9 @@ Create a folder called `_i18n` and add sub-folders for each language, using the
119
149
 
120
150
 
121
151
 
122
- ## Usage
123
- ### Translating strings
124
- To add a translated string into your web page use one of these liquid tags:
152
+ ## 5. Usage
153
+ ### 5.1. Translating strings
154
+ To add a translated string into your web page, use one of these liquid tags:
125
155
 
126
156
  ```liquid
127
157
  {% t key %}
@@ -135,14 +165,14 @@ The language.yml files are written in YAML syntax which caters for a simple grou
135
165
 
136
166
  ```yaml
137
167
  global:
138
- swedish: Svenska
139
- english: English
168
+ swedish: Svenska
169
+ english: English
140
170
  pages:
141
- home: Home
142
- work: Work
171
+ home: Home
172
+ work: Work
143
173
  ```
144
174
 
145
- To access the english key, use one of these tag:
175
+ To access the `english` key, use one of these tag:
146
176
 
147
177
  ```liquid
148
178
  {% t global.english %}
@@ -150,7 +180,15 @@ or
150
180
  {% translate global.english %}
151
181
  ```
152
182
 
153
- ### Including translated files
183
+ You can also access translated strings by accesing the `site.translations` hash, this allows you to loop trough your translations within Liquid:
184
+
185
+ ```liquid
186
+ {% for item in site.translations[site.lang]["my_nested_yaml_collection"] %}
187
+ <p>{{ item[0] }} -> {{ item[1] }}</p>
188
+ {% endfor %}
189
+ ```
190
+
191
+ ### 5.2. Including translated files
154
192
  The plugin also supports using different markdown files for different languages using the liquid tag:
155
193
 
156
194
  ```liquid
@@ -159,16 +197,16 @@ or
159
197
  {% translate_file pagename/blockname.md %}
160
198
  ```
161
199
 
162
- This plugin have exactly the same support and syntax as the Jekyll's built in liquid tag:
200
+ This plugin has exactly the same support and syntax as the Jekyll's built in liquid tag:
163
201
 
164
202
  ```liquid
165
203
  {% include file %}
166
204
  ```
167
205
 
168
- so plugins that extends its functionality should be picked up by this plugin as well.
206
+ so plugins that extend its functionality should be picked up by this plugin as well.
169
207
 
170
- ### Permalinks and Translating Links
171
- To use localized pages with permalinks, you must provide a defalt permalink `permalink` and the language specific permalinks, for example, `permalink_fr` for French.
208
+ ### 5.3. Permalinks and Translating Links
209
+ To use localized pages with permalinks, you must provide a default `permalink` and the language specific permalinks, for example, `permalink_fr` for French.
172
210
 
173
211
  To translate links, you must also add a **unique namespace** on the YAML front matter along with the permalinks.
174
212
 
@@ -188,31 +226,31 @@ permalink_fr: /equipe/
188
226
  And then you can use the translate link liquid tag like this:
189
227
 
190
228
  ```liquid
191
- <a href="{% tl team %}"> <!--This link will return /team if we are in the english version of the website and /fr/equipe if it's the french version</a>-->
229
+ <a href="{% tl team %}"> <!--This link will return /team if we are in the English version of the website and /fr/equipe if it's the French version</a>-->
192
230
 
193
231
  <a href="{% tl team fr %}"> <!--This link will always return /fr/equipe</a>-->
194
232
 
195
233
  or the longer version:
196
234
 
197
- <a href="{% translate_link team %}"> <!--This link will return /team if we are in the english version of the website and /fr/equipe if it's the french version</a>-->
235
+ <a href="{% translate_link team %}"> <!--This link will return /team if we are in the English version of the website and /fr/equipe if it's the french version</a>-->
198
236
 
199
237
  <a href="{% translate_link team fr %}"> <!--This link will always return /fr/equipe</a>-->
200
238
  ```
201
239
 
202
- ### i18n in templates
203
- Sometimes it is convenient to add keys even in template files. This works in the exact same way as in ordinary files, however sometimes it can be useful to include different string in different pages even if they use the same template.
240
+ ### 5.4. i18n in templates
241
+ Sometimes it is convenient to add keys even in template files. This works in the exact same way as in ordinary files, however sometimes it can be useful to include a different string in different pages even if they use the same template.
204
242
 
205
243
  A perfect example is this:
206
244
 
207
245
  ```html
208
246
  <html>
209
- <head>
210
- <title>{% t page.title %}</title>
211
- </head>
247
+ <head>
248
+ <title>{% t page.title %}</title>
249
+ </head>
212
250
  </html>
213
251
  ```
214
252
 
215
- So how can I add different translated titles to all pages? Don't worry, it's easy. The Multiple Languages plugin supports Liquid variables as well as strings so define a page variable in your page definition
253
+ So how can I add different translated titles to all pages? Don't worry, it's easy. The Multiple Languages plugin supports Liquid variables, as well as strings so, define a page variable in your page definition
216
254
 
217
255
  ```yaml
218
256
  ---
@@ -225,12 +263,12 @@ and `<title>{% t page.title %}</title>` will pick up the `titles.home` key from
225
263
 
226
264
  ```yaml
227
265
  titles:
228
- home: "Home"
266
+ home: "Home"
229
267
  ```
230
268
 
231
269
 
232
270
 
233
- ### Link between languages
271
+ ### 5.5. Link between languages
234
272
  This plugin gives you the variables
235
273
 
236
274
  ```liquid
@@ -267,8 +305,8 @@ This snippet will create a link that will toggle between Swedish and English. A
267
305
 
268
306
 
269
307
 
270
- ### Creating pages
271
- Depending on the theme, or your preferences, you need to create a "template" page at the root folder or in a folder (ex. `_pages`). Inside each page (in this example an `about.md`) you should have at least the following in the header and body:
308
+ ### 5.6. Creating pages
309
+ Depending on the theme, or your preferences, you need to create a "template" page in the root folder or in a folder (ex. `_pages`). Inside each page (in this example an `about.md`) you should have at least the following in the header and body:
272
310
 
273
311
  ```yaml
274
312
  ---
@@ -284,23 +322,23 @@ Inside each of the language folders, you should create mirror pages to provide t
284
322
 
285
323
 
286
324
 
287
- ## Example website
325
+ ## 7. Example website
288
326
 
289
327
  This repository has an example website where you can test the plugin.
290
328
  After downloading the repository, get into the `example` directory and run: `bundle install` to install the newest version of Jekyll (change the Gemfile to install another version), the plugin, and all other dependencies.
291
329
 
292
330
  Then run `bundle exec jekyll serve` to start the Jekyll server. Using your web browser, access the address `http://localhost:4000`.
293
331
 
294
- ### Adding a new language
332
+ ### 7.1. Adding a new language
295
333
 
296
- Imagine you want to add German pages on the test website. First, add a the new language into the list of languages on `_config.yml`:
334
+ Imagine you want to add German pages on the test website. First, add a new language to the list of languages on `_config.yml`:
297
335
  ```ruby
298
336
  languages: ["it", "en", "es", "de"]
299
337
  ```
300
338
 
301
- Create a new folder for the language under the `_i18n` folder and add a markdown file containing the translation, just like on the other languages folders, and you're done.
339
+ Create a new folder for the language under the `_i18n` folder and add a markdown file containing the translation, just like on the other language folders, and you're done.
302
340
 
303
- ### Adding new page
341
+ ### 7.2. Adding new page
304
342
 
305
343
  Let's say you want to create an about page for the example website, you will create an `about.html` page on the root of the website (same place as index.html), with this:
306
344
 
@@ -318,7 +356,9 @@ Then, create a file named `about.md` under `_i18n/en` with the English content.
318
356
 
319
357
 
320
358
 
321
- ## Changelog
359
+ ## 8. Changelog
360
+ * 1.4.2
361
+ * Exposes the `site.translations` hash containing the translated strings to Liquid.
322
362
  * 1.4.1
323
363
  * Fixes a bug during site regeneration where translation paths were being nested based on wrongly set Jekyll variables.
324
364
  * 1.4.0
@@ -328,8 +368,8 @@ Then, create a file named `about.md` under `_i18n/en` with the English content.
328
368
  * Code refactoring, cleanup and reorganization
329
369
  * Files and folders reorganization
330
370
  * Improved and fixed issues on the example website
331
- * Inprovement and fixes on documentations
332
- * Inproved license files
371
+ * Improvements and fixes on documentations
372
+ * Improved license files
333
373
  * 1.3.0
334
374
  * Support for localized links and custom permalinks, thanks to [@jasonlemay](https://github.com/screeninteraction/jekyll-multiple-languages-plugin/pull/53)
335
375
  * Support for excluding posts from translation, thanks to [@ctruelson](https://github.com/screeninteraction/jekyll-multiple-languages-plugin/pull/51)
@@ -342,7 +382,7 @@ Then, create a file named `about.md` under `_i18n/en` with the English content.
342
382
  * 1.2.6
343
383
  * Added fallback to default language, thanks to [@agramian](https://github.com/agramian)
344
384
  * 1.2.5
345
- * Fixed a bug when global variables wasn't as global as expected
385
+ * Fixed a bug when global variables weren't as global as expected
346
386
  * 1.2.4
347
387
  * Fixed a bug when changes in .yml files got lost during live reload.
348
388
  * 1.2.3
@@ -364,13 +404,13 @@ Then, create a file named `about.md` under `_i18n/en` with the English content.
364
404
  * First release
365
405
 
366
406
 
367
- ## Contributing
407
+ ## 9. Contributing
368
408
 
369
409
  1. Fork it
370
410
  2. Create your feature branch (`git checkout -b my-new-feature`)
371
411
  3. Commit your changes (`git commit -am 'Add some feature'`)
372
412
  4. Push to the branch (`git push origin my-new-feature`)
373
- 5. Create new Pull Request
413
+ 5. Create a new Pull Request
374
414
 
375
415
  ### Contributors
376
416
  | User | Contribution |
@@ -393,3 +433,31 @@ Then, create a file named `about.md` under `_i18n/en` with the English content.
393
433
  ### Maintained by
394
434
  - [@kurtsson](https://github.com/kurtsson)
395
435
  - [@Anthony-Gaudino](https://github.com/Anthony-Gaudino)
436
+
437
+
438
+
439
+ ## 10. Other Language Plugins
440
+ Bellow is a list of other language plugins for Jekyll (2016/05/28):
441
+
442
+ **Seems to be maintained:**
443
+
444
+ * [Jekyll Language Plugin](https://github.com/vwochnik/jekyll-language-plugin)
445
+ * [Polyglot](https://github.com/untra/polyglot)
446
+ * [Jekyll Multiple Languages](https://github.com/liaohuqiu/jekyll-multiple-languages)
447
+ * [Octopress Multilingual](https://github.com/octopress/multilingual)
448
+ * [jekyll-i18n_tags](https://github.com/KrzysiekJ/jekyll-i18n_tags)
449
+ * [jekyll-task-i18n](https://github.com/ruby-gettext/jekyll-task-i18n)
450
+
451
+ **Seems to be unmaintained / abandoned:**
452
+
453
+ * [Jekyll-Multilingualism](https://github.com/aleiphoenix/jekyll-multilingualism)
454
+ * [Jekyll::Languages](https://github.com/janlindblom/jekyll-languages)
455
+ * [Jekyll I18n support](https://github.com/hendricius/jekyll-i18n)
456
+ * [jekyll-multilingual](https://github.com/drallgood/jekyll-multilingual)
457
+ * [jekyll-msgcat](https://github.com/gromnitsky/jekyll-msgcat)
458
+ * [jekyll-localize](https://github.com/incompl/jekyll-localize)
459
+ * [Jekyll i18n Filter](https://github.com/nelsonsar/jekyll-i18n-filter)
460
+ * [jekyll-localization](https://github.com/prometheus-ev/jekyll-localization)
461
+ * [Jekyll i18n](https://github.com/liamzebedee/jekyll-i18n)
462
+
463
+ This plugin will in the future try to merge all pertinent features of all those plugins into it.
@@ -63,6 +63,7 @@ module Jekyll
63
63
  self.config['default_lang'] = languages.first # Default language (first language of array set on _config.yml)
64
64
  self.config[ 'lang'] = languages.first # Current language being processed
65
65
  self.config['baseurl_root'] = baseurl_org # Baseurl of website root (without the appended language code)
66
+ self.config['translations'] = self.parsed_translations # Hash that stores parsed translations read from YAML files. Exposes this hash to Liquid.
66
67
 
67
68
 
68
69
  # Build the website for default language
@@ -1,6 +1,6 @@
1
1
  module Jekyll
2
2
  module MultipleLanguagesPlugin
3
- VERSION = "1.4.1"
3
+ VERSION = "1.4.2"
4
4
  end
5
5
  end
6
6
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-multiple-languages-plugin
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.1
4
+ version: 1.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Martin Kurtsson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-05-25 00:00:00.000000000 Z
11
+ date: 2016-06-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler