merb_global 0.0.5 → 0.0.5.1

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -6,7 +6,7 @@ require 'fileutils'
6
6
 
7
7
  PLUGIN = "merb_global"
8
8
  NAME = "merb_global"
9
- GEM_VERSION = "0.0.5"
9
+ GEM_VERSION = "0.0.5.1"
10
10
  AUTHORS = ["Alex Coles", "Maciej Piechotka"]
11
11
  EMAIL = "alex@alexcolesportfolio.com"
12
12
  HOMEPAGE = "http://trac.ikonoklastik.com/merb_global/"
@@ -21,7 +21,13 @@ module Merb
21
21
  n = Plural.which_form opts[:n], language.plural
22
22
  translation = Translation.find [language.id, singular, n]
23
23
  else
24
- translation = Translation.find [language.id, singular, nil]
24
+ # Bug of composite_primary_keys?
25
+ conditions = {
26
+ :language_id => language.id,
27
+ :msgid => singular,
28
+ :msgstr_index => nil
29
+ }
30
+ translation = Translation.find(:first, conditions)
25
31
  end
26
32
  return translation.msgstr
27
33
  end rescue nil
@@ -17,18 +17,24 @@ module Merb
17
17
  end
18
18
 
19
19
  def localize(singular, plural, opts)
20
- unless @lang.include? opts[:lang]
20
+ unless Merb.environment == "development"
21
+ lang = @lang
22
+ else
23
+ lang = {}
24
+ end
25
+
26
+ unless lang.include? opts[:lang]
21
27
  file = File.join Merb::Global::MessageProviders.localedir,
22
28
  opts[:lang] + '.yaml'
23
29
  if File.exist? file
24
- @lang[opts[:lang]] = YAML.load_file file
30
+ lang[opts[:lang]] = YAML.load_file file
25
31
  else
26
- @lang[opts[:lang]] = nil
32
+ lang[opts[:lang]] = nil
27
33
  end
28
34
  end
29
35
 
30
- unless @lang[opts[:lang]].nil?
31
- lang = @lang[opts[:lang]]
36
+ unless lang[opts[:lang]].nil?
37
+ lang = lang[opts[:lang]]
32
38
  unless lang[singular].nil?
33
39
  unless plural.nil?
34
40
  n = Merb::Global::Plural.which_form opts[:n], lang[:plural]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: merb_global
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alex Coles
@@ -10,7 +10,7 @@ autorequire: merb_global
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2008-07-29 00:00:00 +02:00
13
+ date: 2008-08-21 00:00:00 +02:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency