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 +4 -4
- data/CHANGELOG +4 -0
- data/app/assets/javascripts/i18n.js +11 -2
- data/lib/l10n/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2a9ff8476b428e4a166fd846f24e054e360684cfaddb5dc0d8f82fe5819975f2
|
4
|
+
data.tar.gz: 1c403e8eafe80d8cb3db18e4cd5224168a645473e0b31c57f0dccf10dbf723fa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 07ea754da688cd5ced4383e9ff506eee54f01e1be658394d5d807ebafcf43749c1e1cda7282a0138c680126c455eb8d86908f91da01adf6a3d098d9963f36b55
|
7
|
+
data.tar.gz: c486c47c9ddd5b749cc07f8fa11b5dd444df537de4d82129c7b2bb3b72600c5af6f55936d06d109dc67408d4d47416ac5e2a7cf823c53fa1041cb176ccccfd43
|
data/CHANGELOG
CHANGED
@@ -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 (
|
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 (
|
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