sinatra-thymeleaf 0.0.8 → 0.0.9
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
- data/README.md +10 -0
- data/lib/sinatra/thymeleaf.rb +2 -0
- metadata +15 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f0425c5b14514c46363a6d53be8b1be216f31bd6
|
4
|
+
data.tar.gz: 9110507bc3a33c6d5b869dc0b2211febf4781945
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dfb903463ab76bafd48d66978c14dd8d139da4559698173c35b392cf26f285495959671de03a368298e449216f0d4f0fb2d232e40c1b20c6fc4f9546fa5daf11
|
7
|
+
data.tar.gz: 64528928be6a07866e887b96e228a4b2705893bff305759584b08726c54d2bf16525cd3b6d0df797267afb7be6a26ed24b1afda3c3bb333e2f3212afc8256513
|
data/README.md
CHANGED
@@ -44,3 +44,13 @@ The template variables can be passed by using the locals parameter, like this:
|
|
44
44
|
```
|
45
45
|
thyme :test, {:param => 'value'>}
|
46
46
|
```
|
47
|
+
|
48
|
+
#Localization support
|
49
|
+
You can use i18n localization in your templates, like this:
|
50
|
+
|
51
|
+
```
|
52
|
+
<span data-th-text="${t['new.message']}">Some text</span>
|
53
|
+
```
|
54
|
+
This works by using I18n.t directly so remember to configure i18n for your sinatra app
|
55
|
+
|
56
|
+
|
data/lib/sinatra/thymeleaf.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'sinatra/base'
|
2
2
|
require_relative 'tilt/thymeleaf'
|
3
|
+
require 'i18n'
|
3
4
|
|
4
5
|
module Sinatra
|
5
6
|
|
@@ -7,6 +8,7 @@ module Sinatra
|
|
7
8
|
def thyme(template=nil, locals={}, options = {}, &block)
|
8
9
|
options, template = template, nil if template.is_a?(Hash)
|
9
10
|
template = lambda { block } if template.nil?
|
11
|
+
locals[:t] = lambda { |m| I18n.t(m) }
|
10
12
|
render :html, template, options, locals
|
11
13
|
end
|
12
14
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sinatra-thymeleaf
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bogdan Costea
|
@@ -38,6 +38,20 @@ dependencies:
|
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '1.4'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: i18n
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 0.7.0
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 0.7.0
|
41
55
|
description: This is an adaptor gem allowing the use of the Thymeleaf.rb template
|
42
56
|
engine as a Tilt rendering engine for Sinatra
|
43
57
|
email: bogdan@costea.us
|