russian 0.2.6 → 0.2.7

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,3 +1,8 @@
1
+ === 0.2.7 - 5.05.2010
2
+
3
+ * Fix using of standalone/non-standalone month names with %d/%e surroundings.
4
+ * Улучшено распознавание формы названия месяца с strftime макросами %d/%e.
5
+
1
6
  === 0.2.6 - 25.03.2010
2
7
 
3
8
  * Minimum Rails 3.0b support: Added fourth parameter (options) defaulting to nil to Advanced backend localize method for compliance with i18n-0.3 [Nikolay V. Nemshilov]
data/Rakefile CHANGED
@@ -5,7 +5,7 @@ require 'rubygems/specification'
5
5
  require 'date'
6
6
 
7
7
  GEM = "russian"
8
- GEM_VERSION = "0.2.6"
8
+ GEM_VERSION = "0.2.7"
9
9
  AUTHOR = "Yaroslav Markin"
10
10
  EMAIL = "yaroslav@markin.net"
11
11
  HOMEPAGE = "http://github.com/yaroslav/russian/"
@@ -29,7 +29,7 @@ module Russian
29
29
  module VERSION
30
30
  MAJOR = 0
31
31
  MINOR = 2
32
- TINY = 6
32
+ TINY = 7
33
33
 
34
34
  STRING = [MAJOR, MINOR, TINY].join('.')
35
35
  end
@@ -16,8 +16,8 @@ module I18n
16
16
  # for DateTime localization and usage of user-defined Proc (lambda) pluralization
17
17
  # methods in translation tables.
18
18
  class Advanced < Simple
19
- LOCALIZE_ABBR_MONTH_NAMES_MATCH = /(%d|%e)?(\s*)(%b)/
20
- LOCALIZE_MONTH_NAMES_MATCH = /(%d|%e)?(\s*)(%B)/
19
+ LOCALIZE_ABBR_MONTH_NAMES_MATCH = /(%d|%e)(.*)(%b)/
20
+ LOCALIZE_MONTH_NAMES_MATCH = /(%d|%e)(.*)(%B)/
21
21
  LOCALIZE_STANDALONE_ABBR_DAY_NAMES_MATCH = /^%a/
22
22
  LOCALIZE_STANDALONE_DAY_NAMES_MATCH = /^%A/
23
23
 
@@ -61,18 +61,18 @@ module I18n
61
61
 
62
62
  if lookup(locale, :"date.standalone_abbr_month_names")
63
63
  format.gsub!(LOCALIZE_ABBR_MONTH_NAMES_MATCH) do
64
- $1 ? $1 + $2 + translate(locale, :"date.abbr_month_names")[object.mon] :
65
- $2 + translate(locale, :"date.standalone_abbr_month_names")[object.mon]
64
+ $1 + $2 + translate(locale, :"date.abbr_month_names")[object.mon]
66
65
  end
66
+ format.gsub!(/%b/, translate(locale, :"date.standalone_abbr_month_names")[object.mon])
67
67
  else
68
68
  format.gsub!(/%b/, translate(locale, :"date.abbr_month_names")[object.mon])
69
69
  end
70
70
 
71
71
  if lookup(locale, :"date.standalone_month_names")
72
72
  format.gsub!(LOCALIZE_MONTH_NAMES_MATCH) do
73
- $1 ? $1 + $2 + translate(locale, :"date.month_names")[object.mon] :
74
- $2 + translate(locale, :"date.standalone_month_names")[object.mon]
73
+ $1 + $2 + translate(locale, :"date.month_names")[object.mon]
75
74
  end
75
+ format.gsub!(/%B/, translate(locale, :"date.standalone_month_names")[object.mon])
76
76
  else
77
77
  format.gsub!(/%B/, translate(locale, :"date.month_names")[object.mon])
78
78
  end
@@ -4,6 +4,7 @@ require File.dirname(__FILE__) + '/../../spec_helper'
4
4
 
5
5
  describe I18n, "Russian Date/Time localization" do
6
6
  before(:all) do
7
+ Russian.init_i18n
7
8
  @date = Date.parse("1985-12-01")
8
9
  @time = Time.local(1985, 12, 01, 16, 05)
9
10
  end
@@ -43,6 +44,9 @@ describe I18n, "Russian Date/Time localization" do
43
44
  it "should use month names" do
44
45
  l(@date, :format => "%d %B").should == "01 декабря"
45
46
  l(@date, :format => "%e %B %Y").should == " 1 декабря 1985"
47
+ l(@date, :format => "<b>%d</b> %B").should == "<b>01</b> декабря"
48
+ l(@date, :format => "<strong>%e</strong> %B %Y").should == "<strong> 1</strong> декабря 1985"
49
+ l(@date, :format => "А было тогда %eе число %B %Y").should == "А было тогда 1е число декабря 1985"
46
50
  end
47
51
 
48
52
  it "should use standalone month names" do
@@ -54,6 +58,8 @@ describe I18n, "Russian Date/Time localization" do
54
58
  @date = Date.parse("1985-03-01")
55
59
  l(@date, :format => "%d %b").should == "01 марта"
56
60
  l(@date, :format => "%e %b %Y").should == " 1 марта 1985"
61
+ l(@date, :format => "<b>%d</b> %b").should == "<b>01</b> марта"
62
+ l(@date, :format => "<strong>%e</strong> %b %Y").should == "<strong> 1</strong> марта 1985"
57
63
  end
58
64
 
59
65
  it "should use standalone abbreviated month names" do
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 2
8
- - 6
9
- version: 0.2.6
8
+ - 7
9
+ version: 0.2.7
10
10
  platform: ruby
11
11
  authors:
12
12
  - Yaroslav Markin
@@ -14,7 +14,7 @@ autorequire: russian
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-03-25 00:00:00 +03:00
17
+ date: 2010-05-05 00:00:00 +04:00
18
18
  default_executable:
19
19
  dependencies: []
20
20