r18n-desktop 2.2.0 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.rspec +1 -1
- data/Rakefile +5 -3
- data/lib/r18n-desktop.rb +23 -25
- data/lib/r18n-desktop/java.rb +17 -17
- data/lib/r18n-desktop/osx.rb +21 -18
- data/lib/r18n-desktop/posix.rb +17 -17
- data/lib/r18n-desktop/win32.rb +19 -19
- data/r18n-desktop.gemspec +5 -3
- data/spec/r18n-desktop_spec.rb +6 -6
- data/spec/spec_helper.rb +3 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: c4d5b7e1f439e6b3aa4bc625d6ca8ae702b7ab9600e1c3ce8a9d70938f027258
|
4
|
+
data.tar.gz: f7d351442f45ddf14f91d790a6582943396283d3d8f86614a54761322928d832
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1340cab61e54f87206968f1c85cd21c7e771858079b266b30648e5c19a8d96aa0de4530ea8bf7b1695ef385f788dbdd0adcbc1a25490e363bd23a1536926a532
|
7
|
+
data.tar.gz: be5b79c8a4f915697e074c9d63250c3fabc18e9a92a9fd87614c4eab868d2d93a9f20ce9600f3e3d480608950c8eb4bd3c364c685c33c3bb8b482328c8e0f8cd
|
data/.rspec
CHANGED
@@ -1 +1 @@
|
|
1
|
-
--format documentation --colour
|
1
|
+
--format documentation --colour --warnings --require spec_helper
|
data/Rakefile
CHANGED
@@ -1,11 +1,13 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'bundler/setup'
|
2
4
|
Bundler::GemHelper.install_tasks
|
3
5
|
|
4
6
|
require 'rspec/core/rake_task'
|
5
7
|
RSpec::Core::RakeTask.new
|
6
|
-
task :
|
8
|
+
task default: :spec
|
7
9
|
|
8
10
|
task :clobber_package do
|
9
|
-
|
11
|
+
rm_rf 'pkg'
|
10
12
|
end
|
11
|
-
task :
|
13
|
+
task clobber: [:clobber_package]
|
data/lib/r18n-desktop.rb
CHANGED
@@ -1,34 +1,32 @@
|
|
1
|
-
|
2
|
-
I18n support for desktop application.
|
1
|
+
# frozen_string_literal: true
|
3
2
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
3
|
+
# I18n support for desktop application.
|
4
|
+
#
|
5
|
+
# Copyright (C) 2008 Andrey “A.I.” Sitnik <andrey@sitnik.ru>
|
6
|
+
#
|
7
|
+
# This program is free software: you can redistribute it and/or modify
|
8
|
+
# it under the terms of the GNU Lesser General Public License as published by
|
9
|
+
# the Free Software Foundation, either version 3 of the License, or
|
10
|
+
# (at your option) any later version.
|
11
|
+
#
|
12
|
+
# This program is distributed in the hope that it will be useful,
|
13
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
15
|
+
# GNU Lesser General Public License for more details.
|
16
|
+
#
|
17
|
+
# You should have received a copy of the GNU Lesser General Public License
|
18
|
+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
19
19
|
|
20
20
|
require 'r18n-core'
|
21
21
|
|
22
|
-
require 'pathname'
|
23
|
-
dir = Pathname(__FILE__).dirname.expand_path + 'r18n-desktop'
|
24
22
|
if /cygwin|mingw|win32/ =~ RUBY_PLATFORM
|
25
|
-
|
23
|
+
require_relative 'r18n-desktop/win32'
|
26
24
|
elsif /java/ =~ RUBY_PLATFORM
|
27
|
-
|
25
|
+
require_relative 'r18n-desktop/java'
|
28
26
|
elsif /darwin/ =~ RUBY_PLATFORM
|
29
|
-
|
27
|
+
require_relative 'r18n-desktop/osx'
|
30
28
|
else
|
31
|
-
|
29
|
+
require_relative 'r18n-desktop/posix'
|
32
30
|
end
|
33
31
|
|
34
32
|
module R18n
|
@@ -37,10 +35,10 @@ module R18n
|
|
37
35
|
# information and translations from +translations_places+. If user set
|
38
36
|
# locale +manual+ put it as last argument.
|
39
37
|
def from_env(translations_places = nil, manual = nil)
|
40
|
-
locales
|
38
|
+
locales = Array(R18n::I18n.system_locale)
|
41
39
|
locales.insert(0, ENV['LANG']) if ENV['LANG']
|
42
40
|
locales.insert(0, manual) if manual
|
43
|
-
|
41
|
+
set I18n.new(locales, translations_places)
|
44
42
|
end
|
45
43
|
end
|
46
44
|
end
|
data/lib/r18n-desktop/java.rb
CHANGED
@@ -1,21 +1,21 @@
|
|
1
|
-
|
2
|
-
I18n support for JRuby.
|
1
|
+
# frozen_string_literal: true
|
3
2
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
3
|
+
# I18n support for JRuby.
|
4
|
+
#
|
5
|
+
# Copyright (C) 2008 Andrey “A.I.” Sitnik <andrey@sitnik.ru>
|
6
|
+
#
|
7
|
+
# This program is free software: you can redistribute it and/or modify
|
8
|
+
# it under the terms of the GNU Lesser General Public License as published by
|
9
|
+
# the Free Software Foundation, either version 3 of the License, or
|
10
|
+
# (at your option) any later version.
|
11
|
+
#
|
12
|
+
# This program is distributed in the hope that it will be useful,
|
13
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
15
|
+
# GNU Lesser General Public License for more details.
|
16
|
+
#
|
17
|
+
# You should have received a copy of the GNU Lesser General Public License
|
18
|
+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
19
19
|
|
20
20
|
module R18n
|
21
21
|
class I18n
|
data/lib/r18n-desktop/osx.rb
CHANGED
@@ -1,26 +1,29 @@
|
|
1
|
-
|
2
|
-
I18n support for Mac OS X.
|
1
|
+
# frozen_string_literal: true
|
3
2
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
3
|
+
# I18n support for Mac OS X.
|
4
|
+
#
|
5
|
+
# Copyright (C) 2008 Andrey “A.I.” Sitnik <andrey@sitnik.ru>
|
6
|
+
#
|
7
|
+
# This program is free software: you can redistribute it and/or modify
|
8
|
+
# it under the terms of the GNU Lesser General Public License as published by
|
9
|
+
# the Free Software Foundation, either version 3 of the License, or
|
10
|
+
# (at your option) any later version.
|
11
|
+
#
|
12
|
+
# This program is distributed in the hope that it will be useful,
|
13
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
15
|
+
# GNU Lesser General Public License for more details.
|
16
|
+
#
|
17
|
+
# You should have received a copy of the GNU Lesser General Public License
|
18
|
+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
19
19
|
|
20
20
|
module R18n
|
21
21
|
class I18n
|
22
22
|
def self.system_locale
|
23
|
-
|
23
|
+
command =
|
24
|
+
'defaults read .GlobalPreferences AppleLanguages |' \
|
25
|
+
' tr -d [:space:] | cut -c2-3'
|
26
|
+
`#{command}`.chop
|
24
27
|
end
|
25
28
|
end
|
26
29
|
end
|
data/lib/r18n-desktop/posix.rb
CHANGED
@@ -1,21 +1,21 @@
|
|
1
|
-
|
2
|
-
I18n support for UNIX-like OS.
|
1
|
+
# frozen_string_literal: true
|
3
2
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
3
|
+
# I18n support for UNIX-like OS.
|
4
|
+
#
|
5
|
+
# Copyright (C) 2008 Andrey “A.I.” Sitnik <andrey@sitnik.ru>
|
6
|
+
#
|
7
|
+
# This program is free software: you can redistribute it and/or modify
|
8
|
+
# it under the terms of the GNU Lesser General Public License as published by
|
9
|
+
# the Free Software Foundation, either version 3 of the License, or
|
10
|
+
# (at your option) any later version.
|
11
|
+
#
|
12
|
+
# This program is distributed in the hope that it will be useful,
|
13
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
15
|
+
# GNU Lesser General Public License for more details.
|
16
|
+
#
|
17
|
+
# You should have received a copy of the GNU Lesser General Public License
|
18
|
+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
19
19
|
|
20
20
|
module R18n
|
21
21
|
class I18n
|
data/lib/r18n-desktop/win32.rb
CHANGED
@@ -1,21 +1,21 @@
|
|
1
|
-
|
2
|
-
I18n support for Windows.
|
1
|
+
# frozen_string_literal: true
|
3
2
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
3
|
+
# I18n support for Windows.
|
4
|
+
#
|
5
|
+
# Copyright (C) 2008 Andrey “A.I.” Sitnik <andrey@sitnik.ru>
|
6
|
+
#
|
7
|
+
# This program is free software: you can redistribute it and/or modify
|
8
|
+
# it under the terms of the GNU Lesser General Public License as published by
|
9
|
+
# the Free Software Foundation, either version 3 of the License, or
|
10
|
+
# (at your option) any later version.
|
11
|
+
#
|
12
|
+
# This program is distributed in the hope that it will be useful,
|
13
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
15
|
+
# GNU Lesser General Public License for more details.
|
16
|
+
#
|
17
|
+
# You should have received a copy of the GNU Lesser General Public License
|
18
|
+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
19
19
|
|
20
20
|
require 'fiddle/import'
|
21
21
|
|
@@ -248,7 +248,7 @@ module R18n
|
|
248
248
|
0x0488 => 'wo_SN',
|
249
249
|
0x0485 => 'sah_RU',
|
250
250
|
0x0478 => 'ii_CN',
|
251
|
-
0x046a => 'yo_NG'
|
252
|
-
}
|
251
|
+
0x046a => 'yo_NG'
|
252
|
+
}.freeze
|
253
253
|
end
|
254
254
|
end
|
data/r18n-desktop.gemspec
CHANGED
@@ -1,4 +1,6 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative '../r18n-core/lib/r18n-core/version'
|
2
4
|
|
3
5
|
Gem::Specification.new do |s|
|
4
6
|
s.platform = Gem::Platform::RUBY
|
@@ -7,14 +9,14 @@ Gem::Specification.new do |s|
|
|
7
9
|
s.date = Time.now.strftime('%Y-%m-%d')
|
8
10
|
|
9
11
|
s.summary = 'A i18n tool to translate your Ruby desktop application.'
|
10
|
-
s.description = <<-
|
12
|
+
s.description = <<-DESC
|
11
13
|
A i18n tool to translate your desktop application in several languages.
|
12
14
|
It is just a wrapper for R18n core library.
|
13
15
|
It has nice Ruby-style syntax, filters, flexible locales, custom loaders,
|
14
16
|
translation support for any classes, time and number localization, several
|
15
17
|
user language support, agnostic core package with out-of-box support for
|
16
18
|
Rails, Sinatra and desktop applications.
|
17
|
-
|
19
|
+
DESC
|
18
20
|
|
19
21
|
s.files = `git ls-files`.split("\n")
|
20
22
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
data/spec/r18n-desktop_spec.rb
CHANGED
@@ -1,32 +1,32 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
2
|
|
3
|
-
describe
|
3
|
+
describe 'r18n-desktop' do
|
4
4
|
include R18n::Helpers
|
5
5
|
|
6
6
|
before(:each) do
|
7
7
|
R18n.reset!
|
8
8
|
end
|
9
9
|
|
10
|
-
it
|
10
|
+
it 'returns array of system locales' do
|
11
11
|
locale = R18n::I18n.system_locale
|
12
12
|
expect(locale.class).to eq String
|
13
13
|
expect(locale).not_to be_empty
|
14
14
|
end
|
15
15
|
|
16
|
-
it
|
16
|
+
it 'loads I18n from system environment' do
|
17
17
|
R18n.from_env
|
18
18
|
expect(r18n.class).to eq R18n::I18n
|
19
19
|
expect(r18n.locale).not_to be_empty if String == r18n.locale.class
|
20
20
|
expect(R18n.get).to eq r18n
|
21
21
|
end
|
22
22
|
|
23
|
-
it
|
23
|
+
it 'loads i18n from system environment using specified order' do
|
24
24
|
R18n.from_env(nil, 'en')
|
25
25
|
expect(r18n.locale).to eq R18n.locale('en')
|
26
26
|
expect(R18n.get).to eq r18n
|
27
27
|
end
|
28
28
|
|
29
|
-
it
|
29
|
+
it 'allows to overide autodetect by LANG environment' do
|
30
30
|
allow(R18n::I18n).to receive(:system_locale) { 'ru' }
|
31
31
|
ENV['LANG'] = 'en'
|
32
32
|
R18n.from_env
|
data/spec/spec_helper.rb
CHANGED
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:
|
4
|
+
version: 3.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrey Sitnik
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-03-08 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:
|
19
|
+
version: 3.0.0
|
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:
|
26
|
+
version: 3.0.0
|
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.
|
@@ -70,7 +70,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
70
70
|
version: '0'
|
71
71
|
requirements: []
|
72
72
|
rubyforge_project:
|
73
|
-
rubygems_version: 2.
|
73
|
+
rubygems_version: 2.7.6
|
74
74
|
signing_key:
|
75
75
|
specification_version: 4
|
76
76
|
summary: A i18n tool to translate your Ruby desktop application.
|