jekyll-localization 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README +1 -1
- data/lib/jekyll/localization.rb +14 -4
- data/lib/jekyll/localization/version.rb +1 -1
- metadata +5 -5
data/README
CHANGED
data/lib/jekyll/localization.rb
CHANGED
@@ -211,11 +211,15 @@ module Jekyll
|
|
211
211
|
Localization::LANGUAGES - [lang]
|
212
212
|
end
|
213
213
|
|
214
|
-
def human_lang(lang)
|
215
|
-
|
214
|
+
def human_lang(lang = lang)
|
215
|
+
translate(*Localization::HUMAN_LANGUAGES[lang]) || lang.capitalize
|
216
216
|
end
|
217
217
|
|
218
|
-
def
|
218
|
+
def native_lang(lang = lang)
|
219
|
+
translate_lang(lang, *Localization::HUMAN_LANGUAGES[lang]) || lang.capitalize
|
220
|
+
end
|
221
|
+
|
222
|
+
def url_lang(url, lang = lang)
|
219
223
|
url = url.sub(Localization::LANG_END_RE, '')
|
220
224
|
url << '.' << lang if lang
|
221
225
|
url
|
@@ -233,13 +237,19 @@ module Jekyll
|
|
233
237
|
# language's position in the Localization::LANGUAGES array. If that
|
234
238
|
# particular argument is missing, +default+ is returned.
|
235
239
|
def translate(*translations)
|
240
|
+
translate_lang(lang, *translations)
|
241
|
+
end
|
242
|
+
|
243
|
+
alias_method :t, :translate
|
244
|
+
|
245
|
+
def translate_lang(lang, *translations)
|
236
246
|
translations.flatten!
|
237
247
|
|
238
248
|
index = Localization::LANGUAGES.index(lang)
|
239
249
|
index && translations[index] || translations.first
|
240
250
|
end
|
241
251
|
|
242
|
-
alias_method :
|
252
|
+
alias_method :tl, :translate_lang
|
243
253
|
|
244
254
|
end
|
245
255
|
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jekyll-localization
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 31
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 2
|
10
|
+
version: 0.1.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Jens Wille
|
@@ -16,7 +16,7 @@ autorequire:
|
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
18
|
|
19
|
-
date: 2011-04-
|
19
|
+
date: 2011-04-19 00:00:00 Z
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
22
22
|
name: jekyll-rendering
|
@@ -59,7 +59,7 @@ rdoc_options:
|
|
59
59
|
- --charset
|
60
60
|
- UTF-8
|
61
61
|
- --title
|
62
|
-
- jekyll-localization Application documentation (v0.1.
|
62
|
+
- jekyll-localization Application documentation (v0.1.2)
|
63
63
|
- --main
|
64
64
|
- README
|
65
65
|
- --line-numbers
|