jekyll-polyglot 1.4.1 → 1.5.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
2
  SHA256:
3
- metadata.gz: 44004d45f57d6cd3d029fb2dd11aa4636a003648e88cbb8c0af96707379143ea
4
- data.tar.gz: 944467976c70ec60171b5c8e9717d13ac844be691ab315d7937aa827eb9d42de
3
+ metadata.gz: b1df66cac375456100227a3f62c2771280b12b20523650adf5aed2b0f71537a3
4
+ data.tar.gz: dd7c651028a836017807fdeda58600e576132b950c9b4dca17dcbeb4ab7d2af3
5
5
  SHA512:
6
- metadata.gz: 381ec1f760288a9945c0a353b3b1cdc5ba7bcbc14a6f6b261e23d28ae6007b25770814d2b14deb8daec986271211f9b822429135449de3974b6c71041807c344
7
- data.tar.gz: 8a39f63b3b72670d561299308940a76f24008d73ca84411272776767beee24c2d8a1b5dce02f99d5a490635ec8ddfaa11b0ce390a203073cc283bf13c73e378a
6
+ metadata.gz: 12562b7c0f8ab337c4195d1b664a8cfc1e93e2f53d2571dacfffc67d58958f2c262bbc74ec9aa8dc63f670f10b2381e8b1ddec07b0fe1edb88d9d532f6c4c916
7
+ data.tar.gz: 0c5152c2d45eead027c8a0cef88b8482f87841def83d56924d6118cb7bc157a3b6bea14a5a32f18273688a18e6cc5bf54de3b5dd078ae551c8dc6478f5dcfd41
data/README.md CHANGED
@@ -1,7 +1,7 @@
1
- :abc: Polyglot
1
+ 🔤 Polyglot
2
2
  ---
