jekyll-multiple-languages-plugin 1.5.1 → 1.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/LICENSE.txt +5 -349
- data/README.md +16 -4
- data/lib/jekyll-multiple-languages-plugin.rb +36 -15
- data/lib/plugin/version.rb +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 5337525acdd06c39f7aef0e2971726c90595c5f90b115bd6dbe8279b858fa7cc
|
4
|
+
data.tar.gz: 4b1d6e3da5227b33aac65ed9237a9ff09e7db7f9b5e4a265e360f748bcc27005
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a1fafbdc735306738f7769c4e87c8a7c5e2c18012dd2f62bc035cc70cd59c26be7b09385c7c2f958dd99ffbb9496edd80c907d4a024b6fe0c304f6f601e9f5e2
|
7
|
+
data.tar.gz: 87045f0fb9883d8c0e911c8b5fb7d53dea748cc84ee087e3ee1c6d92591f30fd8430da2fd4e44b17a5febfd41ad0913011cd7637c67f533e870b3f033cee45e8
|
data/LICENSE.txt
CHANGED
@@ -1,353 +1,9 @@
|
|
1
|
-
|
2
|
-
==================================
|
1
|
+
MIT License
|
3
2
|
|
4
|
-
|
5
|
-
--------------
|
3
|
+
Copyright (c) 2014 Martin Kurtsson
|
6
4
|
|
7
|
-
|
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
|
-
|
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
|
-
|
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,7 +4,7 @@
|
|
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 [
|
7
|
+
The plugin was developed as a utility at [Daresay](https://daresay.co)
|
8
8
|
|
9
9
|
### Gem [![Gem Version](https://badge.fury.io/rb/jekyll-multiple-languages-plugin.png)](http://badge.fury.io/rb/jekyll-multiple-languages-plugin)
|
10
10
|
|
@@ -28,6 +28,7 @@ Table of Contents
|
|
28
28
|
* [5\.4\. i18n in templates](#54-i18n-in-templates)
|
29
29
|
* [5\.5\. Link between languages](#55-link-between-languages)
|
30
30
|
* [5\.6\. Creating pages](#56-creating-pages)
|
31
|
+
* [5\.7\. Create posts](#57-creating-posts)
|
31
32
|
* [7\. Example website](#7-example-website)
|
32
33
|
* [7\.1\. Adding a new language](#71-adding-a-new-language)
|
33
34
|
* [7\.2\. Adding new page](#72-adding-new-page)
|
@@ -85,7 +86,7 @@ Or install it yourself as: `$ gem install jekyll-multiple-languages-plugin`
|
|
85
86
|
To activate the plugin add it to the Jekyll `_config.yml` file, under the `gems` option:
|
86
87
|
|
87
88
|
```ruby
|
88
|
-
gems:
|
89
|
+
gems:
|
89
90
|
- jekyll-multiple-languages-plugin
|
90
91
|
```
|
91
92
|
See the [Jekyll configuration documentation](http://jekyllrb.com/docs/configuration) for details.
|
@@ -272,7 +273,7 @@ titles:
|
|
272
273
|
This plugin gives you the variables
|
273
274
|
|
274
275
|
```liquid
|
275
|
-
{{
|
276
|
+
{{ site.lang }}
|
276
277
|
|
277
278
|
and
|
278
279
|
|
@@ -286,7 +287,7 @@ This allows you to create solutions like this:
|
|
286
287
|
|
287
288
|
``` liquid
|
288
289
|
{% if site.lang == "sv" %}
|
289
|
-
{% capture link1 %}{{ site.baseurl_root }}en{{ page.url}}{% endcapture %}
|
290
|
+
{% capture link1 %}{{ site.baseurl_root }}/en{{ page.url}}{% endcapture %}
|
290
291
|
<a href="{{ link1 }}" >{% t global.english %}</a>
|
291
292
|
{% elsif site.lang == "en" %}
|
292
293
|
{% capture link2 %}{{ site.baseurl_root }}{{ page.url }}{% endcapture %}
|
@@ -322,6 +323,11 @@ Inside each of the language folders, you should create mirror pages to provide t
|
|
322
323
|
|
323
324
|
|
324
325
|
|
326
|
+
### 5.7. Creating posts
|
327
|
+
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.
|
328
|
+
|
329
|
+
|
330
|
+
|
325
331
|
## 7. Example website
|
326
332
|
|
327
333
|
This repository has an example website where you can test the plugin.
|
@@ -357,6 +363,12 @@ Then, create a file named `about.md` under `_i18n/en` with the English content.
|
|
357
363
|
|
358
364
|
|
359
365
|
## 8. Changelog
|
366
|
+
* 1.6.0
|
367
|
+
* fix: check if static_file_r_path is set
|
368
|
+
* Missing slash before lang prefix in lang picker example
|
369
|
+
* Updated README.md with _posts directory
|
370
|
+
* Build translations in pre_render hook
|
371
|
+
* If include not found, fall back to default language
|
360
372
|
* 1.5.1
|
361
373
|
* Fix a bug (#70) where `site.static_files` would be empty on subsites if `exclude_from_localizations` is used.
|
362
374
|
* Some overall project enhancements and minor fixes.
|
@@ -19,6 +19,13 @@ module Jekyll
|
|
19
19
|
#*****************************************************************************
|
20
20
|
# :site, :post_render hook
|
21
21
|
#*****************************************************************************
|
22
|
+
Jekyll::Hooks.register :site, :pre_render do |site, payload|
|
23
|
+
lang = site.config['lang']
|
24
|
+
unless site.parsed_translations.has_key?(lang)
|
25
|
+
puts "Loading translation from file #{site.source}/_i18n/#{lang}.yml"
|
26
|
+
site.parsed_translations[lang] = YAML.load_file("#{site.source}/_i18n/#{lang}.yml")
|
27
|
+
end
|
28
|
+
end
|
22
29
|
Jekyll::Hooks.register :site, :post_render do |site, payload|
|
23
30
|
|
24
31
|
# Removes all static files that should not be copied to translated sites.
|
@@ -34,12 +41,16 @@ module Jekyll
|
|
34
41
|
static_files.delete_if do |static_file|
|
35
42
|
|
36
43
|
# Remove "/" from beginning of static file relative path
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
44
|
+
if static_file.instance_variable_get(:@relative_path) != nil
|
45
|
+
static_file_r_path = static_file.instance_variable_get(:@relative_path).dup
|
46
|
+
if static_file_r_path
|
47
|
+
static_file_r_path[0] = ''
|
48
|
+
|
49
|
+
exclude_paths.any? do |exclude_path|
|
50
|
+
Pathname.new(static_file_r_path).descend do |static_file_path|
|
51
|
+
break(true) if (Pathname.new(exclude_path) <=> static_file_path) == 0
|
52
|
+
end
|
53
|
+
end
|
43
54
|
end
|
44
55
|
end
|
45
56
|
end
|
@@ -87,8 +98,8 @@ module Jekyll
|
|
87
98
|
#-------------------------------------------------------------------------
|
88
99
|
|
89
100
|
# Original Jekyll configurations
|
90
|
-
baseurl_org = self.config[ 'baseurl' ] # Baseurl set on _config.yml
|
91
|
-
dest_org = self.dest
|
101
|
+
baseurl_org = self.config[ 'baseurl' ].to_s # Baseurl set on _config.yml
|
102
|
+
dest_org = self.dest # Destination folder where the website is generated
|
92
103
|
|
93
104
|
# Site building only variables
|
94
105
|
languages = self.config['languages'] # List of languages set on _config.yml
|
@@ -305,11 +316,6 @@ module Jekyll
|
|
305
316
|
|
306
317
|
lang = site.config['lang']
|
307
318
|
|
308
|
-
unless site.parsed_translations.has_key?(lang)
|
309
|
-
puts "Loading translation from file #{site.source}/_i18n/#{lang}.yml"
|
310
|
-
site.parsed_translations[lang] = YAML.load_file("#{site.source}/_i18n/#{lang}.yml")
|
311
|
-
end
|
312
|
-
|
313
319
|
translation = site.parsed_translations[lang].access(key) if key.is_a?(String)
|
314
320
|
|
315
321
|
if translation.nil? or translation.empty?
|
@@ -348,9 +354,24 @@ module Jekyll
|
|
348
354
|
|
349
355
|
site = context.registers[:site] # Jekyll site object
|
350
356
|
|
351
|
-
|
352
|
-
|
357
|
+
default_lang = site.config['default_lang']
|
358
|
+
|
353
359
|
validate_file_name(file)
|
360
|
+
|
361
|
+
includes_dir = File.join(site.source, '_i18n/' + site.config['lang'])
|
362
|
+
|
363
|
+
# If directory doesn't exist, go to default lang
|
364
|
+
if !Dir.exist?(includes_dir)
|
365
|
+
includes_dir = File.join(site.source, '_i18n/' + default_lang)
|
366
|
+
elsif
|
367
|
+
# If file doesn't exist, go to default lang
|
368
|
+
Dir.chdir(includes_dir) do
|
369
|
+
choices = Dir['**/*'].reject { |x| File.symlink?(x) }
|
370
|
+
if !choices.include?( file)
|
371
|
+
includes_dir = File.join(site.source, '_i18n/' + default_lang)
|
372
|
+
end
|
373
|
+
end
|
374
|
+
end
|
354
375
|
|
355
376
|
Dir.chdir(includes_dir) do
|
356
377
|
choices = Dir['**/*'].reject { |x| File.symlink?(x) }
|
data/lib/plugin/version.rb
CHANGED
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
|
+
version: 1.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Martin Kurtsson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-12-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -61,7 +61,7 @@ dependencies:
|
|
61
61
|
description: Plugin for Jekyll 2.x and 3.x that adds support for translated keys,
|
62
62
|
templates and posts.
|
63
63
|
email:
|
64
|
-
- martin.kurtsson@
|
64
|
+
- martin.kurtsson@daresay.co
|
65
65
|
- anthonygaudino45@gmail.com
|
66
66
|
executables: []
|
67
67
|
extensions: []
|
@@ -73,9 +73,9 @@ files:
|
|
73
73
|
- README.md
|
74
74
|
- lib/jekyll-multiple-languages-plugin.rb
|
75
75
|
- lib/plugin/version.rb
|
76
|
-
homepage: https://github.com/
|
76
|
+
homepage: https://github.com/Anthony-Gaudino/jekyll-multiple-languages-plugin/
|
77
77
|
licenses:
|
78
|
-
-
|
78
|
+
- MIT
|
79
79
|
metadata: {}
|
80
80
|
post_install_message:
|
81
81
|
rdoc_options:
|
@@ -94,7 +94,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
94
94
|
version: '0'
|
95
95
|
requirements: []
|
96
96
|
rubyforge_project:
|
97
|
-
rubygems_version: 2.
|
97
|
+
rubygems_version: 2.7.6
|
98
98
|
signing_key:
|
99
99
|
specification_version: 4
|
100
100
|
summary: I18n plugin for Jekyll
|