l10n 1.3.0 → 1.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a44720d047dd98be2e79dee2714ae874590381eb5d5bfbe5fe5ad4aa86ab5a48
4
- data.tar.gz: 1c2e44f58f74771b7598244608734776057c8d18f4c4b1d86388c470407f3062
3
+ metadata.gz: 2a9ff8476b428e4a166fd846f24e054e360684cfaddb5dc0d8f82fe5819975f2
4
+ data.tar.gz: 1c403e8eafe80d8cb3db18e4cd5224168a645473e0b31c57f0dccf10dbf723fa
5
5
  SHA512:
6
- metadata.gz: e7fccf4cdfa24601ee81af316f1f18b0fbb5e87e005e782147874e6f222499032aafbdfa42bf9eb7b839dc0b5e560641e1f9a7725aba793de226fd560ce66cf5
7
- data.tar.gz: ef18e5baf0eeb1f1dab9cf153bb932a6e34194868b1265044b6bb8b1f47d74d0a442ca21d67f543742fa0c9bb11853e781c0132ccf1e29482ff0415b6e253b8d
6
+ metadata.gz: 07ea754da688cd5ced4383e9ff506eee54f01e1be658394d5d807ebafcf43749c1e1cda7282a0138c680126c455eb8d86908f91da01adf6a3d098d9963f36b55
7
+ data.tar.gz: c486c47c9ddd5b749cc07f8fa11b5dd444df537de4d82129c7b2bb3b72600c5af6f55936d06d109dc67408d4d47416ac5e2a7cf823c53fa1041cb176ccccfd43
data/CHANGELOG CHANGED
@@ -1,3 +1,7 @@
1
+ * 1.4.0 - 2018-06-21
2
+
3
+ - Removing jQuery dependency from i18n javascript
4
+
1
5
  * 1.1.0 - 2014-12-09
2
6
 
3
7
  - Adding Time#l
@@ -7,14 +7,23 @@ I18n.translate = function(str, options) {
7
7
  var count = options['count'];
8
8
  var keys = str.split('.');
9
9
  var obj = this.translations;
10
+
11
+ var isString = function(value) {
12
+ return typeof value === 'string' || value instanceof String;
13
+ };
14
+
15
+ var isObject = function(value) {
16
+ return value && typeof value === 'object' && value.constructor === Object;
17
+ };
18
+
10
19
  while(obj && keys.length) obj = obj[keys.shift()];
11
20
  if (obj) {
12
- if ($.type(obj) == 'object' && count !== undefined) {
21
+ if (isObject(obj) && count !== undefined) {
13
22
  translation = obj[1 == count ? 'one' : 'other'];
14
23
  } else {
15
24
  translation = obj;
16
25
  }
17
- if ($.type(translation) == 'string' && (matches = translation.match(/{\w+?}/g))) {
26
+ if (isString(translation) && (matches = translation.match(/{\w+?}/g))) {
18
27
  while(match = matches.shift()) {
19
28
  method = match.substr(1, match.length - 2);
20
29
  interpolation_value = options[method];
data/lib/l10n/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module L10n
2
- VERSION = '1.3.0'
2
+ VERSION = '1.4.0'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: l10n
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 1.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matthias Grosser