i18n-translate-light 0.0.2 → 0.0.3
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/CHANGELOG.md +17 -0
- data/Gemfile.lock +1 -1
- data/README.md +1 -0
- data/app/assets/javascripts/i18n-translate-light.js +3 -0
- data/i18n-translate-light.js +3 -0
- data/lib/i18n-translate-light/version.rb +1 -1
- data/spec/javascripts/i18n-translate-light-spec.js +9 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 19571f37a1015b35f94856992dc9a2fc277cec7f
|
4
|
+
data.tar.gz: d5862112f2c93dc1a1f3d9162f9e068fce8a7fa7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3cbf9498dd80814a1876b65e7b43ca9195a2d8b8fd11c55023341c758716509ee9b7f59ddb89ff4ab9ccd1375106ceebe8c1fefe18f563ce2ee9b021d9fb6011
|
7
|
+
data.tar.gz: d520114cead2d96a95d24d51fe84f8014f5353d42b33e13415c8671f235eddf86a7df2847a71431600ab7490fe01db7f1ac6f74fbc1a7b42d0912839f006c4c7
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
i18n-translate-light Changelog
|
2
|
+
==============================
|
3
|
+
|
4
|
+
# 0.0.3
|
5
|
+
|
6
|
+
* Feature: Adds `I18NTranslateLight.userlocale` property
|
7
|
+
|
8
|
+
# 0.0.2
|
9
|
+
|
10
|
+
* Fix: Gemspec, Bundler, and railstie dependency fix.
|
11
|
+
|
12
|
+
# 0.0.1
|
13
|
+
|
14
|
+
* Initial release
|
15
|
+
* Feature: Translation dictionary management
|
16
|
+
* Feature: Locale Detection
|
17
|
+
* Feature: Translation lookup
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -43,6 +43,7 @@ Here are the following APIs for the I18NTranslateLight singleton:
|
|
43
43
|
* `autoDetectLocale()` - Auto detect user locale from Browser settings, sets active locale.
|
44
44
|
* `addTranslations(locale, locationHash)` - Add a translations for locale (eg: `en-US`) as a hash of key/string pairs (eg: `{ "ui.dialog.cancel": "Cancel" }`)
|
45
45
|
* `translate(key)` / `_t(key)` - Return translated text for key
|
46
|
+
* `userLocale` - Return current user locale
|
46
47
|
|
47
48
|
## Installing
|
48
49
|
|
@@ -5,9 +5,11 @@
|
|
5
5
|
var I18NTranslateLight = (function($) {
|
6
6
|
this.dict = {};
|
7
7
|
this.defaultLocale = 'en';
|
8
|
+
this.userLocale = this.defaultLocale;
|
8
9
|
this.activeLocales = [ this.defaultLocale ];
|
9
10
|
|
10
11
|
var setLocale = function(locale) {
|
12
|
+
this.userLocale = locale;
|
11
13
|
this.activeLocales = expandLocales(locale);
|
12
14
|
};
|
13
15
|
|
@@ -75,6 +77,7 @@ var I18NTranslateLight = (function($) {
|
|
75
77
|
dict: this.dict,
|
76
78
|
activeLocales: this.activeLocales,
|
77
79
|
defaultLocale: this.defaultLocale,
|
80
|
+
userLocale: this.userLocale,
|
78
81
|
resetDict: function() { this.dict = {}; },
|
79
82
|
detectBrowserLocale: detectBrowserLocale,
|
80
83
|
setLocale: setLocale,
|
data/i18n-translate-light.js
CHANGED
@@ -5,9 +5,11 @@
|
|
5
5
|
var I18NTranslateLight = (function($) {
|
6
6
|
this.dict = {};
|
7
7
|
this.defaultLocale = 'en';
|
8
|
+
this.userLocale = this.defaultLocale;
|
8
9
|
this.activeLocales = [ this.defaultLocale ];
|
9
10
|
|
10
11
|
var setLocale = function(locale) {
|
12
|
+
this.userLocale = locale;
|
11
13
|
this.activeLocales = expandLocales(locale);
|
12
14
|
};
|
13
15
|
|
@@ -75,6 +77,7 @@ var I18NTranslateLight = (function($) {
|
|
75
77
|
dict: this.dict,
|
76
78
|
activeLocales: this.activeLocales,
|
77
79
|
defaultLocale: this.defaultLocale,
|
80
|
+
userLocale: this.userLocale,
|
78
81
|
resetDict: function() { this.dict = {}; },
|
79
82
|
detectBrowserLocale: detectBrowserLocale,
|
80
83
|
setLocale: setLocale,
|
@@ -94,6 +94,15 @@ describe("I18NTranslateLight", function() {
|
|
94
94
|
I18NTranslateLight.setLocale('es-ES');
|
95
95
|
expect(I18NTranslateLight.activeLocales).toEqual([ 'es-ES', 'es', 'en' ]);
|
96
96
|
});
|
97
|
+
|
98
|
+
it("should set userLocale", function() {
|
99
|
+
I18NTranslateLight.setLocale('en');
|
100
|
+
|
101
|
+
expect(I18NTranslateLight.userLocale).toEqual('en');
|
102
|
+
|
103
|
+
I18NTranslateLight.setLocale('es-ES');
|
104
|
+
expect(I18NTranslateLight.userLocale).toEqual('es-ES');
|
105
|
+
});
|
97
106
|
});
|
98
107
|
|
99
108
|
describe("translate", function() {
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: i18n-translate-light
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Winfield Peterson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-02-
|
11
|
+
date: 2014-02-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: railties
|
@@ -75,6 +75,7 @@ extensions: []
|
|
75
75
|
extra_rdoc_files: []
|
76
76
|
files:
|
77
77
|
- ".gitignore"
|
78
|
+
- CHANGELOG.md
|
78
79
|
- Gemfile
|
79
80
|
- Gemfile.lock
|
80
81
|
- LICENSE.txt
|