i18n-coffee 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +18 -5
- data/i18n-coffee.gemspec +6 -6
- data/lib/i18n/coffee/version.rb +1 -1
- metadata +7 -48
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 47f4551d7b826df083396e53903881ff6cf72b51
|
4
|
+
data.tar.gz: 7b52c65b4071918bf6d379a9f4f8efeac2cbcbc4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3e0899da01e5dba2bf7e69a5a914eb63ba3fafad39608447cdf638b0a62d38c79bbe7bbdb3aff82b9e8375341e285559331a7fbc0b42518f211412c8daad5dde
|
7
|
+
data.tar.gz: 72abbd2570529e1860a4e24d86eec3ca2587dcb3f94866adc3a12cfa52f68aa237d6c51cc11651044c6403c2105a401c7fd336223b281227e0c465fe8d58d0b2
|
data/README.md
CHANGED
@@ -7,14 +7,12 @@ Client Side Localisation for Rails
|
|
7
7
|
|
8
8
|
In your Gemfile add
|
9
9
|
|
10
|
-
gem 'i18n-coffee', '~> 0.1.
|
10
|
+
gem 'i18n-coffee', '~> 0.1.2'
|
11
11
|
|
12
12
|
##Setup locale translations
|
13
13
|
|
14
14
|
By default, it looks for `javascripts` node in your {locale}.yml.
|
15
15
|
|
16
|
-
**For example**
|
17
|
-
|
18
16
|
# config/locales/en.yml
|
19
17
|
en:
|
20
18
|
javascripts:
|
@@ -28,13 +26,13 @@ In your `app/asssets/javascripts/application.js` file include i18n
|
|
28
26
|
//= require i18n
|
29
27
|
```
|
30
28
|
|
31
|
-
You can now try
|
29
|
+
You can now try use `window.translate` or `window.t` for translation lookup.
|
32
30
|
|
33
31
|
```javascript
|
34
32
|
window.t('javascripts.hello'); // "Hello"
|
35
33
|
```
|
36
34
|
|
37
|
-
|
35
|
+
Based on `I18n.locale` in Rails, it will load the corresponding translations from your locale files.
|
38
36
|
|
39
37
|
###Passing variables to translation
|
40
38
|
|
@@ -49,8 +47,23 @@ window.t('javascripts.greeting', { name: "Mann" });
|
|
49
47
|
javascripts:
|
50
48
|
greeting: "Hello %{name}!"
|
51
49
|
|
50
|
+
##Change javascript translations root
|
51
|
+
|
52
|
+
You can choose a different root node as the translations.
|
52
53
|
|
54
|
+
# config/locales/en.yml
|
55
|
+
en:
|
56
|
+
views:
|
57
|
+
home:
|
58
|
+
title: "Hello world!"
|
53
59
|
|
60
|
+
To select `views.home` as translation root:
|
54
61
|
|
62
|
+
# config/application.rb
|
63
|
+
config.i18n_translations_root = 'views.home'
|
55
64
|
|
65
|
+
The translation root setting = `views.home` in `config/application.rb` will become `views_home` in client-side lookup key.
|
56
66
|
|
67
|
+
```javascript
|
68
|
+
window.t('views_home.title'); // "Hello world!"
|
69
|
+
```
|
data/i18n-coffee.gemspec
CHANGED
@@ -5,17 +5,17 @@ require "i18n/coffee/version"
|
|
5
5
|
Gem::Specification.new do |s|
|
6
6
|
s.name = "i18n-coffee"
|
7
7
|
s.version = I18n::Coffee::Version.dup
|
8
|
+
s.licenses = ["MIT"]
|
9
|
+
s.summary = "Rails client-side i18n translation"
|
10
|
+
s.description = "A simple rails engine for client-side translation"
|
8
11
|
s.authors = ["Chanmann Lim"]
|
9
12
|
s.email = "chanmannlim@gmail.com"
|
10
13
|
s.homepage = "https://rubygems.org/gems/i18n-coffee"
|
11
|
-
s.summary = "Rails client-side i18n translation"
|
12
|
-
s.description = s.summary
|
13
14
|
|
14
15
|
s.files = `git ls-files`.split("\n")
|
15
16
|
s.require_paths = ["lib"]
|
16
17
|
|
17
|
-
s.
|
18
|
-
|
19
|
-
s.add_dependency "
|
20
|
-
s.add_dependency "jquery-rails"
|
18
|
+
s.platform = Gem::Platform::RUBY
|
19
|
+
|
20
|
+
s.add_dependency "rails", ">= 3.2"
|
21
21
|
end
|
data/lib/i18n/coffee/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: i18n-coffee
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chanmann Lim
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-05-
|
11
|
+
date: 2014-05-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -16,57 +16,15 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - '>='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '3.2'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - '>='
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
27
|
-
-
|
28
|
-
name: i18n
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - '>='
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '0'
|
34
|
-
type: :runtime
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - '>='
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: '0'
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: coffee-rails
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - '>='
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: '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'
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: jquery-rails
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - '>='
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '0'
|
62
|
-
type: :runtime
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - '>='
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: '0'
|
69
|
-
description: Rails client-side i18n translation
|
26
|
+
version: '3.2'
|
27
|
+
description: A simple rails engine for client-side translation
|
70
28
|
email: chanmannlim@gmail.com
|
71
29
|
executables: []
|
72
30
|
extensions: []
|
@@ -83,7 +41,8 @@ files:
|
|
83
41
|
- lib/i18n-coffee.rb
|
84
42
|
- lib/i18n/coffee/version.rb
|
85
43
|
homepage: https://rubygems.org/gems/i18n-coffee
|
86
|
-
licenses:
|
44
|
+
licenses:
|
45
|
+
- MIT
|
87
46
|
metadata: {}
|
88
47
|
post_install_message:
|
89
48
|
rdoc_options: []
|