jekyll-multiple-languages-plugin 1.4.2 → 1.7.0

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
- SHA1:
3
- metadata.gz: a24d785fff6763046ceeea5785d3ad0000496f16
4
- data.tar.gz: 6a5db73c7439aee25ceb892d34ebf8d6466c0d6f
2
+ SHA256:
3
+ metadata.gz: 9f3a2a500acf67ad5bea871232433bab2c4fee41366f0d59864e09256121eecf
4
+ data.tar.gz: 2c9a1a596557ecd8aea38c07e0607d5e104e4c755b1f41c01fd14b9355d75f30
5
5
  SHA512:
6
- metadata.gz: 540e03c839745d68f91383dcbee1026dedf31e6f7c6e5c02962dea1db63a71f34fd4647ab20db081e1f33f1148cd588c812ecb825ccb2d9d8b2fcc4861577b10
7
- data.tar.gz: 9b5ae238698d5412448618779a616522c1e065912ee114ac5e36950b107d8a0cf97a5e4a6d8c0948502e5648f07ddaafdd51aaf5d360940471e733667dcda724
6
+ metadata.gz: f94a3062d46cbcfe28d878073e539ebf675494021e16d0bb96297878720a9c8b449f7d4a12b1d04bfc8a717178eb828bf7a15428842e5772412643099d5dbdfd
7
+ data.tar.gz: 9e11ecf14870bbf6655d0ed407d83409ce87c57880e5ceac803d0236bc56c222b7d1af9cba901861edf23303b3db8a92dcdcc3ef50e3260dfde766a757f71c39
@@ -1,353 +1,9 @@
1
- Mozilla Public License Version 2.0
2
- ==================================
1
+ MIT License
3
2
 
4
- 1. Definitions
5
- --------------
3
+ Copyright (c) 2014 Martin Kurtsson
6
4
 
7
- 1.1. "Contributor"
8
- means each individual or legal entity that creates, contributes to the
9
- creation of, or owns Covered Software.
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
10
6
 
11
- 1.2. "Contributor Version"
12
- means the combination of the Contributions of others (if any) used by a
13
- Contributor and that particular Contributor's Contribution.
7
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
14
8
 