3
3
  [![Gem Version](https://badge.fury.io/rb/jekyll-polyglot.svg)](https://badge.fury.io/rb/jekyll-polyglot)
4
- [![Build Status](https://travis-ci.org/untra/polyglot.svg?branch=master)](https://travis-ci.org/untra/polyglot)
4
+ [![CircleCI](https://circleci.com/gh/untra/polyglot/tree/master.svg?style=svg)](https://circleci.com/gh/untra/polyglot/?branch=master)
5
5
 
6
6
  __Polyglot__ is a fast, painless, open-source internationalization plugin for [Jekyll](http://jekyllrb.com) blogs. Polyglot is easy to setup and use with any Jekyll project, and it scales to the languages you want to support. With fallback support for missing content, automatic url relativization, and powerful SEO tools, Polyglot allows any multi-language jekyll blog to focus on content without the cruft.
7
7
 
@@ -34,7 +34,7 @@ These configuration preferences indicate
34
34
  - what i18n languages you wish to support
35
35
  - what is your default "fallback" language for your content
36
36
  - what root level files/folders are excluded from localization, based
37
- on if their paths start with any of the excluded regexp substrings. (this is different than the jekyll `exclude: [README.md, CNAME]` ; you should `exclude` files and directories in your repo you dont want in your built site at all, and `exclude_from_localization` files and directories in your built site, but not in your sublanguage sites.)
37
+ on if their paths start with any of the excluded regexp substrings. (this is different than the jekyll `exclude: [ .gitignore ]` ; you should `exclude` files and directories in your repo you dont want in your built site at all, and `exclude_from_localization` files and directories you want to see in your built site, but not in your sublanguage sites.)
38
38
  - whether to run language processing in parallel or serial
39
39
 
40
40
  The optional `lang_from_path: true` option enables getting page
@@ -120,24 +120,7 @@ If you dont want a href attribute to be relativized (such as for making [a langu
120
120
 
121
121
  that will generate `<a href="/about">click this static link</a>` which is what you would normally use to create a url unmangled by invisible language relativization.
122
122
 
123
- _Previous (no longer) Recommendation:_
124
- If you don't want aa url to be relativized, you can add a space explicitly into the href to prevent a url from being relativized by polyglot.
125
-
126
- For example, the following urls will be relativized:
127
-
128
- ```html
129
- href="http://mywebsite.com/about"
130
- href="/about"
131
- ```
132
-
133
- and the following urls will be left alone:
134
-
135
- ```html
136
- href=" http://mywebsite.com/about"
137
- href=" /about"
138
- ```
139
-
140
- combine with a [html minifier](https://github.com/digitalsparky/jekyll-minifier) for a polished and production ready website. -->
123
+ Combine with a [html minifier](https://github.com/digitalsparky/jekyll-minifier) for a polished and production ready website.
141
124
 
142
125
  #### Exclusive site language generation
143
126
  _New in 1.4.0_
@@ -152,6 +135,11 @@ lang-exclusive: ['en', 'fr']
152
135
  ---
153
136
  ```
154
137
 
138
+ #### Machine-aware site building
139
+ _New in 1.5.0_
140
+
141
+ Polyglot will only start builds after it confirms there is a cpu core ready to accept the build thread. This ensures that jekll will build large sites efficiently streamlining build processes instead of overloading machines with process thrash.
142
+
155
143
  #### Localized site.data
156
144
 
157
145
  There are cases when `site.data` localization is required.
@@ -159,7 +147,7 @@ For instance: you might need to localize `_data/navigation.yml` that holds "navi
159
147
  In order to localize it, just place language-specific files in `_data/:lang/...` folder, and Polyglot will bring those keys to the top level.
160
148
 
161
149
  ## How It Works
162
- This plugin makes modifications to existing Jekyll classes and modules, namely `Jekyll::StaticFile` and `Jekyll::Site`. These changes are as lightweight and slim as possible. The biggest change is in `Jekyll::Site.process`. Polyglot overwrites this method to instead spawn a separate thread for each language you intend to process the site for. Each of those threads calls the original `Jekyll::Site.process` method with its language in mind, ensuring your website scales to support any number of languages, while building all of your site languages simultaneously.
150
+ This plugin makes modifications to existing Jekyll classes and modules, namely `Jekyll::StaticFile` and `Jekyll::Site`. These changes are as lightweight and slim as possible. The biggest change is in `Jekyll::Site.process`. Polyglot overwrites this method to instead spawn a separate process for each language you intend to process the site for. Each of those processes calls the original `Jekyll::Site.process` method with its language in mind, ensuring your website scales to support any number of languages, while building all of your site languages simultaneously.
163
151
 
164
152
  `Jekyll::Site.process` is the entry point for the Jekyll build process. Take care whatever other plugins you use do not also attempt to overwrite this method. You may have problems.
165
153
 
@@ -179,7 +167,8 @@ This plugin stands out from other I18n Jekyll plugins.
179
167
  Jekyll-polyglot has a few spectacular [Search Engine Optimization techniques](https://untra.github.io/polyglot/seo) to ensure your Jekyll blog gets the most out of it's multilingual audience. Check them out!
180
168
 
181
169
  ### Other Websites Built with Polyglot
182
- let us know if you make a multilingual blog you want to share:
170
+ Feel free to open a PR and list your multilingual blog here you may want to share:
171
+
183
172
  * [Polyglot project website](https://polyglot.untra.io)
184
173
  * [LogRhythm Corporate Website](https://logrhythm.com)
185
174
  * [All Over Earth](https://allover.earth/)
@@ -204,7 +193,7 @@ But for real I would appreciate any contributions and support. This started as a
204
193
  If you have something you'd like to contribute to jekyll-polyglot, please open a PR!
205
194
 
206
195
 
207
- ## Roadmap
196
+ ## 2.0 Roadmap
208
197
  * [ ] - **site language**: portuguese `pt_BR` `pt_PT`
209
198
  * [ ] - **site language**: arabic `ar`
210
199
  * [ ] - **site language**: japanese `ja`
@@ -212,6 +201,7 @@ If you have something you'd like to contribute to jekyll-polyglot, please open a
212
201
  * [ ] - **site language**: korean `ko`
213
202
  * [ ] - **site language**: hebrew `he`
214
203
  * [ ] - get whitelisted as an official github-pages jekyll plugin
204
+ * [x] - update CI provider
215
205
 
216
206
  ## Copyright
217
207
  Copyright (c) Samuel Volin 2021. License: MIT
@@ -1,3 +1,5 @@
1
+ require 'etc'
2
+
1
3
  include Process
2
4
  module Jekyll
3
5
  class Site
@@ -31,22 +33,27 @@ module Jekyll
31
33
  prepare
32
34
  all_langs = (@languages + [@default_lang]).uniq
33
35
  if @parallel_localization
36
+ nproc = Etc.nprocessors
34
37
  pids = {}
35
- all_langs.each do |lang|
36
- pids[lang] = fork do
37
- process_language lang
38
+ begin
39
+ all_langs.each do |lang|
40
+ pids[lang] = fork do
41
+ process_language lang
42
+ end
43
+ while pids.length >= (lang == all_langs[-1] ? 1 : nproc)
44
+ sleep 0.1
45
+ pids.map do |lang, pid|
46
+ pids.delete lang if waitpid pid, Process::WNOHANG
47
+ end
48
+ end
38
49
  end
39
- end
40
- Signal.trap('INT') do
50
+ rescue Interrupt
41
51
  all_langs.each do |lang|
52
+ next unless pids.key? lang
42
53
  puts "Killing #{pids[lang]} : #{lang}"
43
54
  kill('INT', pids[lang])
44
55
  end
45
56
  end
46
- all_langs.each do |lang|
47
- waitpid pids[lang]
48
- detach pids[lang]
49
- end
50
57
  else
51
58
  all_langs.each do |lang|
52
59
  process_language lang
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-polyglot
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.1
4
+ version: 1.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Volin
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-04-18 00:00:00.000000000 Z
11
+ date: 2021-07-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll