Permalink
Browse files

Revert "Reverting two i18n patches pulled in from the rails3 branch w…

…hich are not compatible with Rails 2.3.x."

This reverts commit 1469b53.
  • Loading branch information...
mjonuschat committed May 29, 2010
1 parent 20a7fa4 commit 743b26b921e7c9091863f77e054afb0eb0d84a67
Showing with 27 additions and 27 deletions.
  1. +2 −2 README.textile
  2. +7 −7 lib/formtastic.rb
  3. +8 −8 lib/formtastic/i18n.rb
  4. +6 −6 spec/commit_button_spec.rb
  5. +4 −4 spec/i18n_spec.rb
View
@@ -337,7 +337,7 @@ Formtastic supports localized *labels*, *hints*, *legends*, *actions* using the
title: "Choose a good title for you post."
body: "Write something inspiring here."
actions:
- create: "Create my {{model}}"
+ create: "Create my %{model}"
update: "Save changes"
dummie: "Launch!"
</pre>
@@ -354,7 +354,7 @@ Formtastic supports localized *labels*, *hints*, *legends*, *actions* using the
<%= form.input :section %> # => :label => I18n.t('activerecord.attributes.user.section') or 'Section'
<% end %>
<% form.buttons do %>
- <%= form.commit_button %> # => "Create my {{model}}"
+ <%= form.commit_button %> # => "Create my %{model}"
<% end %>
<% end %>
</pre>
View
@@ -1606,9 +1606,9 @@ def humanized_attribute_name(method) #:nodoc:
#
# Lookup priority:
#
- # 'formtastic.{{type}}.{{model}}.{{action}}.{{attribute}}'
- # 'formtastic.{{type}}.{{model}}.{{attribute}}'
- # 'formtastic.{{type}}.{{attribute}}'
+ # 'formtastic.%{type}.%{model}.%{action}.%{attribute}'
+ # 'formtastic.%{type}.%{model}.%{attribute}'
+ # 'formtastic.%{type}.%{attribute}'
#
# Example:
#
@@ -1633,10 +1633,10 @@ def localized_string(key, value, type, options = {}) #:nodoc:
defaults = ::Formtastic::I18n::SCOPES.collect do |i18n_scope|
i18n_path = i18n_scope.dup
- i18n_path.gsub!('{{action}}', action_name)
- i18n_path.gsub!('{{model}}', model_name)
- i18n_path.gsub!('{{nested_model}}', nested_model_name) unless nested_model_name.nil?
- i18n_path.gsub!('{{attribute}}', attribute_name)
+ i18n_path.gsub!('%{action}', action_name)
+ i18n_path.gsub!('%{model}', model_name)
+ i18n_path.gsub!('%{nested_model}', nested_model_name) unless nested_model_name.nil?
+ i18n_path.gsub!('%{attribute}', attribute_name)
i18n_path.gsub!('..', '.')
i18n_path.to_sym
end
View
@@ -6,16 +6,16 @@ module I18n
:required => 'required',
:yes => 'Yes',
:no => 'No',
- :create => 'Create {{model}}',
- :update => 'Update {{model}}'
+ :create => 'Create %{model}',
+ :update => 'Update %{model}'
}.freeze
SCOPES = [
- '{{model}}.{{nested_model}}.{{action}}.{{attribute}}',
- '{{model}}.{{action}}.{{attribute}}',
- '{{model}}.{{nested_model}}.{{attribute}}',
- '{{model}}.{{attribute}}',
- '{{nested_model}}.{{attribute}}',
- '{{attribute}}'
+ '%{model}.%{nested_model}.%{action}.%{attribute}',
+ '%{model}.%{action}.%{attribute}',
+ '%{model}.%{nested_model}.%{attribute}',
+ '%{model}.%{attribute}',
+ '%{nested_model}.%{attribute}',
+ '%{attribute}'
]
class << self
View
@@ -147,7 +147,7 @@
describe 'when no explicit label is provided' do
describe 'when no I18n-localized label is provided' do
before do
- ::I18n.backend.store_translations :en, :formtastic => {:submit => 'Submit {{model}}'}
+ ::I18n.backend.store_translations :en, :formtastic => {:submit => 'Submit %{model}'}
end
after do
@@ -183,7 +183,7 @@
:formtastic => {
:actions => {
:post => {
- :submit => 'Custom Submit {{model}}'
+ :submit => 'Custom Submit %{model}'
}
}
}
@@ -225,7 +225,7 @@
describe 'when no explicit label is provided' do
describe 'when no I18n-localized label is provided' do
before do
- ::I18n.backend.store_translations :en, :formtastic => {:create => 'Create {{model}}'}
+ ::I18n.backend.store_translations :en, :formtastic => {:create => 'Create %{model}'}
end
after do
@@ -261,7 +261,7 @@
:formtastic => {
:actions => {
:post => {
- :create => 'Custom Create {{model}}'
+ :create => 'Custom Create %{model}'
}
}
}
@@ -303,7 +303,7 @@
describe 'when no explicit label is provided' do
describe 'when no I18n-localized label is provided' do
before do
- ::I18n.backend.store_translations :en, :formtastic => {:update => 'Save {{model}}'}
+ ::I18n.backend.store_translations :en, :formtastic => {:update => 'Save %{model}'}
end
after do
@@ -340,7 +340,7 @@
:formtastic => {
:actions => {
:post => {
- :update => 'Custom Save {{model}}'
+ :update => 'Custom Save %{model}'
}
}
}
View
@@ -26,11 +26,11 @@
@formtastic_strings = {
:yes => 'Default Yes',
:no => 'Default No',
- :create => 'Default Create {{model}}',
- :update => 'Default Update {{model}}',
+ :create => 'Default Create %{model}',
+ :update => 'Default Update %{model}',
:custom_scope => {
:duck => 'Duck',
- :duck_pond => '{{ducks}} ducks in a pond'
+ :duck_pond => '%{ducks} ducks in a pond'
}
}
::I18n.backend.store_translations :en, :formtastic => @formtastic_strings
@@ -71,7 +71,7 @@
it "should use default strings" do
(::Formtastic::I18n::DEFAULT_VALUES.keys).each do |key|
- ::Formtastic::I18n.t(key, :model => '{{model}}').should == ::Formtastic::I18n::DEFAULT_VALUES[key]
+ ::Formtastic::I18n.t(key, :model => '%{model}').should == ::Formtastic::I18n::DEFAULT_VALUES[key]
end
end

0 comments on commit 743b26b

Please sign in to comment.