genki-merb_babel 0.1.0.2 → 0.1.0.7

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.0.2"
8
+ GEM_VERSION = "0.1.0.7"
9
9
  AUTHOR = "Matt Aimonetti"
10
10
  EMAIL = "mattaimonetti@gmail.com"
11
11
  HOMEPAGE = "http://github.com/mattetti/merb_babel/"
@@ -1,4 +1,4 @@
1
- module CountryGuesser
1
+ module LocaleDetector
2
2
  LANGUAGE_TO_COUNTRY = {
3
3
  "nn"=>["NO"],
4
4
  "uk"=>["UA"],
@@ -1,7 +1,7 @@
1
1
  module MI18n
2
2
 
3
3
  def self.lookup(options)
4
- key = options[:key]
4
+ key = options[:key].to_s.intern
5
5
  language = options[:language]
6
6
  country = options[:country]
7
7
  raise ArgumentError, "You need to pass a language reference" unless language
@@ -14,16 +14,17 @@ module MI18n
14
14
  if full_location
15
15
  return full_location
16
16
  else
17
- return ML10n.localizations[language][key]
17
+ return ML10n.localizations[language][key] || key
18
18
  end
19
19
  end
20
20
 
21
21
  def self.lookup_with_full_locale(key, language, country)
22
+ country = country.to_s.intern
22
23
  if ML10n.localizations.has_key?(language)
23
- ML10n.localizations[language].has_key?(country) ? ML10n.localizations[language][country][key] : nil
24
+ ML10n.localizations[language].has_key?(country) ? ML10n.localizations[language][country][key.to_s] : nil
24
25
  else
25
26
  nil
26
27
  end
27
28
  end
28
29
 
29
- end
30
+ end
@@ -60,7 +60,7 @@ module ML10n
60
60
  def find_localization_files
61
61
  l_files = []
62
62
  ML10n.localization_dirs.map do |l_dir|
63
- Dir["#{l_dir}/*", '*.{yml,yaml}'].each do |file|
63
+ Dir["#{l_dir}/*"].each do |file|
64
64
  l_files << file unless l_files.include?(file)
65
65
  end
66
66
  end
@@ -115,4 +115,4 @@ module ML10n
115
115
 
116
116
  end
117
117
 
118
- end
118
+ end
@@ -1,4 +1,4 @@
1
- require 'merb_babel/country_guesser'
1
+ require 'merb_babel/locale_detector'
2
2
  require 'locale'
3
3
 
4
4
  # The MLocale module helps you set up a locale, language, country
@@ -20,7 +20,7 @@ module MLocale
20
20
  return nil if result.nil?
21
21
  language = result.language
22
22
  country = result.country ||
23
- CountryGuesser.country_from_language(language)
23
+ LocaleDetector.country_from_language(language)
24
24
  request.env[:locale] = "#{language}-#{country}"
25
25
  end
26
26
  end
@@ -37,7 +37,7 @@ module MLocale
37
37
 
38
38
  # The country is used when localizing currency or time
39
39
  def country
40
- request.env[:country] || params[:country] || country_from_locale || (session ? session[:country] : nil) || CountryGuesser.country_from_language(language) || default_country
40
+ request.env[:country] || params[:country] || country_from_locale || (session ? session[:country] : nil) || LocaleDetector.country_from_language(language) || default_country
41
41
  end
42
42
 
43
43
  # Extract the language from the locale
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.0.2
4
+ version: 0.1.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Aimonetti
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-01-04 00:00:00 -08:00
12
+ date: 2009-01-12 00:00:00 -08:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -47,7 +47,7 @@ files:
47
47
  - TODO
48
48
  - lib/merb_babel
49
49
  - lib/merb_babel/core_ext.rb
50
- - lib/merb_babel/country_guesser.rb
50
+ - lib/merb_babel/locale_detector.rb
51
51
  - lib/merb_babel/m_i18n.rb
52
52
  - lib/merb_babel/m_l10n.rb
53
53
  - lib/merb_babel/m_locale.rb