polish 0.0.4 → 0.0.5
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/README.md +0 -2
- data/Rakefile +1 -1
- data/lib/polish.rb +2 -3
- data/lib/polish/backend/advanced.rb +9 -7
- data/lib/polish/locale/actionview.yml +17 -0
- data/lib/polish/locale/activerecord.yml +2 -1
- data/lib/polish/locale/datetime.yml +1 -1
- data/spec/i18n/locale/datetime_spec.rb +4 -1
- data/spec/locale_spec.rb +4 -1
- data/spec/polish_spec.rb +3 -2
- metadata +9 -4
data/README.md
CHANGED
data/Rakefile
CHANGED
data/lib/polish.rb
CHANGED
@@ -27,7 +27,7 @@ module Polish
|
|
27
27
|
module VERSION
|
28
28
|
MAJOR = 0
|
29
29
|
MINOR = 0
|
30
|
-
TINY =
|
30
|
+
TINY = 5
|
31
31
|
|
32
32
|
STRING = [MAJOR, MINOR, TINY].join('.')
|
33
33
|
end
|
@@ -47,11 +47,10 @@ module Polish
|
|
47
47
|
I18n::Backend::Advanced
|
48
48
|
end
|
49
49
|
|
50
|
-
# Init Polish i18n: set custom backend,
|
50
|
+
# Init Polish i18n: set custom backend,
|
51
51
|
# load all translations shipped with library.
|
52
52
|
def init_i18n
|
53
53
|
I18n.backend = Polish.i18n_backend_class.new
|
54
|
-
I18n.default_locale = LOCALE
|
55
54
|
I18n.load_path.unshift(*locale_files)
|
56
55
|
end
|
57
56
|
|
@@ -8,8 +8,8 @@ module I18n
|
|
8
8
|
# for DateTime localization and usage of user-defined Proc (lambda) pluralization
|
9
9
|
# methods in translation tables.
|
10
10
|
class Advanced < Simple
|
11
|
-
LOCALIZE_ABBR_MONTH_NAMES_MATCH = /(%d
|
12
|
-
LOCALIZE_MONTH_NAMES_MATCH = /(%d
|
11
|
+
LOCALIZE_ABBR_MONTH_NAMES_MATCH = /(%d|%e)(.*)(%b)/
|
12
|
+
LOCALIZE_MONTH_NAMES_MATCH = /(%d|%e)(.*)(%B)/
|
13
13
|
LOCALIZE_STANDALONE_ABBR_DAY_NAMES_MATCH = /^%a/
|
14
14
|
LOCALIZE_STANDALONE_DAY_NAMES_MATCH = /^%A/
|
15
15
|
|
@@ -19,7 +19,9 @@ module I18n
|
|
19
19
|
#
|
20
20
|
# Note that it differs from <tt>localize</tt> in Simple< backend by checking for
|
21
21
|
# "standalone" month name/day name keys in translation and using them if available.
|
22
|
-
|
22
|
+
#
|
23
|
+
# <tt>options</tt> parameter added for i18n-0.3 compliance.
|
24
|
+
def localize(locale, object, format = :default, options = nil)
|
23
25
|
raise ArgumentError, "Object must be a Date, DateTime or Time object. #{object.inspect} given." unless object.respond_to?(:strftime)
|
24
26
|
type = object.respond_to?(:sec) ? 'time' : 'date'
|
25
27
|
# TODO only translate these if format is a String?
|
@@ -45,18 +47,18 @@ module I18n
|
|
45
47
|
|
46
48
|
if lookup(locale, :"date.standalone_abbr_month_names")
|
47
49
|
format.gsub!(LOCALIZE_ABBR_MONTH_NAMES_MATCH) do
|
48
|
-
$1
|
49
|
-
$2 + translate(locale, :"date.standalone_abbr_month_names")[object.mon]
|
50
|
+
$1 + $2 + translate(locale, :"date.abbr_month_names")[object.mon]
|
50
51
|
end
|
52
|
+
format.gsub!(/%b/, translate(locale, :"date.standalone_abbr_month_names")[object.mon])
|
51
53
|
else
|
52
54
|
format.gsub!(/%b/, translate(locale, :"date.abbr_month_names")[object.mon])
|
53
55
|
end
|
54
56
|
|
55
57
|
if lookup(locale, :"date.standalone_month_names")
|
56
58
|
format.gsub!(LOCALIZE_MONTH_NAMES_MATCH) do
|
57
|
-
$1
|
58
|
-
$2 + translate(locale, :"date.standalone_month_names")[object.mon]
|
59
|
+
$1 + $2 + translate(locale, :"date.month_names")[object.mon]
|
59
60
|
end
|
61
|
+
format.gsub!(/%B/, translate(locale, :"date.standalone_month_names")[object.mon])
|
60
62
|
else
|
61
63
|
format.gsub!(/%B/, translate(locale, :"date.month_names")[object.mon])
|
62
64
|
end
|
@@ -10,6 +10,9 @@ pl:
|
|
10
10
|
currency:
|
11
11
|
format:
|
12
12
|
format: "%n %u"
|
13
|
+
separator: ","
|
14
|
+
delimiter: ""
|
15
|
+
precision: 2
|
13
16
|
unit: "PLN"
|
14
17
|
percentage:
|
15
18
|
format:
|
@@ -53,12 +56,15 @@ pl:
|
|
53
56
|
other: "{{count}} minut"
|
54
57
|
about_x_hours:
|
55
58
|
one: "około godziny"
|
59
|
+
few: "około {{count}} godzin"
|
56
60
|
other: "około {{count}} godzin"
|
57
61
|
x_days:
|
58
62
|
one: "1 dzień"
|
63
|
+
few: "{{count}} dni"
|
59
64
|
other: "{{count}} dni"
|
60
65
|
about_x_months:
|
61
66
|
one: "około miesiąca"
|
67
|
+
few: "około {{count}} miesięcy"
|
62
68
|
other: "około {{count}} miesięcy"
|
63
69
|
x_months:
|
64
70
|
one: "1 miesiąc"
|
@@ -66,6 +72,7 @@ pl:
|
|
66
72
|
other: "{{count}} miesięcy"
|
67
73
|
about_x_years:
|
68
74
|
one: "około roku"
|
75
|
+
few: "około {{count}} lat"
|
69
76
|
other: "około {{count}} lat"
|
70
77
|
over_x_years:
|
71
78
|
one: "ponad rok"
|
@@ -79,6 +86,16 @@ pl:
|
|
79
86
|
minute: "Minuta"
|
80
87
|
second: "Sekunda"
|
81
88
|
|
89
|
+
helpers:
|
90
|
+
select:
|
91
|
+
# Default value for :prompt => true in FormOptionsHelper
|
92
|
+
prompt: "Proszę wybrać"
|
93
|
+
|
94
|
+
submit:
|
95
|
+
create: 'Utwórz %{model}'
|
96
|
+
update: 'Aktualizuj %{model}'
|
97
|
+
submit: 'Zapisz %{model}'
|
98
|
+
|
82
99
|
activerecord:
|
83
100
|
errors:
|
84
101
|
template:
|
@@ -2,6 +2,7 @@ pl:
|
|
2
2
|
activerecord:
|
3
3
|
errors:
|
4
4
|
messages:
|
5
|
+
record_invalid: "Znaleziono błędy: %{errors}"
|
5
6
|
inclusion: "nie znajduje się na liście dopuszczalnych wartości"
|
6
7
|
exclusion: "znajduje się na liście zabronionych wartości"
|
7
8
|
invalid: "jest nieprawidłowe"
|
@@ -18,7 +19,7 @@ pl:
|
|
18
19
|
few: "jest za krótkie (minimalnie {{count}} znaki)"
|
19
20
|
other: "jest za krótkie (minimalnie {{count}} znaków)"
|
20
21
|
wrong_length: "jest nieprawidłowej długości (powinna wynosić {{count}} znaków)"
|
21
|
-
taken: "
|
22
|
+
taken: "jest już zajęte"
|
22
23
|
not_a_number: "nie jest liczbą"
|
23
24
|
greater_than: "musi być większe niż {{count}}"
|
24
25
|
greater_than_or_equal_to: "musi być większe lub równe {{count}}"
|
@@ -14,7 +14,7 @@ pl:
|
|
14
14
|
standalone_month_names: [~, Styczeń, Luty, Marzec, Kwiecień, Maj, Czerwiec, Lipiec, Sierpień, Wrzesień, Październik, Listopad, Grudzień]
|
15
15
|
abbr_month_names: [~, sty., lut., mar., kwi., maj., cze., lip., sie., wrz., paź., lis., gru.]
|
16
16
|
standalone_abbr_month_names: [~, Sty., Lut., Mar., Kwi., Maj., Cze., Lip., Sie., Wrz., Paź., Lis., Gru.]
|
17
|
-
order: [ :
|
17
|
+
order: [ :day, :month, :year ]
|
18
18
|
|
19
19
|
time:
|
20
20
|
formats:
|
@@ -41,6 +41,9 @@ describe I18n, "Polish Date/Time localization" do
|
|
41
41
|
it "should use month names" do
|
42
42
|
l(@date, :format => "%d %B").should == "01 grudnia"
|
43
43
|
l(@date, :format => "%e %B %Y").should == " 1 grudnia 1985"
|
44
|
+
l(@date, :format => "<b>%d</b> %B").should == "<b>01</b> grudnia"
|
45
|
+
l(@date, :format => "<strong>%e</strong> %B %Y").should == "<strong> 1</strong> grudnia 1985"
|
46
|
+
l(@date, :format => "A było to dnia %ego miesiąca %B %Y").should == "A było to dnia 1go miesiąca grudnia 1985"
|
44
47
|
end
|
45
48
|
|
46
49
|
it "should use standalone month names" do
|
@@ -62,7 +65,7 @@ describe I18n, "Polish Date/Time localization" do
|
|
62
65
|
end
|
63
66
|
|
64
67
|
it "should define default date components order: year, month, day" do
|
65
|
-
I18n.backend.translate(Polish.locale, :"date.order").should == [:
|
68
|
+
I18n.backend.translate(Polish.locale, :"date.order").should == [:day, :month, :year]
|
66
69
|
end
|
67
70
|
|
68
71
|
describe "with time formats" do
|
data/spec/locale_spec.rb
CHANGED
@@ -71,7 +71,10 @@ describe Polish, "loading locales" do
|
|
71
71
|
activerecord.errors.template.header
|
72
72
|
activerecord.errors.template.body
|
73
73
|
|
74
|
-
|
74
|
+
helpers.select.prompt
|
75
|
+
helpers.submit.create
|
76
|
+
helpers.submit.update
|
77
|
+
helpers.submit.submit
|
75
78
|
).each do |key|
|
76
79
|
it "should define '#{key}' in actionview translations" do
|
77
80
|
lookup(key).should_not be_nil
|
data/spec/polish_spec.rb
CHANGED
@@ -48,9 +48,10 @@ describe Polish do
|
|
48
48
|
I18n.t(:'date.formats.default', :locale => :'pl').should == "override"
|
49
49
|
end
|
50
50
|
|
51
|
-
it "should
|
51
|
+
it "should not change default locale" do
|
52
|
+
locale = I18n.default_locale
|
52
53
|
Polish.init_i18n
|
53
|
-
I18n.default_locale.should ==
|
54
|
+
I18n.default_locale.should == locale
|
54
55
|
end
|
55
56
|
end
|
56
57
|
|
metadata
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: polish
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
+
hash: 21
|
4
5
|
prerelease: false
|
5
6
|
segments:
|
6
7
|
- 0
|
7
8
|
- 0
|
8
|
-
-
|
9
|
-
version: 0.0.
|
9
|
+
- 5
|
10
|
+
version: 0.0.5
|
10
11
|
platform: ruby
|
11
12
|
authors:
|
12
13
|
- Grzesiek Kolodziejczyk
|
@@ -14,7 +15,7 @@ autorequire: polish
|
|
14
15
|
bindir: bin
|
15
16
|
cert_chain: []
|
16
17
|
|
17
|
-
date: 2010-
|
18
|
+
date: 2010-07-21 00:00:00 +02:00
|
18
19
|
default_executable:
|
19
20
|
dependencies: []
|
20
21
|
|
@@ -121,23 +122,27 @@ rdoc_options: []
|
|
121
122
|
require_paths:
|
122
123
|
- lib
|
123
124
|
required_ruby_version: !ruby/object:Gem::Requirement
|
125
|
+
none: false
|
124
126
|
requirements:
|
125
127
|
- - ">="
|
126
128
|
- !ruby/object:Gem::Version
|
129
|
+
hash: 3
|
127
130
|
segments:
|
128
131
|
- 0
|
129
132
|
version: "0"
|
130
133
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
134
|
+
none: false
|
131
135
|
requirements:
|
132
136
|
- - ">="
|
133
137
|
- !ruby/object:Gem::Version
|
138
|
+
hash: 3
|
134
139
|
segments:
|
135
140
|
- 0
|
136
141
|
version: "0"
|
137
142
|
requirements: []
|
138
143
|
|
139
144
|
rubyforge_project:
|
140
|
-
rubygems_version: 1.3.
|
145
|
+
rubygems_version: 1.3.7
|
141
146
|
signing_key:
|
142
147
|
specification_version: 3
|
143
148
|
summary: Polish language support for Ruby and Rails
|