i18n-js-pika 3.0.0.rc6 → 3.0.0.rc7
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/.gitignore +5 -1
- data/.travis.yml +10 -0
- data/README.md +7 -4
- data/Rakefile +4 -0
- data/app/assets/javascripts/i18n.js +39 -11
- data/i18n-js.gemspec +1 -1
- data/lib/i18n/js/version.rb +1 -1
- data/package.json +1 -1
- metadata +4 -4
- data/Gemfile.lock +0 -52
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bebb8d813e23d8ce58aa317620c27f9e2764cf71
|
4
|
+
data.tar.gz: 9a737f462dd976bbc7599d94c3c6aa9349244ae6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7b37f5722ba6e411ca52921a265f979444441448d9e0751eaf8cf0f1d5555c9ba6029351d2db9cf567bc48964e74fb06f7a880c158e9f715b76e7108f214bd9c
|
7
|
+
data.tar.gz: f39fb56b11a64ea6c8e7df203fcc6ac00bbd4dfefb94d7b796db7d8d5f2515db83f4215f3c0efb2ca54290af337d79e222e32b827bde1d21520adf6e15e232ae
|
data/.gitignore
CHANGED
data/.travis.yml
ADDED
data/README.md
CHANGED
@@ -11,6 +11,10 @@ Features:
|
|
11
11
|
- Asset pipeline support
|
12
12
|
- Lots more! :)
|
13
13
|
|
14
|
+
[](https://travis-ci.org/PikachuEXE/i18n-js)
|
15
|
+
[](http://badge.fury.io/rb/i18n-js-pika)
|
16
|
+
[](https://gemnasium.com/PikachuEXE/i18n-js)
|
17
|
+
|
14
18
|
## Usage
|
15
19
|
|
16
20
|
### Installation
|
@@ -18,10 +22,9 @@ Features:
|
|
18
22
|
#### Rails app
|
19
23
|
|
20
24
|
Add the gem to your Gemfile.
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
gem "i18n-js"
|
25
|
+
```ruby
|
26
|
+
gem "i18n-js-pika", require: "i18n-js"
|
27
|
+
```
|
25
28
|
|
26
29
|
If you're using the [asset pipeline](http://guides.rubyonrails.org/asset_pipeline.html),
|
27
30
|
then you must add the following line to your `app/assets/javascripts/application.js`.
|
data/Rakefile
CHANGED
@@ -60,28 +60,60 @@
|
|
60
60
|
// Set meridian.
|
61
61
|
var MERIDIAN = ["AM", "PM"];
|
62
62
|
|
63
|
+
// Other default options
|
64
|
+
var DEFAULT_OPTIONS = {
|
65
|
+
defaultLocale: "en",
|
66
|
+
locale: "en",
|
67
|
+
defaultSeparator: ".",
|
68
|
+
placeholder: /(?:\{\{|%\{)(.*?)(?:\}\}?)/gm,
|
69
|
+
fallbacks: false,
|
70
|
+
translations: {},
|
71
|
+
}
|
72
|
+
|
63
73
|
I18n.reset = function() {
|
64
74
|
// Set default locale. This locale will be used when fallback is enabled and
|
65
75
|
// the translation doesn't exist in a particular locale.
|
66
|
-
this.defaultLocale =
|
76
|
+
this.defaultLocale = DEFAULT_OPTIONS.defaultLocale;
|
67
77
|
|
68
78
|
// Set the current locale to `en`.
|
69
|
-
this.locale =
|
79
|
+
this.locale = DEFAULT_OPTIONS.locale;
|
70
80
|
|
71
81
|
// Set the translation key separator.
|
72
|
-
this.defaultSeparator =
|
82
|
+
this.defaultSeparator = DEFAULT_OPTIONS.defaultSeparator;
|
73
83
|
|
74
84
|
// Set the placeholder format. Accepts `{{placeholder}}` and `%{placeholder}`.
|
75
|
-
this.placeholder =
|
85
|
+
this.placeholder = DEFAULT_OPTIONS.placeholder;
|
76
86
|
|
77
87
|
// Set if engine should fallback to the default locale when a translation
|
78
88
|
// is missing.
|
79
|
-
this.fallbacks =
|
89
|
+
this.fallbacks = DEFAULT_OPTIONS.fallbacks;
|
80
90
|
|
81
91
|
// Set the default translation object.
|
82
|
-
this.translations =
|
92
|
+
this.translations = DEFAULT_OPTIONS.translations;
|
83
93
|
};
|
84
94
|
|
95
|
+
// Much like `reset`, but only assign options if not already assigned
|
96
|
+
I18n.initializeOptions = function() {
|
97
|
+
if (typeof(this.defaultLocale) === "undefined" && this.defaultLocale !== null)
|
98
|
+
this.defaultLocale = DEFAULT_OPTIONS.defaultLocale;
|
99
|
+
|
100
|
+
if (typeof(this.locale) === "undefined" && this.locale !== null)
|
101
|
+
this.locale = DEFAULT_OPTIONS.locale;
|
102
|
+
|
103
|
+
if (typeof(this.defaultSeparator) === "undefined" && this.defaultSeparator !== null)
|
104
|
+
this.defaultSeparator = DEFAULT_OPTIONS.defaultSeparator;
|
105
|
+
|
106
|
+
if (typeof(this.placeholder) === "undefined" && this.placeholder !== null)
|
107
|
+
this.placeholder = DEFAULT_OPTIONS.placeholder;
|
108
|
+
|
109
|
+
if (typeof(this.fallbacks) === "undefined" && this.fallbacks !== null)
|
110
|
+
this.fallbacks = DEFAULT_OPTIONS.fallbacks;
|
111
|
+
|
112
|
+
if (typeof(this.translations) === "undefined" && this.translations !== null)
|
113
|
+
this.translations = DEFAULT_OPTIONS.translations;
|
114
|
+
}
|
115
|
+
I18n.initializeOptions();
|
116
|
+
|
85
117
|
// Return a list of all locales that must be tried before returning the
|
86
118
|
// missing translation message. By default, this will consider the inline option,
|
87
119
|
// current locale and fallback locale.
|
@@ -181,10 +213,6 @@
|
|
181
213
|
}
|
182
214
|
};
|
183
215
|
|
184
|
-
// Reset all default attributes. This is specially useful
|
185
|
-
// while running tests.
|
186
|
-
I18n.reset();
|
187
|
-
|
188
216
|
// Return current locale. If no locale has been set, then
|
189
217
|
// the current locale will be the default locale.
|
190
218
|
I18n.currentLocale = function() {
|
@@ -687,4 +715,4 @@
|
|
687
715
|
I18n.t = I18n.translate;
|
688
716
|
I18n.l = I18n.localize;
|
689
717
|
I18n.p = I18n.pluralize;
|
690
|
-
})(typeof(exports) === "undefined" ? (this.I18n = {}) : exports);
|
718
|
+
})(typeof(exports) === "undefined" ? (this.I18n || (this.I18n = {})) : exports);
|
data/i18n-js.gemspec
CHANGED
@@ -8,7 +8,7 @@ Gem::Specification.new do |s|
|
|
8
8
|
s.platform = Gem::Platform::RUBY
|
9
9
|
s.authors = ["Nando Vieira", "PikachuEXE"]
|
10
10
|
s.email = ["fnando.vieira@gmail.com", "pikachuexe@gmail.com"]
|
11
|
-
s.homepage = "http://github.com/PikachuEXE/i18n-js
|
11
|
+
s.homepage = "http://github.com/PikachuEXE/i18n-js"
|
12
12
|
s.summary = "Forked version of original i18n-js. It's a small library to provide the Rails I18n translations on the Javascript."
|
13
13
|
s.description = "Forked version of original i18n-js. It contains some pull requests that are not pulled yet on the original repo. Switch back to the original one when it's ready."
|
14
14
|
|
data/lib/i18n/js/version.rb
CHANGED
data/package.json
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: i18n-js-pika
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.0.
|
4
|
+
version: 3.0.0.rc7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nando Vieira
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-12-
|
12
|
+
date: 2013-12-23 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: i18n
|
@@ -92,9 +92,9 @@ extensions: []
|
|
92
92
|
extra_rdoc_files: []
|
93
93
|
files:
|
94
94
|
- .gitignore
|
95
|
+
- .travis.yml
|
95
96
|
- CHANGELOG.md
|
96
97
|
- Gemfile
|
97
|
-
- Gemfile.lock
|
98
98
|
- README.md
|
99
99
|
- Rakefile
|
100
100
|
- app/assets/javascripts/i18n.js
|
@@ -138,7 +138,7 @@ files:
|
|
138
138
|
- spec/js/translate.spec.js
|
139
139
|
- spec/js/translations.js
|
140
140
|
- spec/spec_helper.rb
|
141
|
-
homepage: http://github.com/PikachuEXE/i18n-js
|
141
|
+
homepage: http://github.com/PikachuEXE/i18n-js
|
142
142
|
licenses:
|
143
143
|
- MIT
|
144
144
|
metadata: {}
|
data/Gemfile.lock
DELETED
@@ -1,52 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
i18n-js (3.0.0.rc5)
|
5
|
-
i18n
|
6
|
-
|
7
|
-
GEM
|
8
|
-
remote: https://rubygems.org/
|
9
|
-
specs:
|
10
|
-
activesupport (3.2.12)
|
11
|
-
i18n (~> 0.6)
|
12
|
-
multi_json (~> 1.0)
|
13
|
-
awesome_print (1.1.0)
|
14
|
-
coderay (1.0.9)
|
15
|
-
diff-lcs (1.2.1)
|
16
|
-
i18n (0.6.4)
|
17
|
-
method_source (0.8.1)
|
18
|
-
multi_json (1.6.1)
|
19
|
-
pry (0.9.12)
|
20
|
-
coderay (~> 1.0.5)
|
21
|
-
method_source (~> 0.8)
|
22
|
-
slop (~> 3.4)
|
23
|
-
pry-meta (0.0.5)
|
24
|
-
awesome_print
|
25
|
-
pry
|
26
|
-
pry-nav
|
27
|
-
pry-remote
|
28
|
-
pry-nav (0.2.3)
|
29
|
-
pry (~> 0.9.10)
|
30
|
-
pry-remote (0.1.7)
|
31
|
-
pry (~> 0.9)
|
32
|
-
slop (~> 3.0)
|
33
|
-
rake (10.0.3)
|
34
|
-
rspec (2.13.0)
|
35
|
-
rspec-core (~> 2.13.0)
|
36
|
-
rspec-expectations (~> 2.13.0)
|
37
|
-
rspec-mocks (~> 2.13.0)
|
38
|
-
rspec-core (2.13.0)
|
39
|
-
rspec-expectations (2.13.0)
|
40
|
-
diff-lcs (>= 1.1.3, < 2.0)
|
41
|
-
rspec-mocks (2.13.0)
|
42
|
-
slop (3.4.3)
|
43
|
-
|
44
|
-
PLATFORMS
|
45
|
-
ruby
|
46
|
-
|
47
|
-
DEPENDENCIES
|
48
|
-
activesupport
|
49
|
-
i18n-js!
|
50
|
-
pry-meta
|
51
|
-
rake
|
52
|
-
rspec
|