r18n-desktop 3.0.5 → 3.1.1

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: c8656b7b17ee3e8a89261a757af67b415159b8f72f23a10f04f68147187f2fe0
4
- data.tar.gz: 7b9601a0756ab35a7d67e7df5df250575ffb7b317d20aa4b524d2bb69dfc7ec2
3
+ metadata.gz: b206f4abe8aa4141218e817caef754d30ba014fb666f6d28b02c0c1b9955070b
4
+ data.tar.gz: e6d95a142f538f6bbcd6ce206846e6c7d371130d1d1020b69126bb8c8ba4c248
5
5
  SHA512:
6
- metadata.gz: 90dbdde2b7a07ed4d83f603aafa8977b106becbd298d81cfcc6ddf203bca71460311b295d698025abd2afacb8317aaadd2ea7e5d37e4430b67556033cfe89f4f
7
- data.tar.gz: 0f501902d2839896ed57ea4f5ff3bb66b0981fab26c4d2ef6c14d43f268424bbee2323a5d2b295625004d999f2701fcbd1d321706e69c35316ff9cab379c8ba0
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.insert(0, ENV['LANG']) if ENV['LANG']
40
- locales.insert(0, manual) if manual
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
@@ -0,0 +1,2 @@
1
+ account:
2
+ balance: Balance for account
@@ -13,23 +13,31 @@ describe 'r18n-desktop' do
13
13
  expect(locale).not_to be_empty
14
14
  end
15
15
 
16
- it 'loads I18n from system environment' do
17
- R18n.from_env
18
- expect(r18n.class).to eq R18n::I18n
19
- expect(r18n.locale).not_to be_empty if String == r18n.locale.class
20
- expect(R18n.get).to eq r18n
21
- end
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
- it 'loads i18n from system environment using specified order' do
24
- R18n.from_env(nil, 'en')
25
- expect(r18n.locale).to eq R18n.locale('en')
26
- expect(R18n.get).to eq r18n
27
- end
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
- it 'allows to overide autodetect by LANG environment' do
30
- allow(R18n::I18n).to receive(:system_locale) { 'ru' }
31
- ENV['LANG'] = 'en'
32
- R18n.from_env
33
- expect(r18n.locale).to eq R18n.locale('en')
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.0.5
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-07-19 00:00:00.000000000 Z
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.0.5
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.0.5
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