r18n-core 0.4.9 → 0.4.10
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/.rspec +1 -0
- data/ChangeLog +8 -0
- data/Gemfile +5 -0
- data/Gemfile.lock +42 -0
- data/README.rdoc +4 -4
- data/Rakefile +51 -0
- data/base/nl.yml +31 -0
- data/base/{pt_br.yml → pt.yml} +0 -0
- data/base/sv-se.yml +31 -0
- data/lib/r18n-core.rb +15 -3
- data/lib/r18n-core/filters.rb +1 -0
- data/lib/r18n-core/helpers.rb +1 -1
- data/lib/r18n-core/translated.rb +1 -1
- data/lib/r18n-core/version.rb +1 -1
- data/lib/r18n-core/yaml_loader.rb +1 -1
- data/locales/nl.rb +20 -0
- data/locales/pt-br.rb +5 -19
- data/locales/pt.rb +24 -0
- data/locales/sv-se.rb +22 -0
- data/r18n-core.gemspec +37 -0
- data/spec/filters_spec.rb +4 -0
- data/spec/r18n_spec.rb +14 -1
- data/spec/spec_helper.rb +4 -4
- data/spec/translated_spec.rb +4 -4
- data/spec/translations/empty/en.yml +0 -0
- data/spec/translations/extension/en.yml +0 -1
- data/spec/yaml_loader_spec.rb +8 -0
- metadata +212 -91
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--format documentation --colour
|
data/ChangeLog
CHANGED
@@ -1,3 +1,11 @@
|
|
1
|
+
== 0.4.10 (Kvantum)
|
2
|
+
* Add R18n.set(locales, places), R18n.t and R18n.l shortcuts.
|
3
|
+
* Convert float to number on pluralization.
|
4
|
+
* Fix loading empty translation file.
|
5
|
+
* Add Portuguese locale.
|
6
|
+
* Add Dutch locale (by Sander Heilbron).
|
7
|
+
* Add Swedish locale (by Magnus Hörberg).
|
8
|
+
|
1
9
|
== 0.4.9 (Kazan)
|
2
10
|
* Add support for Psych YAML parser (thanks for Ravil Bayramgalin).
|
3
11
|
* Fix ActiveRecord support in Translated.
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,42 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
r18n-core (0.4.10)
|
5
|
+
|
6
|
+
GEM
|
7
|
+
remote: http://rubygems.org/
|
8
|
+
specs:
|
9
|
+
RedCloth (4.2.7)
|
10
|
+
diff-lcs (1.1.2)
|
11
|
+
haml (2.2.24)
|
12
|
+
hanna (0.1.12)
|
13
|
+
haml (~> 2.2.8)
|
14
|
+
rake (~> 0.8.2)
|
15
|
+
rdoc (~> 2.3.0)
|
16
|
+
maruku (0.6.0)
|
17
|
+
syntax (>= 1.0.0)
|
18
|
+
psych (1.2.0)
|
19
|
+
rake (0.8.7)
|
20
|
+
rcov (0.9.9)
|
21
|
+
rdoc (2.3.0)
|
22
|
+
rspec-core (2.5.1)
|
23
|
+
rspec-expectations (2.5.0)
|
24
|
+
diff-lcs (~> 1.1.2)
|
25
|
+
rspec-mocks (2.5.0)
|
26
|
+
syntax (1.0.0)
|
27
|
+
|
28
|
+
PLATFORMS
|
29
|
+
ruby
|
30
|
+
|
31
|
+
DEPENDENCIES
|
32
|
+
RedCloth
|
33
|
+
bundler (>= 1.0.10)
|
34
|
+
hanna
|
35
|
+
maruku
|
36
|
+
psych
|
37
|
+
r18n-core!
|
38
|
+
rake (>= 0, != 0.9.0)
|
39
|
+
rcov
|
40
|
+
rspec-core
|
41
|
+
rspec-expectations
|
42
|
+
rspec-mocks
|
data/README.rdoc
CHANGED
@@ -86,7 +86,7 @@ need to create loader object with 2 methods: +available+ and +load+:
|
|
86
86
|
end
|
87
87
|
end
|
88
88
|
|
89
|
-
R18n.set
|
89
|
+
R18n.set(user_locales, DBLoader.new)
|
90
90
|
|
91
91
|
You can also set a list of different translation locations or set extension
|
92
92
|
locations which will be only used with application translation (useful for
|
@@ -152,7 +152,7 @@ If you develop you own plugin or want to use only core gem, you will need to
|
|
152
152
|
create an I18n object and by using <tt>R18n.set</tt> or, for the current thread,
|
153
153
|
by using <tt>R18n.thread_set</tt>:
|
154
154
|
|
155
|
-
R18n.set(
|
155
|
+
R18n.set('en', 'path/to/translations')
|
156
156
|
|
157
157
|
You can add helpers to access the current R18n object:
|
158
158
|
|
@@ -425,13 +425,13 @@ translation you must create loader class with 2 methods:
|
|
425
425
|
|
426
426
|
Pass its instance to <tt>R18n::I18n.new</tt>:
|
427
427
|
|
428
|
-
R18n.set
|
428
|
+
R18n.set('en', MyLoader.new(loader_param))
|
429
429
|
|
430
430
|
You can set your default loader and pass it to <tt>R18n::I18n.new</tt> as the
|
431
431
|
only constructor argument:
|
432
432
|
|
433
433
|
R18n.default_loader = MyLoader
|
434
|
-
R18n.set
|
434
|
+
R18n.set('en', loader_param)
|
435
435
|
|
436
436
|
If you want to load a translation with some type for filter, use
|
437
437
|
<tt>R18n::Typed</tt> struct:
|
data/Rakefile
ADDED
@@ -0,0 +1,51 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
|
5
|
+
begin
|
6
|
+
require 'bundler'
|
7
|
+
require 'bundler/setup'
|
8
|
+
Bundler::GemHelper.install_tasks
|
9
|
+
rescue LoadError
|
10
|
+
puts "Bundler not available. Install it with: gem install bundler"
|
11
|
+
end
|
12
|
+
|
13
|
+
begin
|
14
|
+
require 'hanna/rdoctask'
|
15
|
+
rescue LoadError
|
16
|
+
require 'rake/rdoctask'
|
17
|
+
end
|
18
|
+
|
19
|
+
PKG_NAME = 'r18n-core'.freeze
|
20
|
+
require File.join(File.dirname(__FILE__), 'lib/r18n-core/version')
|
21
|
+
|
22
|
+
require 'rspec/core/rake_task'
|
23
|
+
|
24
|
+
RSpec::Core::RakeTask.new
|
25
|
+
|
26
|
+
task :spec_syck do
|
27
|
+
ENV['test_syck'] = '1'
|
28
|
+
sh "#{RUBY} -S rake spec", :verbose => false
|
29
|
+
end
|
30
|
+
|
31
|
+
RSpec::Core::RakeTask.new('rcov') do |t|
|
32
|
+
t.rcov = true
|
33
|
+
t.ruby_opts = '-w'
|
34
|
+
t.rcov_opts = ['--text-summary', '--charset UTF-8', '-x gem']
|
35
|
+
end
|
36
|
+
|
37
|
+
Rake::RDocTask.new do |rdoc|
|
38
|
+
rdoc.main = 'README.rdoc'
|
39
|
+
rdoc.rdoc_files.include('README.rdoc', 'LICENSE', 'ChangeLog', 'lib/**/*.rb')
|
40
|
+
rdoc.title = "R18n #{R18n::VERSION} Documentation"
|
41
|
+
rdoc.rdoc_dir = 'doc'
|
42
|
+
rdoc.options << '-c utf-8'
|
43
|
+
rdoc.options << '--all'
|
44
|
+
end
|
45
|
+
|
46
|
+
task :clobber_package do
|
47
|
+
rm_r 'pkg' rescue nil
|
48
|
+
end
|
49
|
+
task :clobber => [:clobber_package]
|
50
|
+
|
51
|
+
task :default => :spec
|
data/base/nl.yml
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
ok: 'OK'
|
2
|
+
save: 'Opslaan'
|
3
|
+
cancel: 'Annuleren'
|
4
|
+
'yes': 'Ja'
|
5
|
+
'no': 'Nee'
|
6
|
+
exit: 'Uitgang'
|
7
|
+
delete: 'Verwijderen'
|
8
|
+
|
9
|
+
human_time:
|
10
|
+
after_days: !!pl
|
11
|
+
1: 'na %1 dag'
|
12
|
+
n: 'na %1 dagen'
|
13
|
+
tomorrow: 'morgen'
|
14
|
+
after_hours: !!pl
|
15
|
+
1: 'na %1 uur'
|
16
|
+
n: 'na %1 uur'
|
17
|
+
after_minutes: !!pl
|
18
|
+
1: 'na %1 minuut'
|
19
|
+
n: 'na %1 minuten'
|
20
|
+
now: 'nu'
|
21
|
+
today: 'vandaag'
|
22
|
+
minutes_ago: !!pl
|
23
|
+
1: '%1 minuut geleden'
|
24
|
+
n: '%1 minuten geleden'
|
25
|
+
hours_ago: !!pl
|
26
|
+
1: '%1 uur geleden'
|
27
|
+
n: '%1 uur geleden'
|
28
|
+
yesterday: 'gisteren'
|
29
|
+
days_ago: !!pl
|
30
|
+
1: '%1 dag geleden'
|
31
|
+
n: '%1 dagen geleden'
|
data/base/{pt_br.yml → pt.yml}
RENAMED
File without changes
|
data/base/sv-se.yml
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
ok: 'OK'
|
2
|
+
save: 'Spara'
|
3
|
+
cancel: 'Avbryt'
|
4
|
+
'yes': 'Ja'
|
5
|
+
'no': 'Nej'
|
6
|
+
exit: 'Avsluta'
|
7
|
+
delete: 'Släng'
|
8
|
+
|
9
|
+
human_time:
|
10
|
+
after_days: !!pl
|
11
|
+
1: 'efter %1 dag'
|
12
|
+
n: 'efter %1 dagar'
|
13
|
+
tomorrow: 'imorgon'
|
14
|
+
after_hours: !!pl
|
15
|
+
1: 'efter %1 timme'
|
16
|
+
n: 'efter %1 timmar'
|
17
|
+
after_minutes: !!pl
|
18
|
+
1: 'efter %1 minut'
|
19
|
+
n: 'efter %1 minuter'
|
20
|
+
now: 'nu'
|
21
|
+
today: 'i dag'
|
22
|
+
minutes_ago: !!pl
|
23
|
+
1: '%1 minut sen'
|
24
|
+
n: '%1 minuter sen'
|
25
|
+
hours_ago: !!pl
|
26
|
+
1: '%1 timme sen'
|
27
|
+
n: '%1 timmar sen'
|
28
|
+
yesterday: 'i går'
|
29
|
+
days_ago: !!pl
|
30
|
+
1: '%1 dag sen'
|
31
|
+
n: '%1 dagar sen'
|
data/lib/r18n-core.rb
CHANGED
@@ -37,14 +37,16 @@ require dir + 'helpers'
|
|
37
37
|
|
38
38
|
module R18n
|
39
39
|
class << self
|
40
|
-
|
40
|
+
|
41
41
|
# Set I18n object globally.
|
42
|
-
def set(i18n = nil, &block)
|
42
|
+
def set(i18n = nil, dir = nil, &block)
|
43
43
|
if block_given?
|
44
44
|
@setter = block
|
45
45
|
@i18n = nil
|
46
|
-
|
46
|
+
elsif i18n.is_a? I18n
|
47
47
|
@i18n = i18n
|
48
|
+
else
|
49
|
+
@i18n = I18n.new(i18n, dir)
|
48
50
|
end
|
49
51
|
end
|
50
52
|
|
@@ -74,6 +76,16 @@ module R18n
|
|
74
76
|
def thread
|
75
77
|
Thread.current
|
76
78
|
end
|
79
|
+
|
80
|
+
# Translate message. Alias for <tt>R18n.get.t</tt>.
|
81
|
+
def t(*params)
|
82
|
+
get.t(*params)
|
83
|
+
end
|
84
|
+
|
85
|
+
# Localize object. Alias for <tt>R18n.get.l</tt>.
|
86
|
+
def l(*params)
|
87
|
+
get.l(*params)
|
88
|
+
end
|
77
89
|
|
78
90
|
# Default loader class, which will be used if you didn’t send loader to
|
79
91
|
# +I18n.new+ (object with +available+ and +load+ methods).
|
data/lib/r18n-core/filters.rb
CHANGED
data/lib/r18n-core/helpers.rb
CHANGED
data/lib/r18n-core/translated.rb
CHANGED
data/lib/r18n-core/version.rb
CHANGED
@@ -69,7 +69,7 @@ module R18n
|
|
69
69
|
|
70
70
|
translations = {}
|
71
71
|
Dir.glob(File.join(@dir, "**/#{locale.code.downcase}.yml")).each do |file_name|
|
72
|
-
Utils.deep_merge!(translations, ::YAML::load_file(file_name))
|
72
|
+
Utils.deep_merge!(translations, ::YAML::load_file(file_name) || {})
|
73
73
|
end
|
74
74
|
transform(translations)
|
75
75
|
end
|
data/locales/nl.rb
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
module R18n
|
3
|
+
class Locales::Nl < Locale
|
4
|
+
set :title => 'Nederlands',
|
5
|
+
|
6
|
+
:wday_names => %w{zondag maandag dinsdag woensdag donderdag vrijdag zaterdag},
|
7
|
+
:wday_abbrs => %w{zo ma di wo do vr za},
|
8
|
+
|
9
|
+
:month_names => %w{januari februari maart april mei juni juli augustus september oktober november december},
|
10
|
+
:month_abbrs => %w{jan feb mrt apr mei jun jul aug sep okt nov dec},
|
11
|
+
|
12
|
+
:time_am => '\'s ochtends',
|
13
|
+
:time_pm => '\'s middags',
|
14
|
+
:date_format => '%d-%m-%Y',
|
15
|
+
:full_format => '%e %B',
|
16
|
+
|
17
|
+
:number_decimal => ",",
|
18
|
+
:number_group => "."
|
19
|
+
end
|
20
|
+
end
|
data/locales/pt-br.rb
CHANGED
@@ -1,24 +1,10 @@
|
|
1
1
|
# encoding: utf-8
|
2
|
-
|
3
|
-
|
2
|
+
require File.join(File.dirname(__FILE__), 'pt')
|
3
|
+
|
4
|
+
module R18n::Locales
|
5
|
+
class PtBr < Pt
|
4
6
|
set :title => 'Português brasileiro',
|
5
7
|
:code => 'pt-BR',
|
6
|
-
|
7
|
-
:wday_names => %w{domingo segunda-feira terça-feira quarta-feira
|
8
|
-
quinta-feira sexta-feira sábado},
|
9
|
-
:wday_abbrs => %w{dom seg ter qua qui sex sab},
|
10
|
-
|
11
|
-
:month_names => %w{janeiro fevereiro março abril maio junho julho agosto
|
12
|
-
setembro outubro novembro dezembro},
|
13
|
-
:month_abbrs => %w{jan fev mar abr mai jun jul ago set out nov dez},
|
14
|
-
:month_standalone => %w{Janeiro Fevereiro Março Abril Maio Junho Julho
|
15
|
-
Agosto Setembro Outubro Novembro Dezembro},
|
16
|
-
|
17
|
-
:date_format => '%d/%m/%Y',
|
18
|
-
:full_format => '%d de %B',
|
19
|
-
:year_format => '_ de %Y',
|
20
|
-
|
21
|
-
:number_decimal => ",",
|
22
|
-
:number_group => "."
|
8
|
+
:sublocales => %w{pt en}
|
23
9
|
end
|
24
10
|
end
|
data/locales/pt.rb
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
module R18n
|
3
|
+
class Locales::Pt < R18n::Locale
|
4
|
+
set :title => 'Português',
|
5
|
+
:code => 'pt',
|
6
|
+
|
7
|
+
:wday_names => %w{domingo segunda-feira terça-feira quarta-feira
|
8
|
+
quinta-feira sexta-feira sábado},
|
9
|
+
:wday_abbrs => %w{dom seg ter qua qui sex sab},
|
10
|
+
|
11
|
+
:month_names => %w{janeiro fevereiro março abril maio junho julho agosto
|
12
|
+
setembro outubro novembro dezembro},
|
13
|
+
:month_abbrs => %w{jan fev mar abr mai jun jul ago set out nov dez},
|
14
|
+
:month_standalone => %w{Janeiro Fevereiro Março Abril Maio Junho Julho
|
15
|
+
Agosto Setembro Outubro Novembro Dezembro},
|
16
|
+
|
17
|
+
:date_format => '%d/%m/%Y',
|
18
|
+
:full_format => '%d de %B',
|
19
|
+
:year_format => '_ de %Y',
|
20
|
+
|
21
|
+
:number_decimal => ",",
|
22
|
+
:number_group => "."
|
23
|
+
end
|
24
|
+
end
|
data/locales/sv-se.rb
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
#encoding: utf-8
|
2
|
+
module R18n
|
3
|
+
class Locales::SvSe < Locale
|
4
|
+
set :title => 'Svenska',
|
5
|
+
:code => 'sv-SE',
|
6
|
+
:sublocales => %w{sv},
|
7
|
+
|
8
|
+
:wday_names => %w{söndag måndag tisdag onsdag torsdag fredag
|
9
|
+
lördag},
|
10
|
+
:wday_abbrs => %w{sön mån tis ons tor fre lör},
|
11
|
+
|
12
|
+
:month_names => %w{januari februari mars april maj juni juli augusti
|
13
|
+
september october november december},
|
14
|
+
:month_abbrs => %w{jan feb mar apr maj jun jul aug okt nov dec},
|
15
|
+
|
16
|
+
:date_format => '%Y-%m-%d',
|
17
|
+
:full_format => '%e %B %Y',
|
18
|
+
|
19
|
+
:number_decimal => ",",
|
20
|
+
:number_group => "."
|
21
|
+
end
|
22
|
+
end
|
data/r18n-core.gemspec
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
require '../r18n-core/lib/r18n-core/version'
|
2
|
+
|
3
|
+
Gem::Specification.new do |s|
|
4
|
+
s.platform = Gem::Platform::RUBY
|
5
|
+
s.name = 'r18n-core'
|
6
|
+
s.version = R18n::VERSION.dup
|
7
|
+
s.date = Time.now.strftime('%Y-%m-%d')
|
8
|
+
s.summary = 'I18n tool to translate your Ruby application.'
|
9
|
+
s.description = <<-EOF
|
10
|
+
R18n is a i18n tool to translate your Ruby application.
|
11
|
+
It has nice Ruby-style syntax, filters, flexible locales, custom loaders,
|
12
|
+
translation support for any classes, time and number localization, several
|
13
|
+
user language support, agnostic core package with out-of-box support for
|
14
|
+
Rails, Sinatra, Merb and desktop applications.
|
15
|
+
EOF
|
16
|
+
|
17
|
+
s.files = `git ls-files`.split("\n")
|
18
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
19
|
+
s.extra_rdoc_files = ['README.rdoc', 'LICENSE', 'ChangeLog']
|
20
|
+
s.require_path = 'lib'
|
21
|
+
s.has_rdoc = true
|
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-core'
|
27
|
+
|
28
|
+
s.add_development_dependency "bundler", [">= 1.0.10"]
|
29
|
+
s.add_development_dependency "hanna", [">= 0"]
|
30
|
+
s.add_development_dependency "rake", [">= 0", "!= 0.9.0"]
|
31
|
+
s.add_development_dependency "rspec-core", [">= 0"]
|
32
|
+
s.add_development_dependency "rspec-expectations", [">= 0"]
|
33
|
+
s.add_development_dependency "rspec-mocks", [">= 0"]
|
34
|
+
s.add_development_dependency "rcov", [">= 0"]
|
35
|
+
s.add_development_dependency "maruku", [">= 0"]
|
36
|
+
s.add_development_dependency "RedCloth", [">= 0"]
|
37
|
+
end
|
data/spec/filters_spec.rb
CHANGED
@@ -156,6 +156,10 @@ describe R18n::Filters do
|
|
156
156
|
@i18n.files.should == { 1 => '1 file', 'n' => '%1 files' }
|
157
157
|
@i18n.files('').should == { 1 => '1 file', 'n' => '%1 files' }
|
158
158
|
end
|
159
|
+
|
160
|
+
it "should convert first float parameter to number" do
|
161
|
+
@i18n.files(1.2).should == '1 file'
|
162
|
+
end
|
159
163
|
|
160
164
|
it "should pluralize translation without locale" do
|
161
165
|
i18n = R18n::I18n.new('no-LC', DIR)
|
data/spec/r18n_spec.rb
CHANGED
@@ -27,6 +27,13 @@ describe R18n do
|
|
27
27
|
|
28
28
|
R18n.get.should == i18n
|
29
29
|
end
|
30
|
+
|
31
|
+
it "shuld create I18n object by shortcut" do
|
32
|
+
R18n.set('en', DIR)
|
33
|
+
R18n.get.should be_a(R18n::I18n)
|
34
|
+
R18n.get.locales.should == [R18n::Locale.load('en')]
|
35
|
+
R18n.get.translation_places.should == [R18n::Loader::YAML.new(DIR)]
|
36
|
+
end
|
30
37
|
|
31
38
|
it "should store I18n via thread_set" do
|
32
39
|
i18n = R18n::I18n.new('en')
|
@@ -94,7 +101,13 @@ describe R18n do
|
|
94
101
|
:c => 2 }
|
95
102
|
end
|
96
103
|
|
97
|
-
it "should have
|
104
|
+
it "should have l and t methods" do
|
105
|
+
R18n.set('en')
|
106
|
+
t.yes.should == 'Yes'
|
107
|
+
l(Time.at(0).utc).should == '01/01/1970 00:00'
|
108
|
+
end
|
109
|
+
|
110
|
+
it "should have helpers mixin" do
|
98
111
|
obj = R18n::I18n.new 'en'
|
99
112
|
R18n.set(obj)
|
100
113
|
|
data/spec/spec_helper.rb
CHANGED
@@ -9,10 +9,10 @@ Pathname.glob(dir.join('../locales/*.rb').to_s) { |locale| require locale }
|
|
9
9
|
|
10
10
|
TRANSLATIONS = dir + 'translations' unless defined? TRANSLATIONS
|
11
11
|
DIR = TRANSLATIONS + 'general' unless defined? DIR
|
12
|
-
TWO = TRANSLATIONS + 'two'
|
12
|
+
TWO = TRANSLATIONS + 'two' unless defined? TWO
|
13
13
|
EXT = R18n::Loader::YAML.new(TRANSLATIONS + 'extension') unless defined? EXT
|
14
14
|
|
15
|
-
|
15
|
+
RSpec.configure do |config|
|
16
16
|
config.before { R18n.cache.clear }
|
17
17
|
end
|
18
18
|
|
@@ -38,6 +38,6 @@ class CounterLoader
|
|
38
38
|
end
|
39
39
|
end
|
40
40
|
|
41
|
-
if
|
42
|
-
YAML::ENGINE.yamler = 'psych'
|
41
|
+
if '1.8.' != RUBY_VERSION[0..3]
|
42
|
+
YAML::ENGINE.yamler = ENV['test_syck'] ? 'syck' : 'psych'
|
43
43
|
end
|
data/spec/translated_spec.rb
CHANGED
@@ -11,7 +11,7 @@ describe R18n::Translated do
|
|
11
11
|
def name_ru?; end
|
12
12
|
def name_ru!; end
|
13
13
|
end
|
14
|
-
R18n.set(
|
14
|
+
R18n.set('en')
|
15
15
|
end
|
16
16
|
|
17
17
|
it "should save methods map" do
|
@@ -36,7 +36,7 @@ describe R18n::Translated do
|
|
36
36
|
user.name = 'John'
|
37
37
|
user.name.should == 'John'
|
38
38
|
|
39
|
-
R18n.set(
|
39
|
+
R18n.set('ru')
|
40
40
|
user.name.should == 'John'
|
41
41
|
user.name = 'Джон'
|
42
42
|
user.name.should == 'Джон'
|
@@ -59,7 +59,7 @@ describe R18n::Translated do
|
|
59
59
|
@user_class.translation :name
|
60
60
|
user = @user_class.new
|
61
61
|
|
62
|
-
R18n.set(
|
62
|
+
R18n.set(['no-LC', 'ru', 'en'])
|
63
63
|
user.name_ru = 'Иван'
|
64
64
|
user.name.locale.should == R18n::Locale.load('ru')
|
65
65
|
end
|
@@ -68,7 +68,7 @@ describe R18n::Translated do
|
|
68
68
|
@user_class.translation :name
|
69
69
|
user = @user_class.new
|
70
70
|
|
71
|
-
R18n.set(
|
71
|
+
R18n.set('no-LC')
|
72
72
|
user.name_en = 'John'
|
73
73
|
user.name.locale.should == R18n::Locale.load('en')
|
74
74
|
end
|
File without changes
|
data/spec/yaml_loader_spec.rb
CHANGED
@@ -2,6 +2,14 @@
|
|
2
2
|
require File.expand_path('../spec_helper', __FILE__)
|
3
3
|
|
4
4
|
describe R18n::Loader::YAML do
|
5
|
+
before :all do
|
6
|
+
R18n::Filters.add('my', :my) { |i| i }
|
7
|
+
end
|
8
|
+
|
9
|
+
after :all do
|
10
|
+
R18n::Filters.delete(:my)
|
11
|
+
end
|
12
|
+
|
5
13
|
before do
|
6
14
|
@loader = R18n::Loader::YAML.new(DIR)
|
7
15
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: r18n-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 27
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 4
|
9
|
-
-
|
10
|
-
version: 0.4.
|
9
|
+
- 10
|
10
|
+
version: 0.4.10
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Andrey "A.I." Sitnik
|
@@ -15,10 +15,145 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-
|
18
|
+
date: 2011-07-08 00:00:00 +04:00
|
19
19
|
default_executable:
|
20
|
-
dependencies:
|
21
|
-
|
20
|
+
dependencies:
|
21
|
+
- !ruby/object:Gem::Dependency
|
22
|
+
prerelease: false
|
23
|
+
version_requirements: &id001 !ruby/object:Gem::Requirement
|
24
|
+
none: false
|
25
|
+
requirements:
|
26
|
+
- - ">="
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
hash: 3
|
29
|
+
segments:
|
30
|
+
- 1
|
31
|
+
- 0
|
32
|
+
- 10
|
33
|
+
version: 1.0.10
|
34
|
+
requirement: *id001
|
35
|
+
type: :development
|
36
|
+
name: bundler
|
37
|
+
- !ruby/object:Gem::Dependency
|
38
|
+
prerelease: false
|
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
|
+
- 0
|
47
|
+
version: "0"
|
48
|
+
requirement: *id002
|
49
|
+
type: :development
|
50
|
+
name: hanna
|
51
|
+
- !ruby/object:Gem::Dependency
|
52
|
+
prerelease: false
|
53
|
+
version_requirements: &id003 !ruby/object:Gem::Requirement
|
54
|
+
none: false
|
55
|
+
requirements:
|
56
|
+
- - ">="
|
57
|
+
- !ruby/object:Gem::Version
|
58
|
+
hash: 3
|
59
|
+
segments:
|
60
|
+
- 0
|
61
|
+
version: "0"
|
62
|
+
- - "!="
|
63
|
+
- !ruby/object:Gem::Version
|
64
|
+
hash: 59
|
65
|
+
segments:
|
66
|
+
- 0
|
67
|
+
- 9
|
68
|
+
- 0
|
69
|
+
version: 0.9.0
|
70
|
+
requirement: *id003
|
71
|
+
type: :development
|
72
|
+
name: rake
|
73
|
+
- !ruby/object:Gem::Dependency
|
74
|
+
prerelease: false
|
75
|
+
version_requirements: &id004 !ruby/object:Gem::Requirement
|
76
|
+
none: false
|
77
|
+
requirements:
|
78
|
+
- - ">="
|
79
|
+
- !ruby/object:Gem::Version
|
80
|
+
hash: 3
|
81
|
+
segments:
|
82
|
+
- 0
|
83
|
+
version: "0"
|
84
|
+
requirement: *id004
|
85
|
+
type: :development
|
86
|
+
name: rspec-core
|
87
|
+
- !ruby/object:Gem::Dependency
|
88
|
+
prerelease: false
|
89
|
+
version_requirements: &id005 !ruby/object:Gem::Requirement
|
90
|
+
none: false
|
91
|
+
requirements:
|
92
|
+
- - ">="
|
93
|
+
- !ruby/object:Gem::Version
|
94
|
+
hash: 3
|
95
|
+
segments:
|
96
|
+
- 0
|
97
|
+
version: "0"
|
98
|
+
requirement: *id005
|
99
|
+
type: :development
|
100
|
+
name: rspec-expectations
|
101
|
+
- !ruby/object:Gem::Dependency
|
102
|
+
prerelease: false
|
103
|
+
version_requirements: &id006 !ruby/object:Gem::Requirement
|
104
|
+
none: false
|
105
|
+
requirements:
|
106
|
+
- - ">="
|
107
|
+
- !ruby/object:Gem::Version
|
108
|
+
hash: 3
|
109
|
+
segments:
|
110
|
+
- 0
|
111
|
+
version: "0"
|
112
|
+
requirement: *id006
|
113
|
+
type: :development
|
114
|
+
name: rspec-mocks
|
115
|
+
- !ruby/object:Gem::Dependency
|
116
|
+
prerelease: false
|
117
|
+
version_requirements: &id007 !ruby/object:Gem::Requirement
|
118
|
+
none: false
|
119
|
+
requirements:
|
120
|
+
- - ">="
|
121
|
+
- !ruby/object:Gem::Version
|
122
|
+
hash: 3
|
123
|
+
segments:
|
124
|
+
- 0
|
125
|
+
version: "0"
|
126
|
+
requirement: *id007
|
127
|
+
type: :development
|
128
|
+
name: rcov
|
129
|
+
- !ruby/object:Gem::Dependency
|
130
|
+
prerelease: false
|
131
|
+
version_requirements: &id008 !ruby/object:Gem::Requirement
|
132
|
+
none: false
|
133
|
+
requirements:
|
134
|
+
- - ">="
|
135
|
+
- !ruby/object:Gem::Version
|
136
|
+
hash: 3
|
137
|
+
segments:
|
138
|
+
- 0
|
139
|
+
version: "0"
|
140
|
+
requirement: *id008
|
141
|
+
type: :development
|
142
|
+
name: maruku
|
143
|
+
- !ruby/object:Gem::Dependency
|
144
|
+
prerelease: false
|
145
|
+
version_requirements: &id009 !ruby/object:Gem::Requirement
|
146
|
+
none: false
|
147
|
+
requirements:
|
148
|
+
- - ">="
|
149
|
+
- !ruby/object:Gem::Version
|
150
|
+
hash: 3
|
151
|
+
segments:
|
152
|
+
- 0
|
153
|
+
version: "0"
|
154
|
+
requirement: *id009
|
155
|
+
type: :development
|
156
|
+
name: RedCloth
|
22
157
|
description: " R18n is a i18n tool to translate your Ruby application.\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"
|
23
158
|
email: andrey@sitnik.ru
|
24
159
|
executables: []
|
@@ -30,93 +165,104 @@ extra_rdoc_files:
|
|
30
165
|
- LICENSE
|
31
166
|
- ChangeLog
|
32
167
|
files:
|
33
|
-
-
|
34
|
-
-
|
35
|
-
-
|
36
|
-
-
|
37
|
-
-
|
38
|
-
-
|
39
|
-
-
|
40
|
-
- base/
|
168
|
+
- .rspec
|
169
|
+
- ChangeLog
|
170
|
+
- Gemfile
|
171
|
+
- Gemfile.lock
|
172
|
+
- LICENSE
|
173
|
+
- README.rdoc
|
174
|
+
- Rakefile
|
175
|
+
- base/bg.yml
|
41
176
|
- base/ca.yml
|
42
|
-
- base/de.yml
|
43
177
|
- base/cs.yml
|
178
|
+
- base/da.yml
|
179
|
+
- base/de.yml
|
180
|
+
- base/en.yml
|
181
|
+
- base/eo.yml
|
182
|
+
- base/es.yml
|
183
|
+
- base/fi.yml
|
44
184
|
- base/fr.yml
|
185
|
+
- base/hu.yml
|
45
186
|
- base/it.yml
|
46
|
-
- base/fi.yml
|
47
|
-
- base/zh.yml
|
48
|
-
- base/th.yml
|
49
|
-
- base/es.yml
|
50
187
|
- base/ja.yml
|
188
|
+
- base/kk.yml
|
189
|
+
- base/lv.yml
|
190
|
+
- base/nl.yml
|
191
|
+
- base/pl.yml
|
192
|
+
- base/pt.yml
|
51
193
|
- base/ru.yml
|
52
194
|
- base/sk.yml
|
53
|
-
- base/
|
195
|
+
- base/sv-se.yml
|
196
|
+
- base/th.yml
|
197
|
+
- base/zh.yml
|
54
198
|
- lib/r18n-core.rb
|
199
|
+
- lib/r18n-core/filters.rb
|
200
|
+
- lib/r18n-core/helpers.rb
|
201
|
+
- lib/r18n-core/i18n.rb
|
55
202
|
- lib/r18n-core/locale.rb
|
56
|
-
- lib/r18n-core/
|
203
|
+
- lib/r18n-core/translated.rb
|
57
204
|
- lib/r18n-core/translated_string.rb
|
58
|
-
- lib/r18n-core/
|
59
|
-
- lib/r18n-core/
|
205
|
+
- lib/r18n-core/translation.rb
|
206
|
+
- lib/r18n-core/unsupported_locale.rb
|
60
207
|
- lib/r18n-core/untranslated.rb
|
61
|
-
- lib/r18n-core/translated.rb
|
62
208
|
- lib/r18n-core/utils.rb
|
209
|
+
- lib/r18n-core/version.rb
|
63
210
|
- lib/r18n-core/yaml_loader.rb
|
64
|
-
- lib/r18n-core/unsupported_locale.rb
|
65
|
-
- lib/r18n-core/helpers.rb
|
66
|
-
- lib/r18n-core/filters.rb
|
67
|
-
- locales/es.rb
|
68
|
-
- locales/lv.rb
|
69
|
-
- locales/de.rb
|
70
|
-
- locales/kk.rb
|
71
|
-
- locales/ca.rb
|
72
|
-
- locales/zh.rb
|
73
211
|
- locales/bg.rb
|
212
|
+
- locales/ca.rb
|
213
|
+
- locales/cs.rb
|
214
|
+
- locales/da.rb
|
215
|
+
- locales/de.rb
|
74
216
|
- locales/en-au.rb
|
75
|
-
- locales/pt-br.rb
|
76
|
-
- locales/pl.rb
|
77
|
-
- locales/en.rb
|
78
|
-
- locales/hu.rb
|
79
|
-
- locales/eo.rb
|
80
|
-
- locales/sk.rb
|
81
|
-
- locales/th.rb
|
82
217
|
- locales/en-gb.rb
|
83
|
-
- locales/fr.rb
|
84
218
|
- locales/en-us.rb
|
85
|
-
- locales/
|
86
|
-
- locales/
|
219
|
+
- locales/en.rb
|
220
|
+
- locales/eo.rb
|
221
|
+
- locales/es.rb
|
87
222
|
- locales/fi.rb
|
223
|
+
- locales/fr.rb
|
224
|
+
- locales/hu.rb
|
88
225
|
- locales/it.rb
|
89
226
|
- locales/ja.rb
|
90
|
-
- locales/
|
91
|
-
-
|
92
|
-
-
|
93
|
-
-
|
94
|
-
-
|
95
|
-
-
|
96
|
-
-
|
97
|
-
-
|
227
|
+
- locales/kk.rb
|
228
|
+
- locales/lv.rb
|
229
|
+
- locales/nl.rb
|
230
|
+
- locales/pl.rb
|
231
|
+
- locales/pt-br.rb
|
232
|
+
- locales/pt.rb
|
233
|
+
- locales/ru.rb
|
234
|
+
- locales/sk.rb
|
235
|
+
- locales/sv-se.rb
|
236
|
+
- locales/th.rb
|
237
|
+
- locales/zh.rb
|
238
|
+
- r18n-core.gemspec
|
239
|
+
- spec/filters_spec.rb
|
98
240
|
- spec/i18n_spec.rb
|
99
|
-
- spec/
|
100
|
-
- spec/locales/en_spec.rb
|
241
|
+
- spec/locale_spec.rb
|
101
242
|
- spec/locales/cs_spec.rb
|
102
|
-
- spec/locales/sk_spec.rb
|
103
|
-
- spec/locales/it_spec.rb
|
104
|
-
- spec/locales/fr_spec.rb
|
105
243
|
- spec/locales/en-us_spec.rb
|
106
|
-
- spec/locales/
|
244
|
+
- spec/locales/en_spec.rb
|
245
|
+
- spec/locales/fr_spec.rb
|
107
246
|
- spec/locales/hu_spec.rb
|
247
|
+
- spec/locales/it_spec.rb
|
248
|
+
- spec/locales/pl_spec.rb
|
108
249
|
- spec/locales/ru_spec.rb
|
109
|
-
- spec/
|
110
|
-
- spec/
|
250
|
+
- spec/locales/sk_spec.rb
|
251
|
+
- spec/locales/th_spec.rb
|
252
|
+
- spec/r18n_spec.rb
|
253
|
+
- spec/spec_helper.rb
|
254
|
+
- spec/translated_spec.rb
|
255
|
+
- spec/translation_spec.rb
|
256
|
+
- spec/translations/empty/en.yml
|
257
|
+
- spec/translations/extension/deep/en.yml
|
258
|
+
- spec/translations/extension/en.yml
|
259
|
+
- spec/translations/extension/no-tr.yml
|
111
260
|
- spec/translations/general/en.yml
|
112
261
|
- spec/translations/general/no-lc.yml
|
113
262
|
- spec/translations/general/ru.yml
|
114
|
-
- spec/translations/
|
115
|
-
- spec/translations/
|
116
|
-
- spec/translations/extension/deep/en.yml
|
117
|
-
- spec/filters_spec.rb
|
263
|
+
- spec/translations/two/en.yml
|
264
|
+
- spec/translations/two/fr.yml
|
118
265
|
- spec/yaml_loader_spec.rb
|
119
|
-
- spec/translated_spec.rb
|
120
266
|
has_rdoc: true
|
121
267
|
homepage: http://r18n.rubyforge.org/
|
122
268
|
licenses: []
|
@@ -151,30 +297,5 @@ rubygems_version: 1.3.7
|
|
151
297
|
signing_key:
|
152
298
|
specification_version: 3
|
153
299
|
summary: I18n tool to translate your Ruby application.
|
154
|
-
test_files:
|
155
|
-
|
156
|
-
- spec/r18n_spec.rb
|
157
|
-
- spec/spec_helper.rb
|
158
|
-
- spec/locale_spec.rb
|
159
|
-
- spec/i18n_spec.rb
|
160
|
-
- spec/locales/th_spec.rb
|
161
|
-
- spec/locales/en_spec.rb
|
162
|
-
- spec/locales/cs_spec.rb
|
163
|
-
- spec/locales/sk_spec.rb
|
164
|
-
- spec/locales/it_spec.rb
|
165
|
-
- spec/locales/fr_spec.rb
|
166
|
-
- spec/locales/en-us_spec.rb
|
167
|
-
- spec/locales/pl_spec.rb
|
168
|
-
- spec/locales/hu_spec.rb
|
169
|
-
- spec/locales/ru_spec.rb
|
170
|
-
- spec/translations/two/en.yml
|
171
|
-
- spec/translations/two/fr.yml
|
172
|
-
- spec/translations/general/en.yml
|
173
|
-
- spec/translations/general/no-lc.yml
|
174
|
-
- spec/translations/general/ru.yml
|
175
|
-
- spec/translations/extension/en.yml
|
176
|
-
- spec/translations/extension/no-tr.yml
|
177
|
-
- spec/translations/extension/deep/en.yml
|
178
|
-
- spec/filters_spec.rb
|
179
|
-
- spec/yaml_loader_spec.rb
|
180
|
-
- spec/translated_spec.rb
|
300
|
+
test_files: []
|
301
|
+
|