rich_i18n 1.3.2 → 1.3.3

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,5 +1,10 @@
1
1
  = Rich-i18n CHANGELOG
2
2
 
3
+ == Version 1.3.3 (November 10, 2010)
4
+
5
+ * Fixed the disappearing translations after updating them in the front-end by delegating :as_json to @string
6
+ * Being able to preserve the :capitalize option of translations which fixes the downcased translation after updating a Formtastic label
7
+
3
8
  == Version 1.3.2 (November 9, 2010)
4
9
 
5
10
  * Fixed the Rails generators once and for all
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.3.2
1
+ 1.3.3
@@ -1,7 +1,8 @@
1
1
  class <%= model_class_name %> < ActiveRecord::Base
2
2
 
3
3
  def to_rich_cms_response(params)
4
- {:value => value, :translations => Hash[*params[:derivative_keys].split(";").uniq.collect{|x| [x, x.t({:as => params[:editable_input_type]})]}.flatten]}
4
+ options = {:as => params[:editable_input_type], :capitalize => %w(true 1).include?(params[:capitalize])}
5
+ {:value => value, :translations => Hash[*params[:derivative_keys].split(";").uniq.collect{|x| [x, x.t(options)]}.flatten]}
5
6
  end
6
7
 
7
8
  end
@@ -4,7 +4,9 @@ module Rich
4
4
  module Core
5
5
 
6
6
  class EnrichedString
7
+
7
8
  attr_reader :meta_data, :merged_strings
9
+ delegate :as_json, :to_json, :to_str, :to => :@string
8
10
 
9
11
  def initialize(string = "", meta = nil, merged = nil)
10
12
  @string = string.dup
@@ -32,10 +34,6 @@ module Rich
32
34
  dup.concat(other)
33
35
  end
34
36
 
35
- def to_str
36
- @string
37
- end
38
-
39
37
  def to_s
40
38
  (@merged_strings || [self]).collect(&:to_tag).join("").html_safe
41
39
  end
@@ -58,7 +56,7 @@ module Rich
58
56
  tag = :i18n
59
57
  attrs = []
60
58
 
61
- keys = [:key, :value, :locale, :derivative_key]
59
+ keys = [:key, :value, :locale, :derivative_key, :capitalize]
62
60
  data = @meta_data.reject{|k, v| !keys.include?(k.to_sym)}
63
61
 
64
62
  data[:editable_input_type] = editable_input_type
@@ -69,7 +69,7 @@ module Rich
69
69
  private
70
70
 
71
71
  RICH_I18N_OPTIONS = %w(count pluralize capitalize translate_callback)
72
- RICH_CMS_OPTIONS = %w(tag html as)
72
+ RICH_CMS_OPTIONS = %w(tag html as capitalize)
73
73
 
74
74
  LOGGER_PROC = Proc.new{|translation, key, options| Rich::I18n::Engine.logger.try :info, "== RICH-I18N: I18n.t #{key.inspect}, #{options.inspect}"}
75
75
 
@@ -1,7 +1,8 @@
1
1
  class <%= model_class_name %> < ActiveRecord::Base
2
2
 
3
3
  def to_rich_cms_response(params)
4
- {:value => value, :translations => Hash[*params[:derivative_keys].split(";").uniq.collect{|x| [x, x.t({:as => params[:editable_input_type]})]}.flatten]}
4
+ options = {:as => params[:editable_input_type], :capitalize => %w(true 1).include?(params[:capitalize])}
5
+ {:value => value, :translations => Hash[*params[:derivative_keys].split(";").uniq.collect{|x| [x, x.t(options)]}.flatten]}
5
6
  end
6
7
 
7
8
  end
data/rich_i18n.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{rich_i18n}
8
- s.version = "1.3.2"
8
+ s.version = "1.3.3"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Paul Engel"]
12
- s.date = %q{2010-11-09}
12
+ s.date = %q{2010-11-10}
13
13
  s.description = %q{Rich-i18n is a module of E9s (http://github.com/archan937/e9s) which enriches I18n, Formtastic, the String and Symbol classes. This simplifies internationalization of your Rails application making a Rails developers life much easier.}
14
14
  s.email = %q{paul.engel@holder.nl}
15
15
  s.extra_rdoc_files = [
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rich_i18n
3
3
  version: !ruby/object:Gem::Version
4
- hash: 31
4
+ hash: 29
5
5
  prerelease: false
6
6
  segments:
7
7
  - 1
8
8
  - 3
9
- - 2
10
- version: 1.3.2
9
+ - 3
10
+ version: 1.3.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - Paul Engel
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-11-09 00:00:00 +01:00
18
+ date: 2010-11-10 00:00:00 +01:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency