Permalink
Browse files

Add translation code where missing

  • Loading branch information...
1 parent 48a81cf commit 79f3c8bd15d943c07259a5b81ace59c74b3b848e @kaapa kaapa committed Nov 18, 2010
@@ -40,7 +40,7 @@ def list
def new
@object = @abstract_model.new
- @page_name = action_name.capitalize + " " + @abstract_model.pretty_name.downcase
+ @page_name = t("admin.actions.create").capitalize + " " + @model_config.create.label.downcase
@page_type = @abstract_model.pretty_name.downcase
render :layout => 'rails_admin/form'
end
@@ -49,7 +49,7 @@ def create
@modified_assoc = []
@object = @abstract_model.new
@object.send :attributes=, @attributes, false
- @page_name = action_name.capitalize + " " + @abstract_model.pretty_name.downcase
+ @page_name = t("admin.actions.create").capitalize + " " + @model_config.create.label.downcase
@page_type = @abstract_model.pretty_name.downcase
if @object.save && update_all_associations
@@ -60,15 +60,15 @@ def create
end
def edit
- @page_name = action_name.capitalize + " " + @abstract_model.pretty_name.downcase
+ @page_name = t("admin.actions.update").capitalize + " " + @model_config.update.label.downcase
@page_type = @abstract_model.pretty_name.downcase
render :layout => 'rails_admin/form'
end
def update
@modified_assoc = []
- @page_name = action_name.capitalize + " " + @abstract_model.pretty_name.downcase
+ @page_name = t("admin.actions.update").capitalize + " " + @model_config.update.label.downcase
@page_type = @abstract_model.pretty_name.downcase
@old_object = @object.clone
@@ -82,15 +82,15 @@ def update
end
def delete
- @page_name = action_name.capitalize + " " + @abstract_model.pretty_name.downcase
+ @page_name = t("admin.actions.delete").capitalize + " " + @model_config.list.label.downcase
@page_type = @abstract_model.pretty_name.downcase
render :layout => 'rails_admin/delete'
end
def destroy
@object = @object.destroy
- flash[:notice] = t("admin.delete.flash_confirmation", :name => @abstract_model.pretty_name)
+ flash[:notice] = t("admin.delete.flash_confirmation", :name => @model_config.list.label)
check_history
@@ -124,7 +124,7 @@ def get_history
def show_history
@page_type = @abstract_model.pretty_name.downcase
- @page_name = t("admin.history.page_name", :name => @abstract_model.pretty_name)
+ @page_name = t("admin.history.page_name", :name => @model_config.list.label)
@general = true
options = {}
@@ -21,7 +21,7 @@
</li>
<li>
&rsaquo;
- <%= link_to(@abstract_model.pretty_name, rails_admin_list_path(:model_name => @abstract_model.to_param)) %>
+ <%= link_to(@model_config.list.label, rails_admin_list_path(:model_name => @abstract_model.to_param)) %>
</li>
<li>
&rsaquo;
@@ -53,7 +53,7 @@
</li>
<li>
&rsaquo;
- <%= link_to(@abstract_model.pretty_name, rails_admin_list_path(:model_name => @abstract_model.to_param)) %>
+ <%= link_to(@model_config.update.label, rails_admin_list_path(:model_name => @abstract_model.to_param)) %>
</li>
<li>
&rsaquo;
@@ -73,7 +73,7 @@
</li>
<li>
&rsaquo;
- <%= link_to(@abstract_model.pretty_name, rails_admin_list_path(:model_name => @abstract_model.to_param)) %>
+ <%= link_to(@model_config.list.label, rails_admin_list_path(:model_name => @abstract_model.to_param)) %>
</li>
<% if @history %>
<li>
@@ -95,7 +95,7 @@
<% if @page_count.to_i > 1 %>
<%= paginate(@current_page, @page_count, :url => params).html_safe %>
<% end %>
- <%= @record_count %> <%= @record_count == 1 ? @model_config.list.label.downcase : @model_config.list.label.downcase.pluralize %>
+ <%= t "admin.list.record_count", :count => @record_count %>
@kaapa

kaapa Nov 18, 2010

Collaborator

It would have been nice to keep the pluralization code here, but it had to be translated and in Finnish for example (and I guess in many other non-latin languages as well) it's really hard to write pluralization inflections.

Perhaps this should try to look for pluralized form translations from the standard activerecord location (eg. en.activerecord.models.player.one and en.activerecord.models.player.other) and then fallback to this admin.list.record_count translation string if not found?