15
- 1.3. "Contribution"
16
- means Covered Software of a particular Contributor.
17
-
18
- 1.4. "Covered Software"
19
- means Source Code Form to which the initial Contributor has attached the
20
- notice in Exhibit A, the Executable Form of such Source Code Form, and
21
- Modifications of such Source Code Form, in each case including portions
22
- thereof.
23
-
24
- 1.5. "Incompatible With Secondary Licenses"
25
- means
26
-
27
- (a) that the initial Contributor has attached the notice described in
28
- Exhibit B to the Covered Software; or
29
-
30
- (b) that the Covered Software was made available under the terms of version
31
- 1.1 or earlier of the License, but not also under the terms of a
32
- Secondary License.
33
-
34
- 1.6. "Executable Form"
35
- means any form of the work other than Source Code Form.
36
-
37
- 1.7. "Larger Work"
38
- means a work that combines Covered Software with other material, in a
39
- separate file or files, that is not Covered Software.
40
-
41
- 1.8. "License"
42
- means this document.
43
-
44
- 1.9. "Licensable"
45
- means having the right to grant, to the maximum extent possible, whether at
46
- the time of the initial grant or subsequently, any and all of the rights
47
- conveyed by this License.
48
-
49
- 1.10. "Modifications"
50
- means any of the following:
51
-
52
- (a) any file in Source Code Form that results from an addition to, deletion
53
- from, or modification of the contents of Covered Software; or
54
-
55
- (b) any new file in Source Code Form that contains any Covered Software.
56
-
57
- 1.11. "Patent Claims" of a Contributor
58
- means any patent claim(s), including without limitation, method, process,
59
- and apparatus claims, in any patent Licensable by such Contributor that
60
- would be infringed, but for the grant of the License, by the making, using,
61
- selling, offering for sale, having made, import, or transfer of either its
62
- Contributions or its Contributor Version.
63
-
64
- 1.12. "Secondary License"
65
- means either the GNU General Public License, Version 2.0, the GNU Lesser
66
- General Public License, Version 2.1, the GNU Affero General Public License,
67
- Version 3.0, or any later versions of those licenses.
68
-
69
- 1.13. "Source Code Form"
70
- means the form of the work preferred for making modifications.
71
-
72
- 1.14. "You" (or "Your")
73
- means an individual or a legal entity exercising rights under this License.
74
- For legal entities, "You" includes any entity that controls, is controlled
75
- by, or is under common control with You. For purposes of this definition,
76
- "control" means (a) the power, direct or indirect, to cause the direction or
77
- management of such entity, whether by contract or otherwise, or (b)
78
- ownership of more than fifty percent (50%) of the outstanding shares or
79
- beneficial ownership of such entity.
80
-
81
- 2. License Grants and Conditions
82
- --------------------------------
83
-
84
- 2.1. Grants
85
-
86
- Each Contributor hereby grants You a world-wide, royalty-free, non-exclusive
87
- license:
88
-
89
- (a) under intellectual property rights (other than patent or trademark)
90
- Licensable by such Contributor to use, reproduce, make available, modify,
91
- display, perform, distribute, and otherwise exploit its Contributions,
92
- either on an unmodified basis, with Modifications, or as part of a Larger
93
- Work; and
94
-
95
- (b) under Patent Claims of such Contributor to make, use, sell, offer for sale,
96
- have made, import, and otherwise transfer either its Contributions or its
97
- Contributor Version.
98
-
99
- 2.2. Effective Date
100
-
101
- The licenses granted in Section 2.1 with respect to any Contribution become
102
- effective for each Contribution on the date the Contributor first distributes
103
- such Contribution.
104
-
105
- 2.3. Limitations on Grant Scope
106
-
107
- The licenses granted in this Section 2 are the only rights granted under this
108
- License. No additional rights or licenses will be implied from the distribution
109
- or licensing of Covered Software under this License. Notwithstanding Section
110
- 2.1(b) above, no patent license is granted by a Contributor:
111
-
112
- (a) for any code that a Contributor has removed from Covered Software;
113
- or
114
-
115
- (b) for infringements caused by: (i) Your and any other third party's
116
- modifications of Covered Software, or (ii) the combination of its
117
- Contributions with other software (except as part of its Contributor
118
- Version); or
119
-
120
- (c) under Patent Claims infringed by Covered Software in the absence of its
121
- Contributions.
122
-
123
- This License does not grant any rights in the trademarks, service marks, or
124
- logos of any Contributor (except as may be necessary to comply with the notice
125
- requirements in Section 3.4).
126
-
127
- 2.4. Subsequent Licenses
128
-
129
- No Contributor makes additional grants as a result of Your choice to distribute
130
- the Covered Software under a subsequent version of this License (see Section
131
- 10.2) or under the terms of a Secondary License (if permitted under the terms of
132
- Section 3.3).
133
-
134
- 2.5. Representation
135
-
136
- Each Contributor represents that the Contributor believes its Contributions are
137
- its original creation(s) or it has sufficient rights to grant the rights to its
138
- Contributions conveyed by this License.
139
-
140
- 2.6. Fair Use
141
-
142
- This License is not intended to limit any rights You have under applicable
143
- copyright doctrines of fair use, fair dealing, or other equivalents.
144
-
145
- 2.7. Conditions
146
-
147
- Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted in
148
- Section 2.1.
149
-
150
- 3. Responsibilities
151
- -------------------
152
-
153
- 3.1. Distribution of Source Form
154
-
155
- All distribution of Covered Software in Source Code Form, including any
156
- Modifications that You create or to which You contribute, must be under the
157
- terms of this License. You must inform recipients that the Source Code Form of
158
- the Covered Software is governed by the terms of this License, and how they can
159
- obtain a copy of this License. You may not attempt to alter or restrict the
160
- recipients' rights in the Source Code Form.
161
-
162
- 3.2. Distribution of Executable Form
163
-
164
- If You distribute Covered Software in Executable Form then:
165
-
166
- (a) such Covered Software must also be made available in Source Code Form, as
167
- described in Section 3.1, and You must inform recipients of the Executable
168
- Form how they can obtain a copy of such Source Code Form by reasonable means
169
- in a timely manner, at a charge no more than the cost of distribution to the
170
- recipient; and
171
-
172
- (b) You may distribute such Executable Form under the terms of this License, or
173
- sublicense it under different terms, provided that the license for the
174
- Executable Form does not attempt to limit or alter the recipients' rights in
175
- the Source Code Form under this License.
176
-
177
- 3.3. Distribution of a Larger Work
178
-
179
- You may create and distribute a Larger Work under terms of Your choice, provided
180
- that You also comply with the requirements of this License for the Covered
181
- Software. If the Larger Work is a combination of Covered Software with a work
182
- governed by one or more Secondary Licenses, and the Covered Software is not
183
- Incompatible With Secondary Licenses, this License permits You to additionally
184
- distribute such Covered Software under the terms of such Secondary License(s),
185
- so that the recipient of the Larger Work may, at their option, further
186
- distribute the Covered Software under the terms of either this License or such
187
- Secondary License(s).
188
-
189
- 3.4. Notices
190
-
191
- You may not remove or alter the substance of any license notices (including
192
- copyright notices, patent notices, disclaimers of warranty, or limitations of
193
- liability) contained within the Source Code Form of the Covered Software, except
194
- that You may alter any license notices to the extent required to remedy known
195
- factual inaccuracies.
196
-
197
- 3.5. Application of Additional Terms
198
-
199
- You may choose to offer, and to charge a fee for, warranty, support, indemnity
200
- or liability obligations to one or more recipients of Covered Software. However,
201
- You may do so only on Your own behalf, and not on behalf of any Contributor. You
202
- must make it absolutely clear that any such warranty, support, indemnity, or
203
- liability obligation is offered by You alone, and You hereby agree to indemnify
204
- every Contributor for any liability incurred by such Contributor as a result of
205
- warranty, support, indemnity or liability terms You offer. You may include
206
- additional disclaimers of warranty and limitations of liability specific to any
207
- jurisdiction.
208
-
209
- 4. Inability to Comply Due to Statute or Regulation
210
- ---------------------------------------------------
211
-
212
- If it is impossible for You to comply with any of the terms of this License with
213
- respect to some or all of the Covered Software due to statute, judicial order,
214
- or regulation then You must: (a) comply with the terms of this License to the
215
- maximum extent possible; and (b) describe the limitations and the code they
216
- affect. Such description must be placed in a text file included with all
217
- distributions of the Covered Software under this License. Except to the extent
218
- prohibited by statute or regulation, such description must be sufficiently
219
- detailed for a recipient of ordinary skill to be able to understand it.
220
-
221
- 5. Termination
222
- --------------
223
-
224
- 5.1. The rights granted under this License will terminate automatically if You
225
- fail to comply with any of its terms. However, if You become compliant, then the
226
- rights granted under this License from a particular Contributor are reinstated
227
- (a) provisionally, unless and until such Contributor explicitly and finally
228
- terminates Your grants, and (b) on an ongoing basis, if such Contributor fails
229
- to notify You of the non-compliance by some reasonable means prior to 60 days
230
- after You have come back into compliance. Moreover, Your grants from a
231
- particular Contributor are reinstated on an ongoing basis if such Contributor
232
- notifies You of the non-compliance by some reasonable means, this is the first
233
- time You have received notice of non-compliance with this License from such
234
- Contributor, and You become compliant prior to 30 days after Your receipt of the
235
- notice.
236
-
237
- 5.2. If You initiate litigation against any entity by asserting a patent
238
- infringement claim (excluding declaratory judgment actions, counter-claims, and
239
- cross-claims) alleging that a Contributor Version directly or indirectly
240
- infringes any patent, then the rights granted to You by any and all Contributors
241
- for the Covered Software under Section 2.1 of this License shall terminate.
242
-
243
- 5.3. In the event of termination under Sections 5.1 or 5.2 above, all end user
244
- license agreements (excluding distributors and resellers) which have been
245
- validly granted by You or Your distributors under this License prior to
246
- termination shall survive termination.
247
-
248
- ********************************************************************************
249
- * *
250
- * 6. Disclaimer of Warranty *
251
- * ------------------------- *
252
- * *
253
- * Covered Software is provided under this License on an "as is" basis, *
254
- * without warranty of any kind, either expressed, implied, or statutory, *
255
- * including, without limitation, warranties that the Covered Software is *
256
- * free of defects, merchantable, fit for a particular purpose or *
257
- * non-infringing. The entire risk as to the quality and performance of the *
258
- * Covered Software is with You. Should any Covered Software prove defective *
259
- * in any respect, You (not any Contributor) assume the cost of any necessary *
260
- * servicing, repair, or correction. This disclaimer of warranty constitutes *
261
- * an essential part of this License. No use of any Covered Software is *
262
- * authorized under this License except under this disclaimer. *
263
- * *
264
- ********************************************************************************
265
-
266
- ********************************************************************************
267
- * *
268
- * 7. Limitation of Liability *
269
- * -------------------------- *
270
- * *
271
- * Under no circumstances and under no legal theory, whether tort (including *
272
- * negligence), contract, or otherwise, shall any Contributor, or anyone who *
273
- * distributes Covered Software as permitted above, be liable to You for any *
274
- * direct, indirect, special, incidental, or consequential damages of any *
275
- * character including, without limitation, damages for lost profits, loss of *
276
- * goodwill, work stoppage, computer failure or malfunction, or any and all *
277
- * other commercial damages or losses, even if such party shall have been *
278
- * informed of the possibility of such damages. This limitation of liability *
279
- * shall not apply to liability for death or personal injury resulting from *
280
- * such party's negligence to the extent applicable law prohibits such *
281
- * limitation. Some jurisdictions do not allow the exclusion or limitation of *
282
- * incidental or consequential damages, so this exclusion and limitation may *
283
- * not apply to You. *
284
- * *
285
- ********************************************************************************
286
-
287
- 8. Litigation
288
- -------------
289
-
290
- Any litigation relating to this License may be brought only in the courts of a
291
- jurisdiction where the defendant maintains its principal place of business and
292
- such litigation shall be governed by laws of that jurisdiction, without
293
- reference to its conflict-of-law provisions. Nothing in this Section shall
294
- prevent a party's ability to bring cross-claims or counter-claims.
295
-
296
- 9. Miscellaneous
297
- ----------------
298
-
299
- This License represents the complete agreement concerning the subject matter
300
- hereof. If any provision of this License is held to be unenforceable, such
301
- provision shall be reformed only to the extent necessary to make it enforceable.
302
- Any law or regulation which provides that the language of a contract shall be
303
- construed against the drafter shall not be used to construe this License against
304
- a Contributor.
305
-
306
- 10. Versions of the License
307
- ---------------------------
308
-
309
- 10.1. New Versions
310
-
311
- Mozilla Foundation is the license steward. Except as provided in Section 10.3,
312
- no one other than the license steward has the right to modify or publish new
313
- versions of this License. Each version will be given a distinguishing version
314
- number.
315
-
316
- 10.2. Effect of New Versions
317
-
318
- You may distribute the Covered Software under the terms of the version of the
319
- License under which You originally received the Covered Software, or under the
320
- terms of any subsequent version published by the license steward.
321
-
322
- 10.3. Modified Versions
323
-
324
- If you create software not governed by this License, and you want to create a
325
- new license for such software, you may create and use a modified version of this
326
- License if you rename the license and remove any references to the name of the
327
- license steward (except to note that such modified license differs from this
328
- License).
329
-
330
- 10.4. Distributing Source Code Form that is Incompatible With Secondary Licenses
331
-
332
- If You choose to distribute Source Code Form that is Incompatible With Secondary
333
- Licenses under the terms of this version of the License, the notice described in
334
- Exhibit B of this License must be attached.
335
-
336
- Exhibit A - Source Code Form License Notice
337
- -------------------------------------------
338
-
339
- This Source Code Form is subject to the terms of the Mozilla Public License,
340
- v. 2.0. If a copy of the MPL was not distributed with this file, You can
341
- obtain one at http://mozilla.org/MPL/2.0/.
342
-
343
- If it is not possible or desirable to put the notice in a particular file, then
344
- You may include the notice in a location (such as a LICENSE file in a relevant
345
- directory) where a recipient would be likely to look for such a notice.
346
-
347
- You may add additional accurate notices of copyright ownership.
348
-
349
- Exhibit B - "Incompatible With Secondary Licenses" Notice
350
- ---------------------------------------------------------
351
-
352
- This Source Code Form is "Incompatible With Secondary Licenses", as defined by
353
- the Mozilla Public License, v. 2.0.
9
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md CHANGED
@@ -4,48 +4,55 @@
4
4
 
