jekyll-locales 0.3.0rc1 → 0.3.0rc2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/README.md +14 -0
- data/lib/jekyll/locales/site.rb +16 -0
- data/lib/jekyll/locales/site_drop.rb +7 -1
- data/lib/jekyll/locales/version.rb +1 -1
- data.tar.gz.sig +0 -0
- metadata +2 -2
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4f070d48205919668af087050035f6b31f84ab19a98cc4d05ed76b64ca979631
|
4
|
+
data.tar.gz: be3496f7b5ed7d16e7054f3edc2f0272aec6579e8a2d363d736514e8694c80d7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bf6c153118dc7a27aa5f60c5ca5aa8a4391797118eeccca427a055fa964ea8077c8c14f0bf5f7ef09dedd62b787a0b6be4173eb09c9b78a610a13f881ec3e642
|
7
|
+
data.tar.gz: c853ad53b2621f71031b569a9ea6931c5fe326fa0b7602a51fc3a546d5fc3146532e3e447528f116a50cfcfcb7cc583a8031e6e1b67003d5efc3ec67023805ef
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/README.md
CHANGED
@@ -34,6 +34,7 @@ locales:
|
|
34
34
|
- ahr
|
35
35
|
- brasileiro
|
36
36
|
redirect: true
|
37
|
+
fallback_locale: true
|
37
38
|
```
|
38
39
|
|
39
40
|
**The first locale is going to be your default locale**. If you use
|
@@ -41,6 +42,19 @@ a redirector.html, it will be the locale it will redirector to. If you
|
|
41
42
|
don't use a redirector, the default locale will be at the root of the
|
42
43
|
site.
|
43
44
|
|
45
|
+
#### Fallback locales
|
46
|
+
|
47
|
+
If you don't want build errors or missing messages on your theme for
|
48
|
+
missing locales, you can setup fallbacks in any of these ways:
|
49
|
+
|
50
|
+
```yaml
|
51
|
+
fallback_locale: true # defaults to first locale
|
52
|
+
fallback_locale: en # defaults to first en
|
53
|
+
fallback_locale: # maps locales to existing options
|
54
|
+
fr: en
|
55
|
+
pt: es
|
56
|
+
```
|
57
|
+
|
44
58
|
## Posts
|
45
59
|
|
46
60
|
Put your posts into directories named after the locales, prefixed by an
|
data/lib/jekyll/locales/site.rb
CHANGED
@@ -75,6 +75,22 @@ module Jekyll
|
|
75
75
|
default_locale == locale
|
76
76
|
end
|
77
77
|
|
78
|
+
# There's always a fallback!
|
79
|
+
#
|
80
|
+
# @return [String]
|
81
|
+
def fallback_locale
|
82
|
+
@fallback_locale ||= {}
|
83
|
+
@fallback_locale[locale] ||=
|
84
|
+
case config['fallback_locale']
|
85
|
+
when TrueClass, FalseClass, NilClass then default_locale
|
86
|
+
when Hash then config['fallback_locale'][locale]
|
87
|
+
when String then config['fallback_locale']
|
88
|
+
else
|
89
|
+
Jekyll.logger.warn 'Locales:', "Configuration `fallback_locale` is #{config['fallback_locale'].class}, it should be boolean, Hash or String"
|
90
|
+
nil
|
91
|
+
end || default_locale
|
92
|
+
end
|
93
|
+
|
78
94
|
private
|
79
95
|
|
80
96
|
# Redefine #render_docs so it doesn't render the locale collections
|
@@ -7,7 +7,13 @@ module Jekyll
|
|
7
7
|
# Make i18n available to Liquid as site.i18n
|
8
8
|
class SiteDrop
|
9
9
|
def i18n
|
10
|
-
@i18n ||=
|
10
|
+
@i18n ||=
|
11
|
+
if @obj.data.key?(@obj.config['lang'])
|
12
|
+
@obj.data[@obj.config['lang']]
|
13
|
+
else
|
14
|
+
Jekyll.logger.warn 'Locales:', "Using #{@obj.fallback_locale} as fallback of #{@obj.config['lang']}"
|
15
|
+
@obj.data[@obj.fallback_locale]
|
16
|
+
end
|
11
17
|
end
|
12
18
|
end
|
13
19
|
end
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jekyll-locales
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.0rc2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- f
|
@@ -35,7 +35,7 @@ cert_chain:
|
|
35
35
|
cpurTQHNJfL/ah+9dYbgDXdG5HAAjRMAsWSvERw95YdN9XzQZCdUk5wUs+A6cNtO
|
36
36
|
AZZUMTVYNx8JqUeemxlXBRjsD/s=
|
37
37
|
-----END CERTIFICATE-----
|
38
|
-
date: 2025-
|
38
|
+
date: 2025-06-27 00:00:00.000000000 Z
|
39
39
|
dependencies:
|
40
40
|
- !ruby/object:Gem::Dependency
|
41
41
|
name: bundler
|
metadata.gz.sig
CHANGED
Binary file
|