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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8f2f195e7dd4f8ea76f020bb8046f68e557808c8
4
- data.tar.gz: c3c36611fd1fc1d428bab5f849e68588cbe6de6d
3
+ metadata.gz: bebb8d813e23d8ce58aa317620c27f9e2764cf71
4
+ data.tar.gz: 9a737f462dd976bbc7599d94c3c6aa9349244ae6
5
5
  SHA512:
6
- metadata.gz: cc97a5c29ca24a1e3acfa8b681f0f52f6407cb8ceb3e90e434d25b89877726ff49815f7fb7f3a7ca2f0793e5e1bbd180d1e7d62f0cfd6182b706c48e2f64404d
7
- data.tar.gz: 25086f2c7ca230f0c7a77a37efd39c384a782595ca87c9af276f9031c83a6c181ecdd87ed58e6fae82223f63b156b877f1d43641837a2ed93d22bcb740e874a0
6
+ metadata.gz: 7b37f5722ba6e411ca52921a265f979444441448d9e0751eaf8cf0f1d5555c9ba6029351d2db9cf567bc48964e74fb06f7a880c158e9f715b76e7108f214bd9c
7
+ data.tar.gz: f39fb56b11a64ea6c8e7df203fcc6ac00bbd4dfefb94d7b796db7d8d5f2515db83f4215f3c0efb2ca54290af337d79e222e32b827bde1d21520adf6e15e232ae
data/.gitignore CHANGED
@@ -1,2 +1,6 @@
1
+ doc
2
+ coverage
1
3
  pkg
2
- node_modules
4
+ spec/tmp
5
+ .DS_Store
6
+ Gemfile.lock
data/.travis.yml ADDED
@@ -0,0 +1,10 @@
1
+ language: ruby
2
+ rvm:
3
+ - 1.9.3
4
+ - 2.0.0
5
+ script: "bundle exec rake spec"
6
+ before_install: # Need to install npm to test js
7
+ - sudo apt-get update
8
+ - sudo apt-get install npm
9
+ - npm install jasmine-node
10
+
data/README.md CHANGED
@@ -11,6 +11,10 @@ Features:
11
11
  - Asset pipeline support
12
12
  - Lots more! :)
13
13
 
14
+ [![Build Status](https://travis-ci.org/PikachuEXE/i18n-js.png?branch=master)](https://travis-ci.org/PikachuEXE/i18n-js)
15
+ [![Gem Version](https://badge.fury.io/rb/i18n-js-pika.png)](http://badge.fury.io/rb/i18n-js-pika)
16
+ [![Dependency Status](https://gemnasium.com/PikachuEXE/i18n-js.png)](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
- source :rubygems
23
- gem "rails", "3.2.3"
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
@@ -11,3 +11,7 @@ end
11
11
 
12
12
  desc "Run all specs"
13
13
  task :spec => ["spec:ruby", "spec:js"]
14
+
15
+ task :default do
16
+ Rake::Task[:spec].invoke
17
+ end
@@ -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 = "en";
76
+ this.defaultLocale = DEFAULT_OPTIONS.defaultLocale;
67
77
 
68
78
  // Set the current locale to `en`.
69
- this.locale = "en";
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 = /(?:\{\{|%\{)(.*?)(?:\}\}?)/gm;
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 = false;
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-pika"
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
 
@@ -5,7 +5,7 @@ module I18n
5
5
  MINOR = 0
6
6
  PATCH = 0
7
7
  # Set to nil for stable release
8
- BUILD = 'rc6'.freeze
8
+ BUILD = 'rc7'.freeze
9
9
  STRING = [MAJOR, MINOR, PATCH, BUILD].compact.join('.')
10
10
  end
11
11
  end
data/package.json CHANGED
@@ -6,6 +6,6 @@
6
6
  },
7
7
 
8
8
  "scripts": {
9
- "test": "./node_modules/.bin/jasmine-node spec/js"
9
+ "test": "jasmine-node spec/js"
10
10
  }
11
11
  }
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.rc6
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 00:00:00.000000000 Z
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-pika
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