Permalink
Browse files

Fixed the code generation in the en file

  • Loading branch information...
ashrafuzzaman committed Jul 5, 2012
1 parent 5e53821 commit 98724c46496b6fea3bba7143a939d41bf663d782
Showing with 29 additions and 23 deletions.
  1. +29 −23 lib/generators/i18ize/i18ize_generator.rb
@@ -24,32 +24,38 @@ def files
end
def replace_hash
{"t(:created, :scope => [:msg, :#{singular_table_name}])" => "'#{human_name} was successfully created.'",
"t(:updated, :scope => [:msg, :#{singular_table_name}])" => "'#{human_name} was successfully updated.'",
"t(:destroy, :scope => [:msg, :#{singular_table_name}])" => "'Destroy'",
"t(:show, :scope => [:link, :#{singular_table_name}])" => "'Show'",
"t(:edit, :scope => [:link, :#{singular_table_name}])" => "'Edit'",
"t(:back, :scope => [:link, :#{singular_table_name}])" => "'Back'",
"t(:'destroy_confirm', :scope => [:link, :#{singular_table_name}])" => "'Are you sure?'",
"t(:new, :scope => [:link, :#{singular_table_name}])" => "'New #{human_name}'"}
end
def language_hash
{"msg.#{singular_table_name}.created" => "#{human_name} was successfully created.",
"msg.#{singular_table_name}.updated" => "#{human_name} was successfully updated.",
"msg.#{singular_table_name}.destroy_confirm" => "Are you sure?",
"link.#{singular_table_name}.show" => "Show",
"link.#{singular_table_name}.edit" => "Edit",
"link.#{singular_table_name}.back" => "Back",
"link.#{singular_table_name}.destroy" => "Destroy",
"link.#{singular_table_name}.new" => "New #{human_name}"}
{"t(:'msg.#{singular_table_name}.created')" => "'#{human_name} was successfully created.'",
"t(:'msg.#{singular_table_name}.updated')" => "'#{human_name} was successfully updated.'",
"t(:'msg.#{singular_table_name}.destroy')" => "'Destroy'",
"t(:'link.#{singular_table_name}.show')" => "'Show'",
"t(:'link.#{singular_table_name}.edit')" => "'Edit'",
"t(:'link.#{singular_table_name}.back')" => "'Back'",
"t(:'link.#{singular_table_name}.destroy_confirm')" => "'Are you sure?'",
"t(:'link.#{singular_table_name}.new')" => "'New #{human_name}'"}
end
def language_entries
lng_entries = ''
language_hash.each do |lng_key, str|
lng_entries += " #{lng_key}: #{str}\n"
end
lng_entries = "\n msg:\n"
lng_entries << " #{singular_table_name}:\n"
lng_entries << language_sub_entries({"created" => "#{human_name} was successfully created.",
"updated" => "#{human_name} was successfully updated.",
"destroy_confirm" => "Are you sure?"})
lng_entries << " link:\n"
lng_entries << " #{singular_table_name}:\n"
lng_entries << language_sub_entries({"show" => "Show",
"edit" => "Edit",
"back" => "Back",
"destroy" => "Destroy",
"new" => "New #{human_name}"})
lng_entries
end
def language_sub_entries(hash)
lng_entries = ''
hash.each do |lng_key, str|
lng_entries << " #{lng_key}: #{str}\n"
end
lng_entries
end
end

0 comments on commit 98724c4

Please sign in to comment.