polish 0.1.1 → 0.1.2
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/.gitignore +4 -0
- data/.travis.yml +6 -0
- data/Gemfile +6 -9
- data/Guardfile +8 -0
- data/README.md +5 -4
- data/Rakefile +7 -20
- data/TODO +2 -2
- data/lib/polish.rb +13 -11
- data/lib/polish/locale/actionview.yml +22 -22
- data/lib/polish/locale/activerecord.yml +15 -15
- data/lib/polish/locale/datetime.yml +5 -2
- data/polish.gemspec +10 -57
- data/spec/i18n/locale/datetime_spec.rb +23 -21
- data/spec/polish_spec.rb +25 -17
- data/spec/proxies_spec.rb +4 -2
- metadata +72 -57
- data/lib/proxies.rb +0 -2
data/.gitignore
CHANGED
data/.travis.yml
ADDED
data/Gemfile
CHANGED
@@ -1,14 +1,11 @@
|
|
1
1
|
source 'http://rubygems.org'
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
gem "bundler"
|
7
|
-
gem "jeweler"
|
8
|
-
end
|
3
|
+
gemspec
|
4
|
+
|
5
|
+
gem 'guard-rspec', :group => :development
|
9
6
|
|
10
|
-
|
11
|
-
gem
|
12
|
-
gem
|
7
|
+
if RUBY_PLATFORM =~ /darwin/
|
8
|
+
gem 'rb-fsevent', :group => :development
|
9
|
+
gem 'growl', :group => :development
|
13
10
|
end
|
14
11
|
|
data/Guardfile
ADDED
data/README.md
CHANGED
@@ -1,5 +1,6 @@
|
|
1
|
-
Polish
|
2
|
-
|
1
|
+
# Polish
|
2
|
+
[](http://travis-ci.org/grk/polish) [](http://stillmaintained.com/grk/polish)
|
3
|
+
|
3
4
|
Polish language support for Ruby on Rails.
|
4
5
|
|
5
6
|
Adds correct polish pluralization and better date formats. Also includes support for standalone months. (`"%B %Y"` should be Grudzień 2009, but `"%d. %B %Y"` should be 24. grudnia 2009).
|
@@ -12,11 +13,11 @@ Install
|
|
12
13
|
|
13
14
|
To add Polish to your Rails app, simply add it to your Gemfile:
|
14
15
|
|
15
|
-
|
16
|
+
`gem "polish", ">= 0.1.0"`
|
16
17
|
|
17
18
|
Additionally, if you change the backend of I18n, you will need to make sure it includes the Pluralization module:
|
18
19
|
|
19
|
-
|
20
|
+
`I18n.backend.class.send(:include, I18n::Backend::Pluralization)`
|
20
21
|
|
21
22
|
What it does
|
22
23
|
------------
|
data/Rakefile
CHANGED
@@ -9,27 +9,14 @@ rescue Bundler::BundlerError => e
|
|
9
9
|
exit e.status_code
|
10
10
|
end
|
11
11
|
|
12
|
-
|
12
|
+
require 'bundler/gem_tasks'
|
13
13
|
|
14
|
-
require '
|
15
|
-
|
16
|
-
gemspec.name = "polish"
|
17
|
-
gemspec.summary = "Polish language support for Ruby and Rails"
|
18
|
-
gemspec.email = "gkolodziejczyk@gmail.com"
|
19
|
-
gemspec.homepage = "http://github.com/grk/polish"
|
20
|
-
gemspec.authors = ["Grzesiek Kolodziejczyk"]
|
21
|
-
|
22
|
-
gemspec.add_dependency("i18n", ">= 0.3.3")
|
23
|
-
end
|
24
|
-
|
25
|
-
Jeweler::GemcutterTasks.new
|
26
|
-
|
27
|
-
require 'spec/rake/spectask'
|
28
|
-
|
14
|
+
require 'rspec/core'
|
15
|
+
require 'rspec/core/rake_task'
|
29
16
|
task :default => :spec
|
30
17
|
desc "Run specs"
|
31
|
-
|
32
|
-
t.
|
33
|
-
t.
|
18
|
+
RSpec::Core::RakeTask.new do |t|
|
19
|
+
t.pattern = FileList['spec/**/*_spec.rb']
|
20
|
+
t.rspec_opts = %w(-fs --color)
|
34
21
|
end
|
35
|
-
|
22
|
+
|
data/TODO
CHANGED
data/lib/polish.rb
CHANGED
@@ -1,44 +1,46 @@
|
|
1
|
-
# -*- encoding: utf-8 -*-
|
2
|
-
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
|
3
3
|
if RUBY_VERSION < "1.9"
|
4
4
|
$KCODE = 'u'
|
5
5
|
end
|
6
6
|
|
7
|
+
require 'i18n'
|
8
|
+
|
7
9
|
# Rails hacks
|
8
10
|
if defined?(ActionView::Helpers)
|
9
|
-
require 'polish/action_view_ext/helpers/date_helper'
|
11
|
+
require 'polish/action_view_ext/helpers/date_helper'
|
10
12
|
end
|
11
13
|
|
12
14
|
require 'polish/proxies'
|
13
|
-
|
15
|
+
|
14
16
|
module Polish
|
15
17
|
extend self
|
16
|
-
|
18
|
+
|
17
19
|
module VERSION
|
18
20
|
STRING = File.open(File.dirname(__FILE__) + "/../VERSION").gets.chomp
|
19
21
|
MAJOR, MINOR, TINY = STRING.split('.')
|
20
22
|
end
|
21
|
-
|
23
|
+
|
22
24
|
# Polish locale
|
23
25
|
LOCALE = :'pl'
|
24
|
-
|
26
|
+
|
25
27
|
# Polish locale
|
26
28
|
def locale
|
27
29
|
LOCALE
|
28
30
|
end
|
29
|
-
|
30
|
-
# Init Polish i18n: set custom backend,
|
31
|
+
|
32
|
+
# Init Polish i18n: set custom backend,
|
31
33
|
# load all translations shipped with library.
|
32
34
|
def init_i18n
|
33
35
|
I18n.backend.class.send(:include, I18n::Backend::Pluralization)
|
34
36
|
I18n.load_path.unshift(*locale_files)
|
35
37
|
end
|
36
|
-
|
38
|
+
|
37
39
|
protected
|
38
40
|
# Returns all locale files shipped with library
|
39
41
|
def locale_files
|
40
42
|
Dir[File.join(File.dirname(__FILE__), "polish", "locale", "**/*")]
|
41
43
|
end
|
42
44
|
end
|
43
|
-
|
45
|
+
|
44
46
|
Polish.init_i18n
|
@@ -40,44 +40,44 @@ pl:
|
|
40
40
|
half_a_minute: "pół minuty"
|
41
41
|
less_than_x_seconds:
|
42
42
|
one: "mniej niż sekundę"
|
43
|
-
few: "mniej niż {
|
44
|
-
other: "mniej niż {
|
43
|
+
few: "mniej niż %{count} sekundy"
|
44
|
+
other: "mniej niż %{count} sekund"
|
45
45
|
x_seconds:
|
46
46
|
one: "sekundę"
|
47
|
-
few: "{
|
48
|
-
other: "{
|
47
|
+
few: "%{count} sekundy"
|
48
|
+
other: "%{count} sekund"
|
49
49
|
less_than_x_minutes:
|
50
50
|
one: "mniej niż minutę"
|
51
|
-
few: "mniej niż {
|
52
|
-
other: "mniej niż {
|
51
|
+
few: "mniej niż %{count} minuty"
|
52
|
+
other: "mniej niż %{count} minut"
|
53
53
|
x_minutes:
|
54
54
|
one: "minutę"
|
55
|
-
few: "{
|
56
|
-
other: "{
|
55
|
+
few: "%{count} minuty"
|
56
|
+
other: "%{count} minut"
|
57
57
|
about_x_hours:
|
58
58
|
one: "około godziny"
|
59
|
-
few: "około {
|
60
|
-
other: "około {
|
59
|
+
few: "około %{count} godzin"
|
60
|
+
other: "około %{count} godzin"
|
61
61
|
x_days:
|
62
62
|
one: "1 dzień"
|
63
|
-
few: "{
|
64
|
-
other: "{
|
63
|
+
few: "%{count} dni"
|
64
|
+
other: "%{count} dni"
|
65
65
|
about_x_months:
|
66
66
|
one: "około miesiąca"
|
67
|
-
few: "około {
|
68
|
-
other: "około {
|
67
|
+
few: "około %{count} miesięcy"
|
68
|
+
other: "około %{count} miesięcy"
|
69
69
|
x_months:
|
70
70
|
one: "1 miesiąc"
|
71
|
-
few: "{
|
72
|
-
other: "{
|
71
|
+
few: "%{count} miesiące"
|
72
|
+
other: "%{count} miesięcy"
|
73
73
|
about_x_years:
|
74
74
|
one: "około roku"
|
75
|
-
few: "około {
|
76
|
-
other: "około {
|
75
|
+
few: "około %{count} lat"
|
76
|
+
other: "około %{count} lat"
|
77
77
|
over_x_years:
|
78
78
|
one: "ponad rok"
|
79
|
-
few: "ponad {
|
80
|
-
other: "ponad {
|
79
|
+
few: "ponad %{count} lata"
|
80
|
+
other: "ponad %{count} lat"
|
81
81
|
prompts:
|
82
82
|
year: "Rok"
|
83
83
|
month: "Miesiąc"
|
@@ -100,8 +100,8 @@ pl:
|
|
100
100
|
errors:
|
101
101
|
template:
|
102
102
|
header:
|
103
|
-
one: "{
|
104
|
-
other: "{
|
103
|
+
one: "%{model} nie został zachowany z powodu jednego błędu"
|
104
|
+
other: "%{model} nie został zachowany z powodu %{count} błędów"
|
105
105
|
body: "Błędy dotyczą następujących pól:"
|
106
106
|
|
107
107
|
attributes:
|
@@ -3,8 +3,8 @@ pl:
|
|
3
3
|
errors:
|
4
4
|
template:
|
5
5
|
header:
|
6
|
-
one: "{
|
7
|
-
other: "{
|
6
|
+
one: "%{model} nie został zachowany z powodu jednego błędu"
|
7
|
+
other: "%{model} nie został zachowany z powodu %{count} błędów"
|
8
8
|
body: "Błędy dotyczą następujących pól:"
|
9
9
|
messages:
|
10
10
|
record_invalid: "Znaleziono błędy: %{errors}"
|
@@ -15,21 +15,21 @@ pl:
|
|
15
15
|
accepted: "musi być zaakceptowane"
|
16
16
|
empty: "nie może być puste"
|
17
17
|
blank: "nie może być puste"
|
18
|
-
too_long:
|
19
|
-
one: "jest za długie (maksymalnie {
|
20
|
-
few: "jest za długie (maksymalnie {
|
21
|
-
other: "jest za długie (maksymalnie {
|
18
|
+
too_long:
|
19
|
+
one: "jest za długie (maksymalnie %{count} znak)"
|
20
|
+
few: "jest za długie (maksymalnie %{count} znaki)"
|
21
|
+
other: "jest za długie (maksymalnie %{count} znaków)"
|
22
22
|
too_short:
|
23
|
-
one: "jest za krótkie (minimalnie {
|
24
|
-
few: "jest za krótkie (minimalnie {
|
25
|
-
other: "jest za krótkie (minimalnie {
|
26
|
-
wrong_length: "jest nieprawidłowej długości (powinna wynosić {
|
23
|
+
one: "jest za krótkie (minimalnie %{count} znak)"
|
24
|
+
few: "jest za krótkie (minimalnie %{count} znaki)"
|
25
|
+
other: "jest za krótkie (minimalnie %{count} znaków)"
|
26
|
+
wrong_length: "jest nieprawidłowej długości (powinna wynosić %{count} znaków)"
|
27
27
|
taken: "zostało już zajęte"
|
28
28
|
not_a_number: "nie jest liczbą"
|
29
|
-
greater_than: "musi być większe niż {
|
30
|
-
greater_than_or_equal_to: "musi być większe lub równe {
|
31
|
-
equal_to: "musi być równe {
|
32
|
-
less_than: "musie być mniejsze niż {
|
33
|
-
less_than_or_equal_to: "musi być mniejsze lub równe {
|
29
|
+
greater_than: "musi być większe niż %{count}"
|
30
|
+
greater_than_or_equal_to: "musi być większe lub równe %{count}"
|
31
|
+
equal_to: "musi być równe %{count}"
|
32
|
+
less_than: "musie być mniejsze niż %{count}"
|
33
|
+
less_than_or_equal_to: "musi być mniejsze lub równe %{count}"
|
34
34
|
odd: "musi być nieparzyste"
|
35
35
|
even: "musi być parzyste"
|
data/polish.gemspec
CHANGED
@@ -5,71 +5,24 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{polish}
|
8
|
-
s.version = "0.1.
|
8
|
+
s.version = "0.1.2"
|
9
9
|
|
10
|
-
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
10
|
s.authors = ["Grzesiek Kolodziejczyk"]
|
12
11
|
s.date = %q{2010-07-23}
|
13
12
|
s.email = %q{gkolodziejczyk@gmail.com}
|
14
|
-
s.extra_rdoc_files = [
|
15
|
-
"LICENSE",
|
16
|
-
"README.md",
|
17
|
-
"TODO"
|
18
|
-
]
|
19
|
-
s.files = [
|
20
|
-
".gitignore",
|
21
|
-
"Gemfile",
|
22
|
-
"LICENSE",
|
23
|
-
"README.md",
|
24
|
-
"Rakefile",
|
25
|
-
"TODO",
|
26
|
-
"VERSION",
|
27
|
-
"lib/polish.rb",
|
28
|
-
"lib/polish/action_view_ext/helpers/date_helper.rb",
|
29
|
-
"lib/polish/locale/actionview.yml",
|
30
|
-
"lib/polish/locale/activerecord.yml",
|
31
|
-
"lib/polish/locale/activesupport.yml",
|
32
|
-
"lib/polish/locale/datetime.rb",
|
33
|
-
"lib/polish/locale/datetime.yml",
|
34
|
-
"lib/polish/locale/pluralize.rb",
|
35
|
-
"lib/polish/proxies.rb",
|
36
|
-
"lib/proxies.rb",
|
37
|
-
"polish.gemspec",
|
38
|
-
"rails/init.rb",
|
39
|
-
"spec/fixtures/en.yml",
|
40
|
-
"spec/fixtures/pl.yml",
|
41
|
-
"spec/i18n/locale/datetime_spec.rb",
|
42
|
-
"spec/i18n/locale/pluralization_spec.rb",
|
43
|
-
"spec/locale_spec.rb",
|
44
|
-
"spec/polish_spec.rb",
|
45
|
-
"spec/proxies_spec.rb",
|
46
|
-
"spec/spec_helper.rb"
|
47
|
-
]
|
48
13
|
s.homepage = %q{http://github.com/grk/polish}
|
49
|
-
|
14
|
+
|
15
|
+
s.files = `git ls-files`.split("\n")
|
16
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
17
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
50
18
|
s.require_paths = ["lib"]
|
51
|
-
|
19
|
+
|
52
20
|
s.summary = %q{Polish language support for Ruby and Rails}
|
53
|
-
s.test_files = [
|
54
|
-
"spec/i18n/locale/datetime_spec.rb",
|
55
|
-
"spec/i18n/locale/pluralization_spec.rb",
|
56
|
-
"spec/locale_spec.rb",
|
57
|
-
"spec/polish_spec.rb",
|
58
|
-
"spec/proxies_spec.rb",
|
59
|
-
"spec/spec_helper.rb"
|
60
|
-
]
|
61
21
|
|
62
|
-
|
63
|
-
|
64
|
-
|
22
|
+
s.add_dependency "i18n"
|
23
|
+
s.add_dependency "rake"
|
24
|
+
s.add_dependency "bundler"
|
65
25
|
|
66
|
-
|
67
|
-
s.add_runtime_dependency(%q<i18n>, [">= 0.3.3"])
|
68
|
-
else
|
69
|
-
s.add_dependency(%q<i18n>, [">= 0.3.3"])
|
70
|
-
end
|
71
|
-
else
|
72
|
-
s.add_dependency(%q<i18n>, [">= 0.3.3"])
|
73
|
-
end
|
26
|
+
s.add_development_dependency "rspec", ">= 2.6.0"
|
74
27
|
end
|
75
28
|
|
@@ -1,97 +1,99 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
|
1
3
|
require File.dirname(__FILE__) + '/../../spec_helper'
|
2
|
-
|
4
|
+
|
3
5
|
describe I18n, "Polish Date/Time localization" do
|
4
6
|
before(:all) do
|
5
7
|
@date = Date.parse("1985-12-01")
|
6
8
|
@time = Time.local(1985, 12, 01, 16, 05)
|
7
9
|
end
|
8
|
-
|
10
|
+
|
9
11
|
describe "with date formats" do
|
10
12
|
it "should use default format" do
|
11
13
|
l(@date).should == "01.12.1985"
|
12
14
|
end
|
13
|
-
|
15
|
+
|
14
16
|
it "should use short format" do
|
15
17
|
l(@date, :format => :short).should == " 1 gru."
|
16
18
|
end
|
17
|
-
|
19
|
+
|
18
20
|
it "should use long format" do
|
19
21
|
l(@date, :format => :long).should == " 1 grudnia 1985"
|
20
22
|
end
|
21
23
|
end
|
22
|
-
|
24
|
+
|
23
25
|
describe "with date day names" do
|
24
26
|
it "should use day names" do
|
25
27
|
l(@date, :format => "%d %B (%A)").should == "01 grudnia (niedziela)"
|
26
|
-
l(@date, :format => "%d %B %Y roku była %A").should ==
|
28
|
+
l(@date, :format => "%d %B %Y roku była %A").should ==
|
27
29
|
"01 grudnia 1985 roku była niedziela"
|
28
30
|
end
|
29
|
-
|
31
|
+
|
30
32
|
it "should use standalone day names" do
|
31
33
|
l(@date, :format => "%A").should == "Niedziela"
|
32
34
|
l(@date, :format => "%A, %d %B").should == "Niedziela, 01 grudnia"
|
33
35
|
end
|
34
|
-
|
36
|
+
|
35
37
|
it "should use abbreviated day names" do
|
36
38
|
l(@date, :format => "%a").should == "Niedz."
|
37
39
|
l(@date, :format => "%a, %d %b %Y").should == "Niedz., 01 gru. 1985"
|
38
40
|
end
|
39
41
|
end
|
40
|
-
|
42
|
+
|
41
43
|
describe "with month names" do
|
42
44
|
it "should use month names" do
|
43
45
|
l(@date, :format => "%d %B").should == "01 grudnia"
|
44
46
|
l(@date, :format => "%e %B %Y").should == " 1 grudnia 1985"
|
45
47
|
l(@date, :format => "<b>%d</b> %B").should == "<b>01</b> grudnia"
|
46
|
-
l(@date, :format => "<strong>%e</strong> %B %Y").should ==
|
48
|
+
l(@date, :format => "<strong>%e</strong> %B %Y").should ==
|
47
49
|
"<strong> 1</strong> grudnia 1985"
|
48
|
-
l(@date, :format => "A było to dnia %ego miesiąca %B %Y").should ==
|
50
|
+
l(@date, :format => "A było to dnia %ego miesiąca %B %Y").should ==
|
49
51
|
"A było to dnia 1go miesiąca grudnia 1985"
|
50
52
|
end
|
51
|
-
|
53
|
+
|
52
54
|
it "should use standalone month names" do
|
53
55
|
l(@date, :format => "%B").should == "Grudzień"
|
54
56
|
l(@date, :format => "%B %Y").should == "Grudzień 1985"
|
55
57
|
end
|
56
|
-
|
58
|
+
|
57
59
|
it "should use abbreviated month names" do
|
58
60
|
@date = Date.parse("1985-03-01")
|
59
61
|
l(@date, :format => "%d %b").should == "01 mar."
|
60
62
|
l(@date, :format => "%e %b %Y").should == " 1 mar. 1985"
|
61
63
|
end
|
62
|
-
|
64
|
+
|
63
65
|
it "should use standalone abbreviated month names" do
|
64
66
|
@date = Date.parse("1985-03-01")
|
65
67
|
l(@date, :format => "%b").should == "Mar."
|
66
68
|
l(@date, :format => "%b %Y").should == "Mar. 1985"
|
67
69
|
end
|
68
70
|
end
|
69
|
-
|
71
|
+
|
70
72
|
it "should define default date components order: year, month, day" do
|
71
|
-
I18n.backend.translate(Polish.locale, :"date.order").should ==
|
73
|
+
I18n.backend.translate(Polish.locale, :"date.order").should ==
|
72
74
|
[:day, :month, :year]
|
73
75
|
end
|
74
|
-
|
76
|
+
|
75
77
|
describe "with time formats" do
|
76
78
|
it "should use default format" do
|
77
79
|
l(@time).should =~ /^Niedz., 1 grudnia 1985, 16:05:00/
|
78
80
|
end
|
79
|
-
|
81
|
+
|
80
82
|
it "should use short format" do
|
81
83
|
l(@time, :format => :short).should == " 1 gru., 16:05"
|
82
84
|
end
|
83
|
-
|
85
|
+
|
84
86
|
it "should use long format" do
|
85
87
|
l(@time, :format => :long).should == " 1 grudnia 1985, 16:05"
|
86
88
|
end
|
87
|
-
|
89
|
+
|
88
90
|
it "should define am and pm" do
|
89
91
|
I18n.backend.translate(Polish.locale, :"time.am").should_not be_nil
|
90
92
|
I18n.backend.translate(Polish.locale, :"time.pm").should_not be_nil
|
91
93
|
end
|
92
94
|
end
|
93
95
|
|
94
|
-
describe "with time distances" do
|
96
|
+
describe "with time distances" do
|
95
97
|
before do
|
96
98
|
@now = Time.now
|
97
99
|
@three_minutes_from_now = @now + 3 * 60
|
data/spec/polish_spec.rb
CHANGED
@@ -1,5 +1,7 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
|
1
3
|
require File.dirname(__FILE__) + '/spec_helper'
|
2
|
-
|
4
|
+
|
3
5
|
describe Polish, "VERSION" do
|
4
6
|
it "should be defined" do
|
5
7
|
%w(MAJOR MINOR TINY STRING).each do |v|
|
@@ -7,52 +9,58 @@ describe Polish, "VERSION" do
|
|
7
9
|
end
|
8
10
|
end
|
9
11
|
end
|
10
|
-
|
12
|
+
|
11
13
|
describe Polish do
|
12
14
|
describe "with locale" do
|
13
15
|
it "should define :'pl' LOCALE" do
|
14
16
|
Polish::LOCALE.should == :'pl'
|
15
17
|
end
|
16
|
-
|
18
|
+
|
17
19
|
it "should provide 'locale' proxy" do
|
18
20
|
Polish.locale.should == Polish::LOCALE
|
19
21
|
end
|
20
22
|
end
|
21
|
-
|
23
|
+
|
22
24
|
describe "during i18n initialization" do
|
23
|
-
|
25
|
+
before(:each) do
|
24
26
|
I18n.load_path = []
|
27
|
+
end
|
28
|
+
|
29
|
+
after(:all) do
|
25
30
|
Polish.init_i18n
|
31
|
+
I18n.reload!
|
26
32
|
end
|
27
|
-
|
33
|
+
|
28
34
|
it "should extend the backend with I18n::Backend::Pluralization" do
|
29
35
|
I18n.backend.class.ancestors.should include(I18n::Backend::Pluralization)
|
30
36
|
end
|
31
|
-
|
37
|
+
|
32
38
|
it "should keep existing translations while switching backends" do
|
33
39
|
I18n.load_path << File.join(File.dirname(__FILE__), 'fixtures', 'en.yml')
|
34
40
|
Polish.init_i18n
|
41
|
+
I18n.reload!
|
35
42
|
I18n.t(:foo, :locale => :'en').should == "bar"
|
36
43
|
end
|
37
|
-
|
44
|
+
|
38
45
|
it "should keep existing :pl translations while switching backends" do
|
39
46
|
I18n.load_path << File.join(File.dirname(__FILE__), 'fixtures', 'pl.yml')
|
40
47
|
Polish.init_i18n
|
48
|
+
I18n.reload!
|
41
49
|
I18n.t(:'date.formats.default', :locale => :'pl').should == "override"
|
42
50
|
end
|
43
|
-
|
51
|
+
|
44
52
|
it "should not change default locale" do
|
45
53
|
locale = I18n.default_locale
|
46
54
|
Polish.init_i18n
|
47
55
|
I18n.default_locale.should == locale
|
48
56
|
end
|
49
57
|
end
|
50
|
-
|
58
|
+
|
51
59
|
describe "with pluralization" do
|
52
60
|
%w(p pluralize).each do |method|
|
53
61
|
it "'#{method}' should pluralize with variants given" do
|
54
62
|
variants = %w(dom domy domów)
|
55
|
-
|
63
|
+
|
56
64
|
Polish.send(method, 1, *variants).should == 'dom'
|
57
65
|
Polish.send(method, 2, *variants).should == 'domy'
|
58
66
|
Polish.send(method, 3, *variants).should == 'domy'
|
@@ -74,19 +82,19 @@ describe Polish do
|
|
74
82
|
Polish.send(method, 132, *variants).should == 'domy'
|
75
83
|
Polish.send(method, 3.14, *variants).should == 'domów'
|
76
84
|
end
|
77
|
-
|
85
|
+
|
78
86
|
it "should raise an exception when first parameter is not a number" do
|
79
|
-
lambda { Polish.send(method, nil, "dom", "domy", "domów") }.should
|
87
|
+
lambda { Polish.send(method, nil, "dom", "domy", "domów") }.should
|
80
88
|
raise_error(ArgumentError)
|
81
|
-
lambda { Polish.send(method, "dom", "domy", "domów", "domów") }.should
|
89
|
+
lambda { Polish.send(method, "dom", "domy", "domów", "domów") }.should
|
82
90
|
raise_error(ArgumentError)
|
83
91
|
end
|
84
|
-
|
92
|
+
|
85
93
|
it "should raise an exception when there are not enough variants" do
|
86
94
|
lambda { Polish.send(method, 1) }.should raise_error(ArgumentError)
|
87
|
-
lambda { Polish.send(method, 1, "dom") }.should
|
95
|
+
lambda { Polish.send(method, 1, "dom") }.should
|
88
96
|
raise_error(ArgumentError)
|
89
|
-
lambda { Polish.send(method, 1, "dom", "domy") }.should
|
97
|
+
lambda { Polish.send(method, 1, "dom", "domy") }.should
|
90
98
|
raise_error(ArgumentError)
|
91
99
|
end
|
92
100
|
end
|
data/spec/proxies_spec.rb
CHANGED
@@ -1,7 +1,9 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
|
1
3
|
require File.dirname(__FILE__) + '/spec_helper'
|
2
4
|
|
3
5
|
describe "with localize proxy" do
|
4
|
-
before(:
|
6
|
+
before(:each) do
|
5
7
|
@time = mock(:time)
|
6
8
|
@options = { :format => "%d %B %Y" }
|
7
9
|
end
|
@@ -29,7 +31,7 @@ describe "with translate proxy" do
|
|
29
31
|
end
|
30
32
|
|
31
33
|
describe "strftime" do
|
32
|
-
before(:
|
34
|
+
before(:each) do
|
33
35
|
@time = mock(:time)
|
34
36
|
end
|
35
37
|
|
metadata
CHANGED
@@ -1,52 +1,70 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: polish
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
prerelease:
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 1
|
9
|
-
- 1
|
10
|
-
version: 0.1.1
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.2
|
5
|
+
prerelease:
|
11
6
|
platform: ruby
|
12
|
-
authors:
|
7
|
+
authors:
|
13
8
|
- Grzesiek Kolodziejczyk
|
14
9
|
autorequire:
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
12
|
+
date: 2010-07-23 00:00:00.000000000Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: i18n
|
16
|
+
requirement: &70299917621100 !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
22
|
+
type: :runtime
|
22
23
|
prerelease: false
|
24
|
+
version_requirements: *70299917621100
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: rake
|
27
|
+
requirement: &70299917620600 !ruby/object:Gem::Requirement
|
28
|
+
none: false
|
29
|
+
requirements:
|
30
|
+
- - ! '>='
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0'
|
23
33
|
type: :runtime
|
24
|
-
|
25
|
-
version_requirements:
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: *70299917620600
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: bundler
|
38
|
+
requirement: &70299917619960 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
40
|
+
requirements:
|
41
|
+
- - ! '>='
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '0'
|
44
|
+
type: :runtime
|
45
|
+
prerelease: false
|
46
|
+
version_requirements: *70299917619960
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: rspec
|
49
|
+
requirement: &70299917619240 !ruby/object:Gem::Requirement
|
26
50
|
none: false
|
27
|
-
requirements:
|
28
|
-
- -
|
29
|
-
- !ruby/object:Gem::Version
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
- 3
|
35
|
-
version: 0.3.3
|
36
|
-
requirement: *id001
|
51
|
+
requirements:
|
52
|
+
- - ! '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 2.6.0
|
55
|
+
type: :development
|
56
|
+
prerelease: false
|
57
|
+
version_requirements: *70299917619240
|
37
58
|
description:
|
38
59
|
email: gkolodziejczyk@gmail.com
|
39
60
|
executables: []
|
40
|
-
|
41
61
|
extensions: []
|
42
|
-
|
43
|
-
|
44
|
-
- LICENSE
|
45
|
-
- README.md
|
46
|
-
- TODO
|
47
|
-
files:
|
62
|
+
extra_rdoc_files: []
|
63
|
+
files:
|
48
64
|
- .gitignore
|
65
|
+
- .travis.yml
|
49
66
|
- Gemfile
|
67
|
+
- Guardfile
|
50
68
|
- LICENSE
|
51
69
|
- README.md
|
52
70
|
- Rakefile
|
@@ -61,7 +79,6 @@ files:
|
|
61
79
|
- lib/polish/locale/datetime.yml
|
62
80
|
- lib/polish/locale/pluralize.rb
|
63
81
|
- lib/polish/proxies.rb
|
64
|
-
- lib/proxies.rb
|
65
82
|
- polish.gemspec
|
66
83
|
- rails/init.rb
|
67
84
|
- spec/fixtures/en.yml
|
@@ -72,41 +89,39 @@ files:
|
|
72
89
|
- spec/polish_spec.rb
|
73
90
|
- spec/proxies_spec.rb
|
74
91
|
- spec/spec_helper.rb
|
75
|
-
has_rdoc: true
|
76
92
|
homepage: http://github.com/grk/polish
|
77
93
|
licenses: []
|
78
|
-
|
79
94
|
post_install_message:
|
80
|
-
rdoc_options:
|
81
|
-
|
82
|
-
require_paths:
|
95
|
+
rdoc_options: []
|
96
|
+
require_paths:
|
83
97
|
- lib
|
84
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
98
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
85
99
|
none: false
|
86
|
-
requirements:
|
87
|
-
- -
|
88
|
-
- !ruby/object:Gem::Version
|
89
|
-
|
90
|
-
segments:
|
100
|
+
requirements:
|
101
|
+
- - ! '>='
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
segments:
|
91
105
|
- 0
|
92
|
-
|
93
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
106
|
+
hash: -3867562707409906689
|
107
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
94
108
|
none: false
|
95
|
-
requirements:
|
96
|
-
- -
|
97
|
-
- !ruby/object:Gem::Version
|
98
|
-
|
99
|
-
segments:
|
109
|
+
requirements:
|
110
|
+
- - ! '>='
|
111
|
+
- !ruby/object:Gem::Version
|
112
|
+
version: '0'
|
113
|
+
segments:
|
100
114
|
- 0
|
101
|
-
|
115
|
+
hash: -3867562707409906689
|
102
116
|
requirements: []
|
103
|
-
|
104
117
|
rubyforge_project:
|
105
|
-
rubygems_version: 1.
|
118
|
+
rubygems_version: 1.8.6
|
106
119
|
signing_key:
|
107
120
|
specification_version: 3
|
108
121
|
summary: Polish language support for Ruby and Rails
|
109
|
-
test_files:
|
122
|
+
test_files:
|
123
|
+
- spec/fixtures/en.yml
|
124
|
+
- spec/fixtures/pl.yml
|
110
125
|
- spec/i18n/locale/datetime_spec.rb
|
111
126
|
- spec/i18n/locale/pluralization_spec.rb
|
112
127
|
- spec/locale_spec.rb
|
data/lib/proxies.rb
DELETED