r18n-desktop 0.4.14 → 1.0.0

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.
data/.yardopts CHANGED
@@ -1,3 +1,3 @@
1
1
  --charset utf-8
2
2
  -
3
- README.rdoc
3
+ README.md
data/LICENSE CHANGED
@@ -10,7 +10,7 @@
10
10
  the terms and conditions of version 3 of the GNU General Public
11
11
  License, supplemented by the additional permissions listed below.
12
12
 
13
- 0. Additional Definitions.
13
+ 0. Additional Definitions.
14
14
 
15
15
  As used herein, "this License" refers to version 3 of the GNU Lesser
16
16
  General Public License, and the "GNU GPL" refers to version 3 of the GNU
@@ -111,7 +111,7 @@ the following:
111
111
  a copy of the Library already present on the user's computer
112
112
  system, and (b) will operate properly with a modified version
113
113
  of the Library that is interface-compatible with the Linked
114
- Version.
114
+ Version.
115
115
 
116
116
  e) Provide Installation Information, but only if you would otherwise
117
117
  be required to provide such information under section 6 of the
@@ -0,0 +1,92 @@
1
+ # R18n Desktop
2
+
3
+ A tool to translate your desktop application to several languages.
4
+
5
+ It is just a wrapper for R18n core library. See R18n documentation for more
6
+ information.
7
+
8
+ ## Features
9
+
10
+ * Nice Ruby-style syntax.
11
+ * Filters.
12
+ * Model Translation (or any Ruby object).
13
+ * Autodetect user locales.
14
+ * Flexible locales.
15
+ * Total flexibility.
16
+
17
+ See full features in [main README](https://github.com/ai/r18n/blob/master/README.md).
18
+
19
+ ## How To
20
+
21
+ 1. Create translations dir. For example: `./i18n/`.
22
+ 2. Add file with translation to `./i18n/` with language code in file name
23
+ (for example, `en.yml` for English or `en-us.yml` USA English dialect).
24
+ For example, `./i18n/en.yml`:
25
+
26
+ ```yaml
27
+ file:
28
+ add: Add file
29
+ delete: Delete file %1
30
+
31
+ files: !!pl
32
+ 0: No files
33
+ 1: One file
34
+ n: %1 files
35
+ ```
36
+
37
+ 3. Add R18n to your application:
38
+
39
+ ```ruby
40
+ require 'r18n-desktop'
41
+ ```
42
+
43
+ 4. Load I18n object:
44
+
45
+ ```ruby
46
+ R18n.from_env('i18n/')
47
+ ```
48
+ User can set the locale manually:
49
+
50
+ ```ruby
51
+ R18n.from_env('i18n/', manual_locale)
52
+ ```
53
+
54
+ 5. Include mixin to use helpers:
55
+
56
+ ```ruby
57
+ include R18n::Helpers
58
+ ```
59
+
60
+ 6. Use translation messages to user. For example:
61
+
62
+ ```ruby
63
+ t.file.add #=> "Add file"
64
+ t.file.delete('Test') #=> "Delete file Test"
65
+ t.files(1) #=> "One file"
66
+ t.files(12) #=> "12 files"
67
+
68
+ l -12000.5 #=> "−12,000.5"
69
+ l Time.now #=> "08/09/2009 21:41"
70
+ l Time.now, :human #=> "now"
71
+ l Time.now, :full #=> "August 9th, 2009 21:41"
72
+
73
+ # Base translation
74
+ t.ok #=> "OK"
75
+ t.cancel #=> "Cancel"
76
+ ```
77
+
78
+ 7. You can print user locale or available locales:
79
+
80
+ ```ruby
81
+ "Your locale: " + r18n.locale.title
82
+ "Select another: " + r18n.available_locales.map { |i| i.title }.join(', ')
83
+ ```
84
+
85
+ ## License
86
+
87
+ R18n is licensed under the GNU Lesser General Public License version 3.
88
+ You can read it in LICENSE file or in http://www.gnu.org/licenses/lgpl.html.
89
+
90
+ ## Author
91
+
92
+ Andrey “A.I.” Sitnik <andrey@sitnik.ru>
data/Rakefile CHANGED
@@ -21,7 +21,8 @@ YARD::Rake::YardocTask.new do |yard|
21
21
  end
22
22
 
23
23
  task :clobber_doc do
24
- rm_r 'doc' rescue nil
24
+ rm_r 'doc' rescue nil
25
+ rm_r '.yardoc' rescue nil
25
26
  end
26
27
  task :clobber_package do
27
28
  rm_r 'pkg' rescue nil
@@ -26,6 +26,8 @@ if /cygwin|mingw|win32/ =~ RUBY_PLATFORM
26
26
  require dir.join('win32').to_s
27
27
  elsif /java/ =~ RUBY_PLATFORM
28
28
  require dir.join('java').to_s
29
+ elsif /darwin/ =~ RUBY_PLATFORM
30
+ require dir.join('osx').to_s
29
31
  else
30
32
  require dir.join('posix').to_s
31
33
  end
@@ -0,0 +1,27 @@
1
+ # encoding: utf-8
2
+ =begin
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
+ =end
20
+
21
+ module R18n
22
+ class I18n
23
+ def self.system_locale
24
+ %x(defaults read .GlobalPreferences AppleLanguages | tr -d [:space:] | cut -c2-3).chop
25
+ end
26
+ end
27
+ end
@@ -12,18 +12,17 @@ Gem::Specification.new do |s|
12
12
  It has nice Ruby-style syntax, filters, flexible locales, custom loaders,
13
13
  translation support for any classes, time and number localization, several
14
14
  user language support, agnostic core package with out-of-box support for
15
- Rails, Sinatra, Merb and desktop applications.
15
+ Rails, Sinatra and desktop applications.
16
16
  EOF
17
17
 
18
18
  s.files = `git ls-files`.split("\n")
19
19
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
20
- s.extra_rdoc_files = ['README.rdoc', 'LICENSE']
21
- s.require_path = 'lib'
20
+ s.extra_rdoc_files = ['README.md', 'LICENSE']
21
+ s.require_path = 'lib'
22
22
 
23
- s.author = 'Andrey "A.I." Sitnik'
24
- s.email = 'andrey@sitnik.ru'
25
- s.homepage = 'http://r18n.rubyforge.org/'
26
- s.rubyforge_project = 'r18n-desktop'
23
+ s.author = 'Andrey "A.I." Sitnik'
24
+ s.email = 'andrey@sitnik.ru'
25
+ s.homepage = 'https://github.com/ai/r18n/tree/master/r18n-desktop'
27
26
 
28
27
  s.add_dependency 'r18n-core', ["= #{R18n::VERSION}"]
29
28
 
@@ -33,4 +32,5 @@ Gem::Specification.new do |s|
33
32
  s.add_development_dependency "rspec-core", [">= 0"]
34
33
  s.add_development_dependency "rspec-expectations", [">= 0"]
35
34
  s.add_development_dependency "rspec-mocks", [">= 0"]
35
+ s.add_development_dependency "redcarpet", [">= 0"]
36
36
  end
@@ -23,7 +23,7 @@ describe "r18n-desktop" do
23
23
 
24
24
  it "should load i18n from system environment using specified order" do
25
25
  R18n.from_env(nil, 'en')
26
- r18n.locale.should == R18n::Locale.load('en')
26
+ r18n.locale.should == R18n.locale('en')
27
27
  R18n.get.should == r18n
28
28
  end
29
29
 
@@ -1,3 +1,4 @@
1
1
  # encoding: utf-8
2
- require 'rubygems'
2
+ require 'pp'
3
+
3
4
  require File.join(File.dirname(__FILE__), '../lib/r18n-desktop')
metadata CHANGED
@@ -1,189 +1,204 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: r18n-desktop
3
- version: !ruby/object:Gem::Version
4
- hash: 19
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
5
  prerelease:
6
- segments:
7
- - 0
8
- - 4
9
- - 14
10
- version: 0.4.14
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - Andrey "A.I." Sitnik
14
9
  autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
-
18
- date: 2012-01-25 00:00:00 Z
19
- dependencies:
20
- - !ruby/object:Gem::Dependency
21
- type: :runtime
12
+ date: 2012-06-24 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
22
15
  name: r18n-core
23
- version_requirements: &id001 !ruby/object:Gem::Requirement
24
- none: false
25
- requirements:
26
- - - "="
27
- - !ruby/object:Gem::Version
28
- hash: 19
29
- segments:
30
- - 0
31
- - 4
32
- - 14
33
- version: 0.4.14
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - '='
20
+ - !ruby/object:Gem::Version
21
+ version: 1.0.0
22
+ type: :runtime
34
23
  prerelease: false
35
- requirement: *id001
36
- - !ruby/object:Gem::Dependency
37
- type: :development
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - '='
28
+ - !ruby/object:Gem::Version
29
+ version: 1.0.0
30
+ - !ruby/object:Gem::Dependency
38
31
  name: bundler
39
- version_requirements: &id002 !ruby/object:Gem::Requirement
40
- none: false
41
- requirements:
42
- - - ">="
43
- - !ruby/object:Gem::Version
44
- hash: 3
45
- segments:
46
- - 1
47
- - 0
48
- - 10
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
49
37
  version: 1.0.10
50
- prerelease: false
51
- requirement: *id002
52
- - !ruby/object:Gem::Dependency
53
38
  type: :development
54
- name: yard
55
- version_requirements: &id003 !ruby/object:Gem::Requirement
56
- none: false
57
- requirements:
58
- - - ">="
59
- - !ruby/object:Gem::Version
60
- hash: 3
61
- segments:
62
- - 0
63
- version: "0"
64
39
  prerelease: false
65
- requirement: *id003
66
- - !ruby/object:Gem::Dependency
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: 1.0.10
46
+ - !ruby/object:Gem::Dependency
47
+ name: yard
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ! '>='
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
67
54
  type: :development
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ - !ruby/object:Gem::Dependency
68
63
  name: rake
69
- version_requirements: &id004 !ruby/object:Gem::Requirement
70
- none: false
71
- requirements:
72
- - - ">="
73
- - !ruby/object:Gem::Version
74
- hash: 3
75
- segments:
76
- - 0
77
- version: "0"
78
- - - "!="
79
- - !ruby/object:Gem::Version
80
- hash: 59
81
- segments:
82
- - 0
83
- - 9
84
- - 0
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ! '>='
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ - - ! '!='
71
+ - !ruby/object:Gem::Version
85
72
  version: 0.9.0
86
- prerelease: false
87
- requirement: *id004
88
- - !ruby/object:Gem::Dependency
89
73
  type: :development
90
- name: rspec-core
91
- version_requirements: &id005 !ruby/object:Gem::Requirement
92
- none: false
93
- requirements:
94
- - - ">="
95
- - !ruby/object:Gem::Version
96
- hash: 3
97
- segments:
98
- - 0
99
- version: "0"
100
74
  prerelease: false
101
- requirement: *id005
102
- - !ruby/object:Gem::Dependency
75
+ version_requirements: !ruby/object:Gem::Requirement
76
+ none: false
77
+ requirements:
78
+ - - ! '>='
79
+ - !ruby/object:Gem::Version
80
+ version: '0'
81
+ - - ! '!='
82
+ - !ruby/object:Gem::Version
83
+ version: 0.9.0
84
+ - !ruby/object:Gem::Dependency
85
+ name: rspec-core
86
+ requirement: !ruby/object:Gem::Requirement
87
+ none: false
88
+ requirements:
89
+ - - ! '>='
90
+ - !ruby/object:Gem::Version
91
+ version: '0'
103
92
  type: :development
104
- name: rspec-expectations
105
- version_requirements: &id006 !ruby/object:Gem::Requirement
106
- none: false
107
- requirements:
108
- - - ">="
109
- - !ruby/object:Gem::Version
110
- hash: 3
111
- segments:
112
- - 0
113
- version: "0"
114
93
  prerelease: false
115
- requirement: *id006
116
- - !ruby/object:Gem::Dependency
94
+ version_requirements: !ruby/object:Gem::Requirement
95
+ none: false
96
+ requirements:
97
+ - - ! '>='
98
+ - !ruby/object:Gem::Version
99
+ version: '0'
100
+ - !ruby/object:Gem::Dependency
101
+ name: rspec-expectations
102
+ requirement: !ruby/object:Gem::Requirement
103
+ none: false
104
+ requirements:
105
+ - - ! '>='
106
+ - !ruby/object:Gem::Version
107
+ version: '0'
117
108
  type: :development
109
+ prerelease: false
110
+ version_requirements: !ruby/object:Gem::Requirement
111
+ none: false
112
+ requirements:
113
+ - - ! '>='
114
+ - !ruby/object:Gem::Version
115
+ version: '0'
116
+ - !ruby/object:Gem::Dependency
118
117
  name: rspec-mocks
119
- version_requirements: &id007 !ruby/object:Gem::Requirement
120
- none: false
121
- requirements:
122
- - - ">="
123
- - !ruby/object:Gem::Version
124
- hash: 3
125
- segments:
126
- - 0
127
- version: "0"
118
+ requirement: !ruby/object:Gem::Requirement
119
+ none: false
120
+ requirements:
121
+ - - ! '>='
122
+ - !ruby/object:Gem::Version
123
+ version: '0'
124
+ type: :development
125
+ prerelease: false
126
+ version_requirements: !ruby/object:Gem::Requirement
127
+ none: false
128
+ requirements:
129
+ - - ! '>='
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ - !ruby/object:Gem::Dependency
133
+ name: redcarpet
134
+ requirement: !ruby/object:Gem::Requirement
135
+ none: false
136
+ requirements:
137
+ - - ! '>='
138
+ - !ruby/object:Gem::Version
139
+ version: '0'
140
+ type: :development
128
141
  prerelease: false
129
- requirement: *id007
130
- description: " A i18n tool to translate your desktop application in several languages.\n It is just a wrapper for R18n core library.\n It has nice Ruby-style syntax, filters, flexible locales, custom loaders,\n translation support for any classes, time and number localization, several\n user language support, agnostic core package with out-of-box support for\n Rails, Sinatra, Merb and desktop applications.\n"
142
+ version_requirements: !ruby/object:Gem::Requirement
143
+ none: false
144
+ requirements:
145
+ - - ! '>='
146
+ - !ruby/object:Gem::Version
147
+ version: '0'
148
+ description: ! " A i18n tool to translate your desktop application in several languages.\n
149
+ \ It is just a wrapper for R18n core library.\n It has nice Ruby-style syntax,
150
+ filters, flexible locales, custom loaders,\n translation support for any classes,
151
+ time and number localization, several\n user language support, agnostic core
152
+ package with out-of-box support for\n Rails, Sinatra and desktop applications.\n"
131
153
  email: andrey@sitnik.ru
132
154
  executables: []
133
-
134
155
  extensions: []
135
-
136
- extra_rdoc_files:
137
- - README.rdoc
156
+ extra_rdoc_files:
157
+ - README.md
138
158
  - LICENSE
139
- files:
159
+ files:
140
160
  - .rspec
141
161
  - .yardopts
142
- - Gemfile
143
- - Gemfile.lock
144
162
  - LICENSE
145
- - README.rdoc
163
+ - README.md
146
164
  - Rakefile
147
165
  - lib/r18n-desktop.rb
148
166
  - lib/r18n-desktop/java.rb
167
+ - lib/r18n-desktop/osx.rb
149
168
  - lib/r18n-desktop/posix.rb
150
169
  - lib/r18n-desktop/win32.rb
151
170
  - r18n-desktop.gemspec
152
171
  - spec/r18n-desktop_spec.rb
153
172
  - spec/spec_helper.rb
154
- homepage: http://r18n.rubyforge.org/
173
+ homepage: https://github.com/ai/r18n/tree/master/r18n-desktop
155
174
  licenses: []
156
-
157
175
  post_install_message:
158
176
  rdoc_options: []
159
-
160
- require_paths:
177
+ require_paths:
161
178
  - lib
162
- required_ruby_version: !ruby/object:Gem::Requirement
179
+ required_ruby_version: !ruby/object:Gem::Requirement
163
180
  none: false
164
- requirements:
165
- - - ">="
166
- - !ruby/object:Gem::Version
167
- hash: 3
168
- segments:
181
+ requirements:
182
+ - - ! '>='
183
+ - !ruby/object:Gem::Version
184
+ version: '0'
185
+ segments:
169
186
  - 0
170
- version: "0"
171
- required_rubygems_version: !ruby/object:Gem::Requirement
187
+ hash: -2038291380859406366
188
+ required_rubygems_version: !ruby/object:Gem::Requirement
172
189
  none: false
173
- requirements:
174
- - - ">="
175
- - !ruby/object:Gem::Version
176
- hash: 3
177
- segments:
190
+ requirements:
191
+ - - ! '>='
192
+ - !ruby/object:Gem::Version
193
+ version: '0'
194
+ segments:
178
195
  - 0
179
- version: "0"
196
+ hash: -2038291380859406366
180
197
  requirements: []
181
-
182
- rubyforge_project: r18n-desktop
183
- rubygems_version: 1.7.2
198
+ rubyforge_project:
199
+ rubygems_version: 1.8.23
184
200
  signing_key:
185
201
  specification_version: 3
186
202
  summary: A i18n tool to translate your Ruby desktop application.
187
203
  test_files: []
188
-
189
204
  has_rdoc:
data/Gemfile DELETED
@@ -1,7 +0,0 @@
1
- source :rubygems
2
-
3
- gem 'psych', :platforms => :mri_19, :group => [ :test, :development ]
4
-
5
- gem 'r18n-core', :path => '../r18n-core/'
6
-
7
- gemspec
@@ -1,36 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- r18n-desktop (0.4.14)
5
- r18n-core (= 0.4.14)
6
-
7
- PATH
8
- remote: ../r18n-core/
9
- specs:
10
- r18n-core (0.4.14)
11
-
12
- GEM
13
- remote: http://rubygems.org/
14
- specs:
15
- diff-lcs (1.1.3)
16
- psych (1.2.2)
17
- rake (0.9.2.2)
18
- rspec-core (2.8.0)
19
- rspec-expectations (2.8.0)
20
- diff-lcs (~> 1.1.2)
21
- rspec-mocks (2.8.0)
22
- yard (0.7.4)
23
-
24
- PLATFORMS
25
- ruby
26
-
27
- DEPENDENCIES
28
- bundler (>= 1.0.10)
29
- psych
30
- r18n-core!
31
- r18n-desktop!
32
- rake (>= 0, != 0.9.0)
33
- rspec-core
34
- rspec-expectations
35
- rspec-mocks
36
- yard
@@ -1,78 +0,0 @@
1
- = R18n Desktop
2
-
3
- A tool to translate your desktop application to several languages.
4
-
5
- It is just a wrapper for R18n core library. See R18n documentation for more
6
- information.
7
-
8
- == Features
9
-
10
- * Nice Ruby-style syntax.
11
- * Filters.
12
- * Flexible locales.
13
- * Custom translations loaders.
14
- * Translation support for any classes.
15
- * Time and number localization.
16
- * Several user languages support.
17
-
18
- == How To
19
-
20
- 1. Create translations dir. For example: <tt>./i18n/</tt>.
21
- 2. Add file with translation to <tt>./i18n/</tt> with language code in file name
22
- (for example, <tt>en.yml</tt> for English or <tt>en-us.yml</tt> USA English
23
- dialect). For example, <tt>./i18n/en.yml</tt>:
24
-
25
- file:
26
- add: Add file
27
- delete: Delete file %1
28
-
29
- files: !!pl
30
- 0: No files
31
- 1: One file
32
- n: %1 files
33
-
34
- 3. Add R18n to your application:
35
-
36
- require 'r18n-desktop'
37
-
38
- 4. Load I18n object:
39
-
40
- R18n.from_env 'i18n/'
41
-
42
- User can set the locale manually:
43
-
44
- R18n.from_env 'i18n/', manual_locale
45
-
46
- 5. Include mixin to use helpers:
47
-
48
- include R18n::Helpers
49
-
50
- 6. Use translation messages to user. For example:
51
-
52
- t.file.add #=> "Add file"
53
- t.file.delete('Test') #=> "Delete file Test"
54
- t.files(1) #=> "One file"
55
- t.files(12) #=> "12 files"
56
-
57
- l -12000.5 #=> "−12,000.5"
58
- l Time.now #=> "08/09/2009 21:41"
59
- l Time.now, :human #=> "now"
60
- l Time.now, :full #=> "August 9th, 2009 21:41"
61
-
62
- # Base translation
63
- t.ok #=> "OK"
64
- t.cancel #=> "Cancel"
65
-
66
- 7. You can print user locale or available locales:
67
-
68
- "Your locale: " + r18n.locale.title
69
- "Select another: " + r18n.available_locales.map { |i| i.title }.join(', ')
70
-
71
- == License
72
-
73
- R18n is licensed under the GNU Lesser General Public License version 3.
74
- You can read it in LICENSE file or in http://www.gnu.org/licenses/lgpl.html.
75
-
76
- == Author
77
-
78
- Andrey “A.I.” Sitnik <andrey@sitnik.ru>