genki-merb_babel 0.1.1.2 → 0.1.1.3

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -5,7 +5,7 @@ require 'merb-core'
5
5
  require 'merb-core/tasks/merb'
6
6
 
7
7
  GEM_NAME = "merb_babel"
8
- GEM_VERSION = "0.1.1.2"
8
+ GEM_VERSION = "0.1.1.3"
9
9
  AUTHOR = "Matt Aimonetti"
10
10
  EMAIL = "mattaimonetti@gmail.com"
11
11
  HOMEPAGE = "http://github.com/mattetti/merb_babel/"
@@ -23,7 +23,7 @@ spec = Gem::Specification.new do |s|
23
23
  s.author = AUTHOR
24
24
  s.email = EMAIL
25
25
  s.homepage = HOMEPAGE
26
- s.add_dependency('merb', '>= 1.0.7.1')
26
+ s.add_dependency('merb-core', '>= 1.0')
27
27
  s.add_dependency('locale', '>= 0.9.0')
28
28
  s.require_path = 'lib'
29
29
  s.files = %w(LICENSE README.markdown Rakefile TODO) + Dir.glob("{lib,spec}/**/*")
@@ -113,7 +113,10 @@ module ML10n
113
113
  table_for["AbbrDayNames", object.wday, "%a"]
114
114
  end
115
115
  format.gsub!(/%A/) do
116
- table_for["AbbrMonthNames", object.mon - 1, "%A"]
116
+ table_for["DayNames", object.wday, "%A"]
117
+ end
118
+ format.gsub!(/%b/) do
119
+ table_for["AbbrMonthNames", object.mon - 1, "%b"]
117
120
  end
118
121
  format.gsub!(/%B/) do
119
122
  table_for["MonthNames", object.mon - 1, "%B"]
@@ -1,5 +1,3 @@
1
- require 'merb_babel/locale_detector'
2
- require 'locale'
3
1
 
4
2
  # The MLocale module helps you set up a locale, language, country
5
3
  # You don't have to use a locale, in some cases you might just want to use the language
@@ -78,6 +76,15 @@ module MLocale
78
76
  /(.+)\-([a-z]{2})/i
79
77
  end
80
78
 
79
+ # You can extend this method in application.rb
80
+ # example:
81
+ #
82
+ # def set_locale
83
+ # super
84
+ # session[:language] = language
85
+ # end
86
+ #
87
+ #
81
88
  # takes a locale as in fr-FR or en-US
82
89
  def set_locale
83
90
  if locale =~ locale_regexp
@@ -93,4 +100,4 @@ module MLocale
93
100
  def set_language
94
101
  request.env[:language] = language.downcase
95
102
  end
96
- end
103
+ end
data/lib/merb_babel.rb CHANGED
@@ -14,6 +14,9 @@ if defined?(Merb::Plugins)
14
14
  require File.join(File.dirname(__FILE__) / "merb_babel" / "m_locale")
15
15
  require File.join(File.dirname(__FILE__) / "merb_babel" / "m_l10n")
16
16
  require File.join(File.dirname(__FILE__) / "merb_babel" / "m_i18n")
17
+ require File.join(File.dirname(__FILE__) / "merb_babel" / 'locale_detector')
18
+ gem "locale"
19
+ require 'locale'
17
20
 
18
21
  Merb::BootLoader.before_app_loads do
19
22
  # require code that must be loaded before the application
data/spec/lang/en.yml CHANGED
@@ -20,3 +20,6 @@ night:
20
20
 
21
21
  DateFormat:
22
22
  AbbrDayNames: ["S", "M", "T", "W", "T", "F", "S"]
23
+ DayNames: [Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday]
24
+ AbbrMonthNames: [Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, Dec]
25
+ MonthNames: [January, February, March, April, May, June, July, August, September, October, November, December]
data/spec/lang/ja.yml CHANGED
@@ -20,4 +20,7 @@ night:
20
20
 
21
21
  DateFormat:
22
22
  AbbrDayNames: ["日", "月", "火", "水", "木", "金", "土"]
23
+ DayNames: [日曜日, 月曜日, 火曜日, 水曜日, 木曜日, 金曜日, 土曜日]
24
+ AbbrMonthNames: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]
25
+ MonthNames: [1月, 2月, 3月, 4月, 5月, 6月, 7月, 8月, 9月, 10月, 11月, 12月]
23
26
  AmPm: ["午前", "午後"]
data/spec/m_i18n_spec.rb CHANGED
@@ -62,6 +62,10 @@ describe '#babelize' do
62
62
  @c.t("%a/%d", date, :language => 'en').should == "T/01"
63
63
  @c.t("%a/%d", date, :language => 'en', :country => 'UK').should == "T/01"
64
64
  @c.t("%a/%d", date, :language => 'ja').should == "木/01"
65
+ @c.t("%A", date, :language => 'ja').should == "木曜日"
66
+ @c.t("%b", date, :language => 'en').should == "Jan"
67
+ @c.t("%B", date, :language => 'en').should == "January"
68
+ @c.t("%B", date, :language => 'ja').should == "1月"
65
69
  end
66
70
 
67
71
  it "should localize time" do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: genki-merb_babel
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1.2
4
+ version: 0.1.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Aimonetti
@@ -9,17 +9,17 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-01-17 00:00:00 -08:00
12
+ date: 2009-01-18 00:00:00 -08:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
- name: merb
16
+ name: merb-core
17
17
  version_requirement:
18
18
  version_requirements: !ruby/object:Gem::Requirement
19
19
  requirements:
20
20
  - - ">="
21
21
  - !ruby/object:Gem::Version
22
- version: 1.0.7.1
22
+ version: "1.0"
23
23
  version:
24
24
  - !ruby/object:Gem::Dependency
25
25
  name: locale