5
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
6
 
7
- The plugin was developed as a utility at [Screen Interaction](http://www.screeninteraction.com)
7
+ The plugin was developed as a utility at [Daresay](https://daresay.co)
8
8
 
9
- ### Gem [![Gem Version](https://badge.fury.io/rb/jekyll-multiple-languages-plugin.png)](http://badge.fury.io/rb/jekyll-multiple-languages-plugin)
9
+ ### Badges
10
+ [![Build Status](https://travis-ci.com/kurtsson/jekyll-multiple-languages-plugin.svg?branch=master)](https://travis-ci.com/kurtsson/jekyll-multiple-languages-plugin)
11
+ [![Gem Version](https://badge.fury.io/rb/jekyll-multiple-languages-plugin.png)](http://badge.fury.io/rb/jekyll-multiple-languages-plugin)
10
12
 
13
+ ## !! We are looking for more maintainers !!
14
+
15
+ Are you using this plugin? Could you test and verify incoming PRs? Please give us a shout!
11
16
 
12
17
 
13
18
  Table of Contents
14
19
  -----------------
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)
20
+ - [Jekyll Multiple Languages Plugin](#jekyll-multiple-languages-plugin)
21
+ - [Badges](#badges)
22
+ - [!! We are looking for more maintainers !!](#-we-are-looking-for-more-maintainers-)
23
+ - [Table of Contents](#table-of-contents)
24
+ - [1. Current Release Notice](#1-current-release-notice)
25
+ - [2. Features](#2-features)
26
+ - [3. Installation](#3-installation)
27
+ - [3.1. Using the gem](#31-using-the-gem)
28
+ - [3.2. Manually](#32-manually)
29
+ - [3.3. As a Git Submodule](#33-as-a-git-submodule)
30
+ - [4. Configuration](#4-configuration)
31
+ - [4.1. _config.yml](#41-_configyml)
32
+ - [4.2. Folder structure](#42-folder-structure)
33
+ - [5. Usage](#5-usage)
34
+ - [5.1. Translating strings](#51-translating-strings)
35
+ - [5.2. Including translated files](#52-including-translated-files)
36
+ - [5.3. Permalinks and Translating Links](#53-permalinks-and-translating-links)
37
+ - [5.4. i18n in templates](#54-i18n-in-templates)
38
+ - [5.5. Link between languages](#55-link-between-languages)
39
+ - [5.6. Creating pages](#56-creating-pages)
40
+ - [5.7. Creating posts](#57-creating-posts)
41
+ - [6. License](#6-license)
42
+ - [7. Example website](#7-example-website)
43
+ - [7.1. Adding a new language](#71-adding-a-new-language)
44
+ - [7.2. Adding new page](#72-adding-new-page)
45
+ - [8. Changelog](#8-changelog)
46
+ - [9. Contributing](#9-contributing)
47
+ - [Contributors](#contributors)
48
+ - [Created by](#created-by)
49
+ - [Maintained by](#maintained-by)
50
+ - [Former maintainer](#former-maintainer)
51
+ - [10. Other Language Plugins](#10-other-language-plugins)
40
52
 
41
53
  ## 1. Current Release Notice
42
54
 
43
- 1.4.1 is the current stable release.
44
-
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.
46
-
47
- The plugin now works with Jekyll 3, but it's backward compatible with Jekyll 2.
48
- Please note that it was only tested with Jekyll 2.5.3 and 3.1.3.
55
+ 1.6.0 is the current stable release.
49
56
 
50
57
  The support for Octopress is dropped, but the plugin should still work with it since Octopress core is Jekyll.
51
58
  Octopress 3 now has its own multi languages plugin: https://github.com/octopress/multilingual
@@ -53,7 +60,6 @@ Octopress 3 now has its own multi languages plugin: https://github.com/octopress
53
60
 
54
61
 
55
62
  ## 2. Features
56
- * Works with Jekyll 2.5.3 and 3.1.3
57
63
  * Supports multiple languages with the same code base.
58
64
  * Supports all template languages that your Liquid pipeline supports.
59
65
  * Uses [Liquid tags](https://github.com/Shopify/liquid) in your HTML for including translated strings.
@@ -82,10 +88,10 @@ And then execute: `$ bundle install`
82
88
 
83
89
  Or install it yourself as: `$ gem install jekyll-multiple-languages-plugin`
84
90
 
85
- To activate the plugin add it to the Jekyll `_config.yml` file, under the `gems` option:
91
+ To activate the plugin add it to the Jekyll `_config.yml` file, under the `plugins` option:
86
92
 
87
93
  ```ruby
88
- gems:
94
+ plugins:
89
95
  - jekyll-multiple-languages-plugin
90
96
  ```
91
97
  See the [Jekyll configuration documentation](http://jekyllrb.com/docs/configuration) for details.
@@ -135,6 +141,12 @@ In code, these specific files should be referenced via `baseurl_root`. E.g.
135
141
  <link rel="stylesheet" href="{{ "/css/bootstrap.css" | prepend: site.baseurl_root }}"/>
136
142
  ```
137
143
 
144
+ If you wish to avoid having the default_lang built into the root of your website, use:
145
+
146
+ ```yaml
147
+ default_locale_in_subfolder: true
148
+ ```
149
+
138
150
  ### 4.2. Folder structure
139
151
  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`:
140
152
 
@@ -172,7 +184,7 @@ pages:
172
184
  work: Work
173
185
  ```
174
186
 
175
- To access the `english` key, use one of these tag:
187
+ To access the `english` key, use one of these tags:
176
188
 
177
189
  ```liquid
178
190
  {% t global.english %}
@@ -180,14 +192,36 @@ or
180
192
  {% translate global.english %}
181
193
  ```
182
194
 
183
- You can also access translated strings by accesing the `site.translations` hash, this allows you to loop trough your translations within Liquid:
195
+ You can also access translated strings by accessing the `site.translations` hash, this allows you to loop through your translations within Liquid using the translated string's index:
184
196
 
185
197
  ```liquid
186
- {% for item in site.translations[site.lang]["my_nested_yaml_collection"] %}
198
+ {% for item in site.translations[site.lang].my_nested_yaml_collection %}
187
199
  <p>{{ item[0] }} -> {{ item[1] }}</p>
188
200
  {% endfor %}
189
201
  ```
190
202
 
203
+ or the translated string's assignment:
204
+
205
+ ```yaml
206
+ my_nested_yaml_collection:
207
+ -
208
+ title: First
209
+ message: Message
210
+ -
211
+ title: Second
212
+ message: Message
213
+
214
+ ```
215
+
216
+ ```liquid
217
+ {% for item in site.translations[site.lang].my_nested_yaml_collection %}
218
+ <li>
219
+ <h2>{{ item["title"] }}</h2>
220
+ <p>{{ item["message"] }}</p>
221
+ </li>
222
+ {% endfor %}
223
+ ```
224
+
191
225
  ### 5.2. Including translated files
192
226
  The plugin also supports using different markdown files for different languages using the liquid tag:
193
227
 
@@ -272,7 +306,7 @@ titles:
272
306
  This plugin gives you the variables
273
307
 
274
308
  ```liquid
275
- {{ page.lang }}
309
+ {{ site.lang }}
276
310
 
277
311
  and
278
312
 
@@ -286,7 +320,7 @@ This allows you to create solutions like this:
286
320
 
287
321
  ``` liquid
288
322
  {% if site.lang == "sv" %}
289
- {% capture link1 %}{{ site.baseurl_root }}en{{ page.url}}{% endcapture %}
323
+ {% capture link1 %}{{ site.baseurl_root }}/en{{ page.url}}{% endcapture %}
290
324
  <a href="{{ link1 }}" >{% t global.english %}</a>
291
325
  {% elsif site.lang == "en" %}
292
326
  {% capture link2 %}{{ site.baseurl_root }}{{ page.url }}{% endcapture %}
@@ -322,10 +356,17 @@ Inside each of the language folders, you should create mirror pages to provide t
322
356
 
323
357
 
324
358
 
359
+ ### 5.7. Creating posts
360
+ There are no global posts. The posts are localized by language. And your posts will live in the `_i18n/[lang]/_posts` directory. So if, for example, you have English language on your website you should put your posts on `_i18n/en/_posts` directory.
361
+
362
+ ## 6. License
363
+
364
+ This project is available under the [MIT License](LICENSE.txt).
365
+
325
366
  ## 7. Example website
326
367
 
327
368
  This repository has an example website where you can test the plugin.
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.
369
+ After downloading the repository, get into the `example` directory and run: `bundle install` to install the newest version of Jekyll (edit the Gemfile to install another version) and all other dependencies.
329
370
 
330
371
  Then run `bundle exec jekyll serve` to start the Jekyll server. Using your web browser, access the address `http://localhost:4000`.
331
372
 
@@ -355,8 +396,30 @@ permalink: /about/
355
396
  Then, create a file named `about.md` under `_i18n/en` with the English content. Repeat this for the other languages (_i18n/es/about.md ...). When running the website, visit the address `http://localhost:4000/about` to see the English version, `http://localhost:4000/es/about` for the Spanish one, etc.
356
397
 
357
398
 
358
-
359
399
  ## 8. Changelog
400
+ * 1.7.0
401
+ * Option to build the default language into a subfolder
402
+ * Configurable verbosity
403
+ * Improved documentation
404
+ * Removed deprecation warning
405
+ * 1.6.1
406
+ * Improved testing
407
+ * Support for Jekyll 4
408
+ * Russian examples
409
+ * Translations rebuilt every time page is reloaded in developer mode
410
+ * 1.6.0
411
+ * fix: check if static_file_r_path is set
412
+ * Missing slash before lang prefix in lang picker example
413
+ * Updated README.md with _posts directory
414
+ * Build translations in pre_render hook
415
+ * If include not found, fall back to default language
416
+ * 1.5.1
417
+ * Fix a bug (#70) where `site.static_files` would be empty on subsites if `exclude_from_localizations` is used.
418
+ * Some overall project enhancements and minor fixes.
419
+ * A simple Rake task is available to test the plugin, CI services now have something to run.
420
+ * 1.5.0
421
+ * Enables Liquid expansions within Liquid Tags.
422
+ * The example website post language switchers were rewritten in an algorithmic way.
360
423
  * 1.4.2
361
424
  * Exposes the `site.translations` hash containing the translated strings to Liquid.
362
425
  * 1.4.1
@@ -427,29 +490,28 @@ Then, create a file named `about.md` under `_i18n/en` with the English content.
427
490
  | [@leoditommaso](https://github.com/leoditommaso) | update the example page |
428
491
 
429
492
  ### Created by
430
- [@kurtsson](https://github.com/kurtsson) from [Screen Interaction](https://github.com/screeninteraction) (http://screeninteraction.com)
431
-
493
+ [@kurtsson](https://github.com/kurtsson) from [Daresay](https://github.com/daresaydigital) (https://daresay.co)
432
494
 
433
495
  ### Maintained by
434
- - [@kurtsson](https://github.com/kurtsson)
496
+ - [@shushugah](https://github.com/shushugah)
497
+
498
+ ### Former maintainer
435
499
  - [@Anthony-Gaudino](https://github.com/Anthony-Gaudino)
436
500
 
437
501
 
438
502
 
439
503
  ## 10. Other Language Plugins
440
- Bellow is a list of other language plugins for Jekyll (2016/05/28):
504
+ Below is a list of other language plugins for Jekyll (2019/06/27):
441
505
 
442
506
  **Seems to be maintained:**
443
-
444
- * [Jekyll Language Plugin](https://github.com/vwochnik/jekyll-language-plugin)
445
507
  * [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)
508
+ * [Jekyll Language Plugin](https://github.com/vwochnik/jekyll-language-plugin)
449
509
  * [jekyll-task-i18n](https://github.com/ruby-gettext/jekyll-task-i18n)
450
510
 
451
511
  **Seems to be unmaintained / abandoned:**
452
-
512
+ * [jekyll-i18n_tags](https://github.com/KrzysiekJ/jekyll-i18n_tags)
513
+ * [Octopress Multilingual](https://github.com/octopress/multilingual)
514
+ * [Jekyll Multiple Languages](https://github.com/liaohuqiu/jekyll-multiple-languages)
453
515
  * [Jekyll-Multilingualism](https://github.com/aleiphoenix/jekyll-multilingualism)
454
516
  * [Jekyll::Languages](https://github.com/janlindblom/jekyll-languages)
455
517
  * [Jekyll I18n support](https://github.com/hendricius/jekyll-i18n)
@@ -16,6 +16,92 @@ require_relative "plugin/version"
16
16
 
17
17
  module Jekyll
18
18
 
19
+ #*****************************************************************************
20
+ # :site, :post_render hook
21
+ #*****************************************************************************
22
+ Jekyll::Hooks.register :site, :pre_render do |site, payload|
23
+ lang = site.config['lang']
24
+ puts "Loading translation from file #{site.source}/_i18n/#{lang}.yml"
25
+ site.parsed_translations[lang] = YAML.load_file("#{site.source}/_i18n/#{lang}.yml")
26
+ end
27
+
28
+ #*****************************************************************************
29
+ # :site, :post_write hook
30
+ #*****************************************************************************
31
+ Jekyll::Hooks.register :site, :post_write do |site|
32
+
33
+ # Moves excluded paths from the default lang subfolder to the root folder
34
+ #===========================================================================
35
+ default_lang = site.config["default_lang"]
36
+ current_lang = site.config["lang"]
37
+ exclude_paths = site.config["exclude_from_localizations"]
38
+
39
+ if (default_lang == current_lang && site.config["default_locale_in_subfolder"])
40
+ files = Dir.glob(File.join("_site/" + current_lang + "/", "*"))
41
+ files.each do |file_path|
42
+ parts = file_path.split('/')
43
+ f_path = parts[2..-1].join('/')
44
+ if (f_path == 'base.html')
45
+ new_path = parts[0] + "/index.html"
46
+ puts "Moving '" + file_path + "' to '" + new_path + "'"
47
+ File.rename file_path, new_path
48
+ else
49
+ exclude_paths.each do |exclude_path|
50
+ if (exclude_path == f_path)
51
+ new_path = parts[0] + "/" + f_path
52
+ puts "Moving '" + file_path + "' to '" + new_path + "'"
53
+ if (Dir.exists?(new_path))
54
+ FileUtils.rm_r new_path
55
+ end
56
+ File.rename file_path, new_path
57
+ end
58
+ end
59
+ end
60
+ end
61
+ end
62
+
63
+ #===========================================================================
64
+
65
+ end
66
+
67
+ Jekyll::Hooks.register :site, :post_render do |site, payload|
68
+
69
+ # Removes all static files that should not be copied to translated sites.
70
+ #===========================================================================
71
+ default_lang = payload["site"]["default_lang"]
72
+ current_lang = payload["site"][ "lang"]
73
+
74
+ static_files = payload["site"]["static_files"]
75
+ exclude_paths = payload["site"]["exclude_from_localizations"]
76
+
77
+ default_locale_in_subfolder = site.config["default_locale_in_subfolder"]
78
+
79
+ if default_lang != current_lang
80
+ static_files.delete_if do |static_file|
81
+ next true if (static_file.name == 'base.html' && default_locale_in_subfolder)
82
+
83
+ # Remove "/" from beginning of static file relative path
84
+ if static_file.instance_variable_get(:@relative_path) != nil
85
+ static_file_r_path = static_file.instance_variable_get(:@relative_path).dup
86
+ if static_file_r_path
87
+ static_file_r_path[0] = ''
88
+
89
+ exclude_paths.any? do |exclude_path|
90
+ Pathname.new(static_file_r_path).descend do |static_file_path|
91
+ break(true) if (Pathname.new(exclude_path) <=> static_file_path) == 0
92
+ end
93
+ end
94
+ end
95
+ end
96
+ end
97
+ end
98
+
99
+ #===========================================================================
100
+
101
+ end
102
+
103
+
104
+
19
105
  ##############################################################################
20
106
  # class Site
21
107
  ##############################################################################
@@ -37,6 +123,8 @@ module Jekyll
37
123
  self.parsed_translations ||= {}
38
124
 
39
125
  self.config['exclude_from_localizations'] ||= []
126
+
127
+ self.config['default_locale_in_subfolder'] ||= false
40
128
 
41
129
  if ( !self.config['languages'] or
42
130
  self.config['languages'].empty? or
@@ -52,9 +140,8 @@ module Jekyll
52
140
  #-------------------------------------------------------------------------
53
141
 
54
142
  # Original Jekyll configurations
55
- baseurl_org = self.config[ 'baseurl' ] # Baseurl set on _config.yml
56
- exclude_org = self.exclude # List of excluded paths
57
- dest_org = self.dest # Destination folder where the website is generated
143
+ baseurl_org = self.config[ 'baseurl' ].to_s # Baseurl set on _config.yml
144
+ dest_org = self.dest # Destination folder where the website is generated
58
145
 
59
146
  # Site building only variables
60
147
  languages = self.config['languages'] # List of languages set on _config.yml
@@ -65,30 +152,20 @@ module Jekyll
65
152
  self.config['baseurl_root'] = baseurl_org # Baseurl of website root (without the appended language code)
66
153
  self.config['translations'] = self.parsed_translations # Hash that stores parsed translations read from YAML files. Exposes this hash to Liquid.
67
154
 
68
-
69
- # Build the website for default language
70
- #-------------------------------------------------------------------------
71
- puts "Building site for default language: \"#{self.config['lang']}\" to: #{self.dest}"
72
-
73
- process_org
74
-
75
-
76
- # Build the website for the other languages
155
+ # Build the website for all languages
77
156
  #-------------------------------------------------------------------------
78
157
 
79
158
  # Remove .htaccess file from included files, so it wont show up on translations folders.
80
159
  self.include -= [".htaccess"]
81
160
 
82
- languages.drop(1).each do |lang|
161
+ languages.each do |lang|
83
162
 
84
163
  # Language specific config/variables
85
- @dest = dest_org + "/" + lang
86
- self.config['baseurl'] = baseurl_org + "/" + lang
87
- self.config['lang'] = lang
88
-
89
- # exclude folders or files from being copied to all the language folders
90
- exclude_from_localizations = self.config['exclude_from_localizations']
91
- self.exclude = exclude_org + exclude_from_localizations
164
+ if lang != self.config['default_lang'] || self.config['default_locale_in_subfolder']
165
+ @dest = dest_org + "/" + lang
166
+ self.config['baseurl'] = baseurl_org + "/" + lang
167
+ self.config['lang'] = lang
168
+ end
92
169
 
93
170
  puts "Building site for language: \"#{self.config['lang']}\" to: #{self.dest}"
94
171
 
@@ -97,7 +174,6 @@ module Jekyll
97
174
 
98
175
  # Revert to initial Jekyll configurations (necessary for regeneration)
99
176
  self.config[ 'baseurl' ] = baseurl_org # Baseurl set on _config.yml
100
- self.exclude = exclude_org # List of excluded paths
101
177
  @dest = dest_org # Destination folder where the website is generated
102
178
 
103
179
  puts 'Build complete'
@@ -151,11 +227,14 @@ module Jekyll
151
227
 
152
228
 
153
229
 
154
- ##############################################################################
155
- # class Page
156
- ##############################################################################
157
- class Page
158
-
230
+ #-----------------------------------------------------------------------------
231
+ #
232
+ # Include (with priority—prepend)the translated
233
+ # permanent link for Page and document
234
+ #
235
+ #-----------------------------------------------------------------------------
236
+
237
+ module Permalink
159
238
  #======================================
160
239
  # permalink
161
240
  #======================================
@@ -172,6 +251,8 @@ module Jekyll
172
251
  end
173
252
  end
174
253
 
254
+ Page.prepend(Permalink)
255
+ Document.prepend(Permalink)
175
256
 
176
257
 
177
258
  ##############################################################################
@@ -270,22 +351,21 @@ module Jekyll
270
351
  key = @key
271
352
  end
272
353
 
354
+ key = Liquid::Template.parse(key).render(context) # Parses and renders some Liquid syntax on arguments (allows expansions)
355
+
273
356
  site = context.registers[:site] # Jekyll site object
274
357
 
275
358
  lang = site.config['lang']
276
359
 
277
- unless site.parsed_translations.has_key?(lang)
278
- puts "Loading translation from file #{site.source}/_i18n/#{lang}.yml"
279
- site.parsed_translations[lang] = YAML.load_file("#{site.source}/_i18n/#{lang}.yml")
280
- end
281
-
282
360
  translation = site.parsed_translations[lang].access(key) if key.is_a?(String)
283
361
 
284
362
  if translation.nil? or translation.empty?
285
363
  translation = site.parsed_translations[site.config['default_lang']].access(key)
286
364
 
287
- puts "Missing i18n key: #{lang}:#{key}"
288
- puts "Using translation '%s' from default language: %s" %[translation, site.config['default_lang']]
365
+ if site.config["verbose"]
366
+ puts "Missing i18n key: #{lang}:#{key}"
367
+ puts "Using translation '%s' from default language: %s" %[translation, site.config['default_lang']]
368
+ end
289
369
  end
290
370
 
291
371
  translation
@@ -313,11 +393,28 @@ module Jekyll
313
393
  file = @file
314
394
  end
315
395
 
316
- site = context.registers[:site] # Jekyll site object
396
+ file = Liquid::Template.parse(file).render(context) # Parses and renders some Liquid syntax on arguments (allows expansions)
317
397
 
318
- includes_dir = File.join(site.source, '_i18n/' + site.config['lang'])
398
+ site = context.registers[:site] # Jekyll site object
319
399
 
400
+ default_lang = site.config['default_lang']
401
+
320
402
  validate_file_name(file)
403
+
404
+ includes_dir = File.join(site.source, '_i18n/' + site.config['lang'])
405
+
406
+ # If directory doesn't exist, go to default lang
407
+ if !Dir.exist?(includes_dir)
408
+ includes_dir = File.join(site.source, '_i18n/' + default_lang)
409
+ elsif
410
+ # If file doesn't exist, go to default lang
411
+ Dir.chdir(includes_dir) do
412
+ choices = Dir['**/*'].reject { |x| File.symlink?(x) }
413
+ if !choices.include?( file)
414
+ includes_dir = File.join(site.source, '_i18n/' + default_lang)
415
+ end
416
+ end
417
+ end
321
418
 
322
419
  Dir.chdir(includes_dir) do
323
420
  choices = Dir['**/*'].reject { |x| File.symlink?(x) }
@@ -343,6 +440,25 @@ module Jekyll
343
440
  end
344
441
  end
345
442
  end
443
+
444
+ # Override of core Jekyll functionality, to get rid of deprecation
445
+ # warning. See https://github.com/jekyll/jekyll/pull/7117 for more
446
+ # details.
447
+ class PostComparer
448
+ def initialize(name)
449
+ @name = name
450
+
451
+ all, @path, @date, @slug = *name.sub(%r!^/!, "").match(MATCHER)
452
+ unless all
453
+ raise Jekyll::Errors::InvalidPostNameError,
454
+ "'#{name}' does not contain valid date and/or title."
455
+ end
456
+
457
+ escaped_slug = Regexp.escape(slug)
458
+ @name_regex = %r!_posts/#{path}#{date}-#{escaped_slug}\.[^.]+|
459
+ ^#{path}_posts/?#{date}-#{escaped_slug}\.[^.]+!x
460
+ end
461
+ end
346
462
  end
347
463
 
348
464
 
@@ -375,6 +491,8 @@ module Jekyll
375
491
  key = @key
376
492
  end
377
493
 
494
+ key = Liquid::Template.parse(key).render(context) # Parses and renders some Liquid syntax on arguments (allows expansions)
495
+
378
496
  site = context.registers[:site] # Jekyll site object
379
497
 
380
498
  key = key.split
@@ -385,10 +503,13 @@ module Jekyll
385
503
  pages = site.pages
386
504
  url = "";
387
505
 
388
- if default_lang != lang
506
+ if default_lang != lang || site.config['default_locale_in_subfolder']
389
507
  baseurl = baseurl + "/" + lang
390
508
  end
391
509
 
510
+ collections = site.collections.values.collect{|x| x.docs}.flatten
511
+ pages = site.pages + collections
512
+
392
513
  for p in pages
393
514
  unless p['namespace'].nil?
394
515
  page_namespace = p['namespace']
@@ -448,4 +569,3 @@ Liquid::Template.register_tag('tf', Jekyll::Tags::LocalizeInclude)
448
569
  Liquid::Template.register_tag('translate_file', Jekyll::Tags::LocalizeInclude)
449
570
  Liquid::Template.register_tag('tl', Jekyll::LocalizeLink )
450
571
  Liquid::Template.register_tag('translate_link', Jekyll::LocalizeLink )
451
-
@@ -1,6 +1,6 @@
1
1
  module Jekyll
2
2
  module MultipleLanguagesPlugin
3
- VERSION = "1.4.2"
3
+ VERSION = "1.7.0"
4
4
  end
5
5
  end
6
6
 
metadata CHANGED
@@ -1,14 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-multiple-languages-plugin
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.2
4
+ version: 1.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Martin Kurtsson
8
+ - Yonatan Miller
8
9
  autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
- date: 2016-06-26 00:00:00.000000000 Z
12
+ date: 2020-06-18 00:00:00.000000000 Z
12
13
  dependencies:
13
14
  - !ruby/object:Gem::Dependency
14
15
  name: bundler
@@ -16,28 +17,42 @@ dependencies:
16
17
  requirements:
17
18
  - - "~>"
18
19
  - !ruby/object:Gem::Version
19
- version: '1.3'
20
+ version: 2.0.1
20
21
  type: :development
21
22
  prerelease: false
22
23
  version_requirements: !ruby/object:Gem::Requirement
23
24
  requirements:
24
25
  - - "~>"
25
26
  - !ruby/object:Gem::Version
26
- version: '1.3'
27
+ version: 2.0.1
27
28
  - !ruby/object:Gem::Dependency
28
- name: rake
29
+ name: html-proofer
29
30
  requirement: !ruby/object:Gem::Requirement
30
31
  requirements:
31
- - - "~>"
32
+ - - ">="
32
33
  - !ruby/object:Gem::Version
33
34
  version: '0'
34
35
  type: :development
35
36
  prerelease: false
36
37
  version_requirements: !ruby/object:Gem::Requirement
37
38
  requirements:
38
- - - "~>"
39
+ - - ">="
39
40
  - !ruby/object:Gem::Version
40
41
  version: '0'
42
+ - !ruby/object:Gem::Dependency
43
+ name: rake
44
+ requirement: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - ">="
47
+ - !ruby/object:Gem::Version
48
+ version: 12.3.3
49
+ type: :development
50
+ prerelease: false
51
+ version_requirements: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ version: 12.3.3
41
56
  - !ruby/object:Gem::Dependency
42
57
  name: jekyll
43
58
  requirement: !ruby/object:Gem::Requirement
@@ -47,7 +62,7 @@ dependencies:
47
62
  version: '2.0'
48
63
  - - "<"
49
64
  - !ruby/object:Gem::Version
50
- version: '4.0'
65
+ version: '5.0'
51
66
  type: :runtime
52
67
  prerelease: false
53
68
  version_requirements: !ruby/object:Gem::Requirement
@@ -57,12 +72,12 @@ dependencies:
57
72
  version: '2.0'
58
73
  - - "<"
59
74
  - !ruby/object:Gem::Version
60
- version: '4.0'
75
+ version: '5.0'
61
76
  description: Plugin for Jekyll 2.x and 3.x that adds support for translated keys,
62
77
  templates and posts.
63
78
  email:
64
- - martin.kurtsson@screeninteraction.com
65
- - anthonygaudino45@gmail.com
79
+ - martin.kurtsson@daresay.co
80
+ - yonatan@shushugah.com
66
81
  executables: []
67
82
  extensions: []
68
83
  extra_rdoc_files:
@@ -73,9 +88,9 @@ files:
73
88
  - README.md
74
89
  - lib/jekyll-multiple-languages-plugin.rb
75
90
  - lib/plugin/version.rb
76
- homepage: https://github.com/screeninteraction/jekyll-multiple-languages-plugin/
91
+ homepage: https://github.com/kurtsson/jekyll-multiple-languages-plugin/
77
92
  licenses:
78
- - MPL2
93
+ - MIT
79
94
  metadata: {}
80
95
  post_install_message:
81
96
  rdoc_options:
@@ -93,8 +108,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
93
108
  - !ruby/object:Gem::Version
94
109
  version: '0'
95
110
  requirements: []
96
- rubyforge_project:
97
- rubygems_version: 2.2.2
111
+ rubygems_version: 3.0.3
98
112
  signing_key:
99
113
  specification_version: 4
100
114
  summary: I18n plugin for Jekyll