r18n-desktop 3.0.5 → 3.1.1
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/lib/r18n-desktop.rb +4 -3
- data/r18n-desktop.gemspec +1 -1
- data/spec/i18n/en.yml +2 -0
- data/spec/r18n-desktop_spec.rb +24 -16
- metadata +7 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b206f4abe8aa4141218e817caef754d30ba014fb666f6d28b02c0c1b9955070b
|
4
|
+
data.tar.gz: e6d95a142f538f6bbcd6ce206846e6c7d371130d1d1020b69126bb8c8ba4c248
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 89ebf8e4c5243d23b8bea63668084e90ff1ae1d3fdb458bc5cde51b0c1af311c09c7fbb2332466ad48eef624caa99502e5602ab71e3afe1555387eedee411940
|
7
|
+
data.tar.gz: d360382108586959d966eb095148c30281685f01f086d4a79624fa69bb52879008fa60537585e24c0adc2bcdde072e5e55071ccabe2966e951f1a684295acbb6
|
data/lib/r18n-desktop.rb
CHANGED
@@ -35,10 +35,11 @@ module R18n
|
|
35
35
|
# information and translations from +translations_places+. If user set
|
36
36
|
# locale +manual+ put it as last argument.
|
37
37
|
def from_env(translations_places = nil, manual = nil)
|
38
|
+
::R18n.default_places { translations_places }
|
38
39
|
locales = Array(R18n::I18n.system_locale)
|
39
|
-
locales.
|
40
|
-
locales.
|
41
|
-
set I18n.new(locales, translations_places)
|
40
|
+
locales.unshift(ENV['LANG']) if ENV['LANG']
|
41
|
+
locales.unshift(manual) if manual
|
42
|
+
set ::R18n::I18n.new(locales, translations_places)
|
42
43
|
end
|
43
44
|
end
|
44
45
|
end
|
data/r18n-desktop.gemspec
CHANGED
@@ -26,7 +26,7 @@ Gem::Specification.new do |s|
|
|
26
26
|
s.author = 'Andrey Sitnik'
|
27
27
|
s.email = 'andrey@sitnik.ru'
|
28
28
|
s.homepage = 'https://github.com/ai/r18n/tree/master/r18n-desktop'
|
29
|
-
s.license = 'LGPL-3'
|
29
|
+
s.license = 'LGPL-3.0'
|
30
30
|
|
31
31
|
s.add_dependency 'r18n-core', "= #{R18n::VERSION}"
|
32
32
|
end
|
data/spec/i18n/en.yml
ADDED
data/spec/r18n-desktop_spec.rb
CHANGED
@@ -13,23 +13,31 @@ describe 'r18n-desktop' do
|
|
13
13
|
expect(locale).not_to be_empty
|
14
14
|
end
|
15
15
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
16
|
+
describe '.from_env' do
|
17
|
+
it 'loads I18n from system environment' do
|
18
|
+
R18n.from_env
|
19
|
+
expect(r18n.class).to eq R18n::I18n
|
20
|
+
expect(r18n.locale).not_to be_empty if String == r18n.locale.class
|
21
|
+
expect(R18n.get).to eq r18n
|
22
|
+
end
|
22
23
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
24
|
+
it 'loads i18n from system environment using specified order' do
|
25
|
+
R18n.from_env(nil, 'en')
|
26
|
+
expect(r18n.locale).to eq R18n.locale('en')
|
27
|
+
expect(R18n.get).to eq r18n
|
28
|
+
end
|
29
|
+
|
30
|
+
it 'allows to overide autodetect by LANG environment' do
|
31
|
+
allow(R18n::I18n).to receive(:system_locale) { 'ru' }
|
32
|
+
ENV['LANG'] = 'en'
|
33
|
+
R18n.from_env
|
34
|
+
expect(r18n.locale).to eq R18n.locale('en')
|
35
|
+
end
|
28
36
|
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
37
|
+
it 'works with following `R18n.set`' do
|
38
|
+
R18n.from_env 'spec/i18n/'
|
39
|
+
R18n.set 'en'
|
40
|
+
expect(t.account.balance).to eq 'Balance for account'
|
41
|
+
end
|
34
42
|
end
|
35
43
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: r18n-desktop
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrey Sitnik
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-08-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: r18n-core
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - '='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 3.
|
19
|
+
version: 3.1.1
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - '='
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 3.
|
26
|
+
version: 3.1.1
|
27
27
|
description: |2
|
28
28
|
A i18n tool to translate your desktop application in several languages.
|
29
29
|
It is just a wrapper for R18n core library.
|
@@ -48,11 +48,12 @@ files:
|
|
48
48
|
- lib/r18n-desktop/posix.rb
|
49
49
|
- lib/r18n-desktop/win32.rb
|
50
50
|
- r18n-desktop.gemspec
|
51
|
+
- spec/i18n/en.yml
|
51
52
|
- spec/r18n-desktop_spec.rb
|
52
53
|
- spec/spec_helper.rb
|
53
54
|
homepage: https://github.com/ai/r18n/tree/master/r18n-desktop
|
54
55
|
licenses:
|
55
|
-
- LGPL-3
|
56
|
+
- LGPL-3.0
|
56
57
|
metadata: {}
|
57
58
|
post_install_message:
|
58
59
|
rdoc_options: []
|
@@ -75,5 +76,6 @@ signing_key:
|
|
75
76
|
specification_version: 4
|
76
77
|
summary: A i18n tool to translate your Ruby desktop application.
|
77
78
|
test_files:
|
79
|
+
- spec/i18n/en.yml
|
78
80
|
- spec/r18n-desktop_spec.rb
|
79
81
|
- spec/spec_helper.rb
|