@kaapa

kaapa Nov 19, 2010

Collaborator

I think I got best of both worlds in this commit

<% if @page_count.to_i == 2 %>
<%= link_to(t("admin.list.show_all"), params.merge(:all => true), :class => "showall") %>
<% end %>
@@ -27,6 +27,9 @@ en:
search_btn: "SEARCH"
select: "Select %{name} to edit"
show_all: "Show all"
+ record_count:
+ one: "1 record"
+ other: "%{count} records"
new:
basic_info: "BASIC INFO"
required: "Required"
@@ -49,6 +52,9 @@ en:
error: "%{name} failed to be %{action}"
noaction: "No actions were taken"
actions:
+ create: "create"
created: "created"
+ update: "update"
updated: "updated"
- deleted: "deleted"
+ delete: "delete"
+ deleted: "deleted"
@@ -1,11 +1,11 @@
fi:
home:
- name: "home"
+ name: "koti"
admin:
dashboard:
pagename: "Ylläpito"
- name: "Kojelauta"
+ name: "Hallintapaneeli"
model_name: "Tietuetyyppi"
last_used: "Muokattu viimeksi"
records: "Tietueet"
@@ -25,6 +25,9 @@ fi:
search_btn: "HAKU"
select: "Valitse muokattava %{name}"
show_all: "Näytä kaikki"
+ record_count:
+ one: "1 tietue"
+ other: "%{count} tietuetta"
new:
basic_info: "PERUSTIEDOT"
required: "Vaadittu"
@@ -47,6 +50,9 @@ fi:
error: "Toimenpide epäonnistui eikä %{name} tyyppistä tietuetta %{action}"
noaction: "Mitään ei tehty"
actions:
+ create: "luo"
created: "luotu"
+ update: "päivitä"
updated: "päivitetty"
+ delete: "poista"
deleted: "poistettu"
@@ -24,6 +24,9 @@ fr:
search_btn: "RECHERCHE"
select: "Sélectionner %{name} pour modifier"
show_all: "Afficher tous"
+ record_count:
+ one: "1 record"
+ other: "%{count} records"
new:
basic_info: "INFO DE BASE"
required: "Obligatoire"
@@ -46,6 +49,9 @@ fr:
error: "%{name} n'a pas pu être %{action}"
noaction: "Aucune mesure où prendre!"
actions:
+ create: "create"
created: "created"
+ update: "update"
updated: "updated"
+ delete: "delete"
deleted: "deleted"
@@ -26,6 +26,9 @@ pt-BR:
search_btn: "BUSCAR"
select: "Selecione %{name} para editar"
show_all: "Exibir todos"
+ record_count:
+ one: "1 record"
+ other: "%{count} records"
new:
basic_info: "INFORMAÇÕES BÁSICAS"
required: "Obrigatório"
@@ -48,6 +51,9 @@ pt-BR:
error: "%{name} falhou em %{action}"
noaction: "Não ocorreram ações."
actions:
+ create: "create"
created: "created"
+ update: "update"
updated: "updated"
+ delete: "delete"
deleted: "deleted"
@@ -23,7 +23,7 @@
after(:each) do
Warden.test_reset!
end
-
+
describe "edit" do
before(:each) do
@player = RailsAdmin::AbstractModel.new("Player").create(:team_id => rand(99999), :number => 1, :name => "Player 1")
@@ -34,8 +34,8 @@
response.should be_successful
end
- it "should show \"Edit model\"" do
- response.body.should contain("Edit player")
+ it "should show \"Update model\"" do
+ response.body.should contain("Update player")
end
it "should show required fields as \"Required\"" do
@@ -193,7 +193,7 @@
end
it "should show \"2 results\"" do
- response.body.should contain("2 players")
+ response.body.should contain("2 records")
end
end
@@ -212,7 +212,7 @@
end
it "should show \"20 results\"" do
- @response.body.should contain("20 players")
+ @response.body.should contain("20 records")
end
end
@@ -23,7 +23,7 @@
after(:each) do
Warden.test_reset!
end
-
+
#new
describe "GET /admin/player/new" do
@@ -35,8 +35,8 @@
response.should be_successful
end
- it "should show \"New model\"" do
- response.body.should contain("New player")
+ it "should show \"Create model\"" do
+ response.body.should contain("Create player")
end
it "should show required fields as \"Required\"" do

0 comments on commit 79f3c8b

Please sign in to comment.