r18n-core 0.2 → 0.2.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.
- data/base/de.yml +7 -0
- data/lib/r18n-core.rb +1 -0
- data/lib/r18n-core/i18n.rb +2 -1
- data/lib/r18n-core/locale.rb +2 -1
- data/lib/r18n-core/translated_string.rb +1 -0
- data/lib/r18n-core/translation.rb +1 -0
- data/lib/r18n-core/untranslated.rb +1 -0
- data/lib/r18n-core/version.rb +2 -1
- data/locales/de.yml +31 -0
- data/spec/i18n_spec.rb +2 -1
- data/spec/locale_spec.rb +2 -1
- data/spec/r18n_spec.rb +1 -0
- data/spec/spec_helper.rb +1 -0
- data/spec/translation_spec.rb +1 -0
- metadata +4 -3
- data/Rakefile +0 -94
data/base/de.yml
ADDED
data/lib/r18n-core.rb
CHANGED
data/lib/r18n-core/i18n.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# encoding: utf-8
|
1
2
|
=begin
|
2
3
|
I18n support.
|
3
4
|
|
@@ -103,7 +104,7 @@ module R18n
|
|
103
104
|
# +Locales+ must be a locale code (RFC 3066) or array, ordered by priority.
|
104
105
|
# +Translations_dirs+ must be a string with path or array.
|
105
106
|
def initialize(locales, translations_dirs = nil)
|
106
|
-
locales = locales
|
107
|
+
locales = [locales] if String == locales.class
|
107
108
|
|
108
109
|
@locales = locales.map do |locale|
|
109
110
|
if Locale.exists? locale
|
data/lib/r18n-core/locale.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# encoding: utf-8
|
1
2
|
=begin
|
2
3
|
Locale to i18n support.
|
3
4
|
|
@@ -56,7 +57,7 @@ module R18n
|
|
56
57
|
|
57
58
|
# All available locales
|
58
59
|
def self.available
|
59
|
-
Dir.glob(LOCALES_DIR
|
60
|
+
Dir.glob(File.join(LOCALES_DIR, '*.yml')).map do |i|
|
60
61
|
File.basename(i, '.yml')
|
61
62
|
end
|
62
63
|
end
|
data/lib/r18n-core/version.rb
CHANGED
data/locales/de.yml
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
title: Deutsch
|
2
|
+
code: de
|
3
|
+
sublocales: [en]
|
4
|
+
direction: ltr
|
5
|
+
|
6
|
+
week:
|
7
|
+
start: monday
|
8
|
+
days: [Sonntag, Montag, Dienstag, Mittwoch, Donnerstag, Freitag, Samstag]
|
9
|
+
abbrs: [So, Mo, Di, Mi, Do, Fr, Sa]
|
10
|
+
|
11
|
+
months:
|
12
|
+
names: [Januar, Februar, März, April, Mai, Juni, Juli, August, September, Oktober, November, Dezember]
|
13
|
+
abbrs: [Jan, Feb, Mär, Apr, Mai, Jun, Jul, Aug, Sep, Okt, Nov, Dez]
|
14
|
+
standalone: [Januar, Februar, März, April, Mai, Juni, Juli, August, September, Oktober, November, Dezember]
|
15
|
+
|
16
|
+
time:
|
17
|
+
am: vormittags
|
18
|
+
pm: nachmittags
|
19
|
+
|
20
|
+
formats:
|
21
|
+
time: "%H:%M"
|
22
|
+
date: "%d.%m.%Y"
|
23
|
+
short_date: "%d %b"
|
24
|
+
long_date: "%d %B %Y"
|
25
|
+
datetime: "%a %d %b %Y %H:%M:%S %Z"
|
26
|
+
short_datetime: "%d %b %H:%M"
|
27
|
+
long_datetime: "%d %B %Y %H:%M"
|
28
|
+
|
29
|
+
numbers:
|
30
|
+
decimal_separator: ","
|
31
|
+
group_delimiter: "."
|
data/spec/i18n_spec.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# encoding: utf-8
|
1
2
|
require File.join(File.dirname(__FILE__), 'spec_helper')
|
2
3
|
|
3
4
|
describe R18n::I18n do
|
@@ -67,7 +68,7 @@ describe R18n::I18n do
|
|
67
68
|
i18n.l(-12345.67).should == '−12 345,67'
|
68
69
|
|
69
70
|
time = Time.at(0).utc
|
70
|
-
i18n.l(time).should == 'Чтв, 01 янв 1970, 00:00:00
|
71
|
+
i18n.l(time).should == 'Чтв, 01 янв 1970, 00:00:00 UTC'
|
71
72
|
i18n.l(time, :time).should == '00:00'
|
72
73
|
i18n.l(time, '%A').should == 'Четверг'
|
73
74
|
|
data/spec/locale_spec.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# encoding: utf-8
|
1
2
|
require File.join(File.dirname(__FILE__), "spec_helper")
|
2
3
|
|
3
4
|
describe R18n::Locale do
|
@@ -84,7 +85,7 @@ describe R18n::Locale do
|
|
84
85
|
locale.strftime(time, '%H:%M%p').should == '00:00 утра'
|
85
86
|
|
86
87
|
locale.strftime(time, :month).should == 'Январь'
|
87
|
-
locale.strftime(time, :datetime).should == 'Чтв, 01 янв 1970, 00:00:00
|
88
|
+
locale.strftime(time, :datetime).should == 'Чтв, 01 янв 1970, 00:00:00 UTC'
|
88
89
|
end
|
89
90
|
|
90
91
|
it "should delete slashed from locale for security reasons" do
|
data/spec/r18n_spec.rb
CHANGED
data/spec/spec_helper.rb
CHANGED
data/spec/translation_spec.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: r18n-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrey "A.I." Sitnik
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date:
|
12
|
+
date: 2009-02-18 00:00:00 +03:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|
@@ -23,6 +23,7 @@ extra_rdoc_files:
|
|
23
23
|
- README.rdoc
|
24
24
|
- LICENSE
|
25
25
|
files:
|
26
|
+
- base/de.yml
|
26
27
|
- base/kk.yml
|
27
28
|
- base/ru.yml
|
28
29
|
- base/eo.yml
|
@@ -37,6 +38,7 @@ files:
|
|
37
38
|
- lib/r18n-core/i18n.rb
|
38
39
|
- lib/r18n-core/untranslated.rb
|
39
40
|
- locales/en_US.yml
|
41
|
+
- locales/de.yml
|
40
42
|
- locales/kk.yml
|
41
43
|
- locales/ru.yml
|
42
44
|
- locales/ru.rb
|
@@ -44,7 +46,6 @@ files:
|
|
44
46
|
- locales/en.yml
|
45
47
|
- locales/fr.yml
|
46
48
|
- LICENSE
|
47
|
-
- Rakefile
|
48
49
|
- README.rdoc
|
49
50
|
has_rdoc: true
|
50
51
|
homepage: http://r18n.rubyforge.org/
|
data/Rakefile
DELETED
@@ -1,94 +0,0 @@
|
|
1
|
-
require 'rubygems'
|
2
|
-
require 'rake/rdoctask'
|
3
|
-
require 'rake/gempackagetask'
|
4
|
-
require 'spec/rake/spectask'
|
5
|
-
|
6
|
-
PKG_NAME = 'r18n-core'
|
7
|
-
require 'lib/r18n-core/version'
|
8
|
-
|
9
|
-
##############################################################################
|
10
|
-
# Tests
|
11
|
-
##############################################################################
|
12
|
-
|
13
|
-
desc 'Run all specs'
|
14
|
-
Spec::Rake::SpecTask.new('specs') do |t|
|
15
|
-
t.spec_opts = ['--format', 'specdoc', '--colour']
|
16
|
-
t.spec_files = Dir['spec/**/*_spec.rb'].sort
|
17
|
-
end
|
18
|
-
|
19
|
-
desc 'Run a specific spec with TASK=xxxx'
|
20
|
-
Spec::Rake::SpecTask.new('spec') do |t|
|
21
|
-
t.spec_opts = ['--format', 'specdoc', '--colour']
|
22
|
-
t.libs = ['lib']
|
23
|
-
t.spec_files = ["spec/**/#{ENV['TASK']}_spec.rb"]
|
24
|
-
end
|
25
|
-
|
26
|
-
desc 'Run all specs output html'
|
27
|
-
Spec::Rake::SpecTask.new('specs_html') do |t|
|
28
|
-
t.spec_opts = ['--format', 'html']
|
29
|
-
t.libs = ['lib']
|
30
|
-
t.spec_files = Dir['spec/**/*_spec.rb'].sort
|
31
|
-
end
|
32
|
-
|
33
|
-
desc 'RCov'
|
34
|
-
Spec::Rake::SpecTask.new('rcov') do |t|
|
35
|
-
t.spec_opts = ['--format', 'specdoc', '--colour']
|
36
|
-
t.spec_files = Dir['spec/**/*_spec.rb'].sort
|
37
|
-
t.libs = ['lib']
|
38
|
-
t.rcov = true
|
39
|
-
end
|
40
|
-
|
41
|
-
##############################################################################
|
42
|
-
# Documentation and distribution
|
43
|
-
##############################################################################
|
44
|
-
|
45
|
-
Rake::RDocTask.new do |rdoc|
|
46
|
-
rdoc.main = 'README.rdoc'
|
47
|
-
rdoc.rdoc_files.include('README.rdoc', 'LICENSE', 'lib/**/*.rb')
|
48
|
-
rdoc.title = 'R18n Documentation'
|
49
|
-
rdoc.rdoc_dir = 'doc'
|
50
|
-
rdoc.options << '-c utf-8'
|
51
|
-
rdoc.options << '--all'
|
52
|
-
end
|
53
|
-
|
54
|
-
spec = Gem::Specification.new do |s|
|
55
|
-
s.platform = Gem::Platform::RUBY
|
56
|
-
s.name = PKG_NAME
|
57
|
-
s.version = R18n::VERSION
|
58
|
-
s.summary = 'I18n tool to translate your Ruby application.'
|
59
|
-
s.description = <<-EOF
|
60
|
-
R18n is a i18n tool to translate your Ruby application.
|
61
|
-
It can format numbers and time to the rules of the user locale,
|
62
|
-
has translation for common words, storage translation in YAML format with
|
63
|
-
pluralization and procedures and has special support for countries
|
64
|
-
with two official languages.
|
65
|
-
EOF
|
66
|
-
|
67
|
-
s.files = FileList[
|
68
|
-
'base/**/*',
|
69
|
-
'lib/**/*',
|
70
|
-
'locales/**/*',
|
71
|
-
'LICENSE',
|
72
|
-
'Rakefile',
|
73
|
-
'README.rdoc']
|
74
|
-
s.test_files = FileList[
|
75
|
-
'spec/**/*']
|
76
|
-
s.extra_rdoc_files = ['README.rdoc', 'LICENSE']
|
77
|
-
s.require_path = 'lib'
|
78
|
-
s.has_rdoc = true
|
79
|
-
|
80
|
-
s.author = 'Andrey "A.I." Sitnik'
|
81
|
-
s.email = 'andrey@sitnik.ru'
|
82
|
-
s.homepage = 'http://r18n.rubyforge.org/'
|
83
|
-
s.rubyforge_project = PKG_NAME
|
84
|
-
end
|
85
|
-
|
86
|
-
Rake::GemPackageTask.new(spec) do |pkg|
|
87
|
-
pkg.gem_spec = spec
|
88
|
-
end
|
89
|
-
|
90
|
-
desc 'Install as a gem'
|
91
|
-
task :install => [:package] do
|
92
|
-
sudo = RUBY_PLATFORM =~ /win32/ ? '' : 'sudo'
|
93
|
-
sh %{#{sudo} gem install pkg/#{PKG_NAME}-#{R18n::VERSION}}
|
94
|
-
end
|