diff options
| author | Alban Peignier | 2012-03-11 14:59:34 +0100 |
|---|---|---|
| committer | Alban Peignier | 2012-03-11 15:06:12 +0100 |
| commit | da9830bbeac8b124f8065ece1aebfd482b52a57b (patch) | |
| tree | 862dcd15ba1c958e1bead25a08522cc3c646ec6a | |
| parent | dc8a6f7f9182996ea3f39986b45c3a71927a8e4a (diff) | |
| download | chouette-core-da9830bbeac8b124f8065ece1aebfd482b52a57b.tar.bz2 | |
Complete a first i18n support
| -rw-r--r-- | Gemfile | 2 | ||||
| -rw-r--r-- | Gemfile.lock | 4 | ||||
| -rw-r--r-- | app/views/companies/_form.erb | 2 | ||||
| -rw-r--r-- | app/views/companies/index.html.erb | 2 | ||||
| -rw-r--r-- | app/views/layouts/_user_links.erb | 12 | ||||
| -rw-r--r-- | app/views/layouts/application.html.erb | 12 | ||||
| -rw-r--r-- | app/views/lines/_form.erb | 13 | ||||
| -rw-r--r-- | app/views/lines/_line.erb | 8 | ||||
| -rw-r--r-- | app/views/lines/edit.html.erb | 2 | ||||
| -rw-r--r-- | app/views/lines/index.html.erb | 21 | ||||
| -rw-r--r-- | app/views/lines/show.html.erb | 36 | ||||
| -rw-r--r-- | app/views/networks/_form.erb | 10 | ||||
| -rw-r--r-- | app/views/networks/show.html.erb | 8 | ||||
| -rw-r--r-- | config/initializers/inflections.rb | 7 | ||||
| -rw-r--r-- | config/initializers/ninoxe.rb | 21 | ||||
| -rw-r--r-- | config/locales/actions.yml | 14 | ||||
| -rw-r--r-- | config/locales/lines.yml | 22 | ||||
| -rw-r--r-- | config/locales/networks.yml | 2 | ||||
| -rw-r--r-- | config/locales/referentials.yml | 28 | ||||
| -rw-r--r-- | config/locales/will_paginate.yml | 18 |
20 files changed, 163 insertions, 81 deletions
@@ -52,7 +52,7 @@ gem 'will_paginate', '~> 3.0' gem 'ransack' gem 'squeel' -gem 'chouette-ninoxe', :git => 'git://chouette.dryade.priv/ninoxe' #, :path => '~/Projects/Ninoxe' +gem 'chouette-ninoxe', :git => 'git://chouette.dryade.priv/ninoxe'#, :path => '~/Projects/Ninoxe' group :development do gem 'autotest-rails' diff --git a/Gemfile.lock b/Gemfile.lock index 7c6a67447..825987a86 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,6 +1,6 @@ GIT remote: git://chouette.dryade.priv/ninoxe - revision: ba81d9e4b2d6c9d72cd06632d167078a671ce7b8 + revision: 96759cedfefcd6e54b0cc57aa9801d3483331b62 specs: chouette-ninoxe (0.0.8) GeoRuby @@ -48,7 +48,7 @@ GIT GIT remote: git://sim.dryade.priv/user_interface - revision: 1653986271d0b186d1fd7691c90d6f8cd8ab51de + revision: f4b2a562d5f4d813fc5a942b2694de0e36abcc0a specs: user_interface (0.0.1) rails (~> 3.1.0) diff --git a/app/views/companies/_form.erb b/app/views/companies/_form.erb index 7e90e7259..5e902bcec 100644 --- a/app/views/companies/_form.erb +++ b/app/views/companies/_form.erb @@ -14,6 +14,6 @@ <%= form.buttons do %> <%= form.commit_button true %> <li><%= t('or') %></li> - <li><%= link_to t('back'), :back %></li> + <li><%= link_to t('cancel'), :back %></li> <% end %> <% end %> diff --git a/app/views/companies/index.html.erb b/app/views/companies/index.html.erb index b20804fa0..09501d5bf 100644 --- a/app/views/companies/index.html.erb +++ b/app/views/companies/index.html.erb @@ -1,4 +1,4 @@ -<%= title_tag t('companies.title.index') %> +<%= title_tag t('companies.index.title') %> <%= render :partial => "company", :collection => @companies %> diff --git a/app/views/layouts/_user_links.erb b/app/views/layouts/_user_links.erb new file mode 100644 index 000000000..41d01375c --- /dev/null +++ b/app/views/layouts/_user_links.erb @@ -0,0 +1,12 @@ +<ul class="user"> + <li class="home"><%= link_to t('layouts.home'), root_path %></li> + <li> | </li> + <li class="<%= language_class("fr") %>"><%= link_to_language :fr %></li> + <li class="<%= language_class("en") %>"><%= link_to_language :en %></li> + <li> + <li> | </li> + <%= link_to "/help/index" do %> + <span class="help"><%= t('layouts.help') %></span> + <% end %> + </li> +</ul> diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index d79351080..6da2f13ca 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -11,20 +11,18 @@ <body> <div id="header"> <div class="infos"> - <ul class="user"> - <li><%= link_to(t('layouts.home'), referentials_path) %></li> - </ul> + <%= render "layouts/user_links" %> <h1>Chouette</h1> </div> <div class="tabs"> <ul class="main"> <% if !@referential.present? || @referential.new_record? %> - <li><%= tab_link_to t('activerecord.models.referential'), referentials_path %></li> + <li><%= tab_link_to Referential, referentials_path %></li> <% else %> - <li><%= link_to "Tableau de bord", referential_path(@referential), :class => ("current" if current_page?(referential_path(@referential))) %></li> - <li><%= tab_link_to t('activerecord.models.line'), referential_lines_path(@referential) %></li> - <li><%= tab_link_to t('activerecord.models.network'), referential_networks_path(@referential) %></li> + <li><%= link_to t("layouts.tabs.dashboard"), referential_path(@referential), :class => ("current" if current_page?(referential_path(@referential))) %></li> + <li><%= tab_link_to Chouette::Line, referential_lines_path(@referential) %></li> + <li><%= tab_link_to Chouette::Network, referential_networks_path(@referential) %></li> <li><%= tab_link_to t('activerecord.models.company'), referential_companies_path(@referential) %></li> <% end %> </ul> diff --git a/app/views/lines/_form.erb b/app/views/lines/_form.erb index a3eb8f6f1..ddbffdf55 100644 --- a/app/views/lines/_form.erb +++ b/app/views/lines/_form.erb @@ -2,19 +2,26 @@ <%= semantic_form_for [@referential, @line] do |form| %> <%= form.inputs do %> <%= form.input :name %> - <%= form.input :objectid %> + <% if @line.new_record? %> + <%= form.input :objectid %> + <% else %> + <li> + <label><%= @line.human_attribute_name("objectid") %>: </label> + <%= @line.objectid %> + </li> + <% end %> <%= form.input :registration_number %> <%= form.input :network, :as => :select, :collection => Chouette::Network.all, :include_blank => false %> <%= form.input :company, :as => :select, :collection => Chouette::Company.all, :include_blank => false%> <%= form.input :published_name %> <%= form.input :number %> <%= form.input :transport_mode_name, :as => :select, :collection => Chouette::TransportMode.definitions, :include_blank => false, :member_label => Proc.new { |a| t("#{a[0]}") } %> - <%= form.input :comment, :as => :text %> + <%= form.input :comment %> <% end %> <%= form.buttons do %> <%= form.commit_button true %> <li><%= t('or') %></li> - <li><%= link_to t('back'), :back %></li> + <li><%= link_to t('cancel'), :back %></li> <% end %> <% end %> diff --git a/app/views/lines/_line.erb b/app/views/lines/_line.erb index f38bbc193..30f29b02d 100644 --- a/app/views/lines/_line.erb +++ b/app/views/lines/_line.erb @@ -8,12 +8,12 @@ <% end %> <%= link_to truncate(line.name, :length => 30), [@referential, line], :title => "Ligne #{line.name}" %> <div class="info"> - Réseau <%= link_to_if( line.network, line.network.name, referential_network_path(@referential, line.network), :title => "Réseau : #{line.network.name}" ) %> - - Transporteur <%= link_to_if( line.company, line.company.name, referential_company_path(@referential, line.company), :title => "Transporteur : #{line.company.name}" ) %> + <%= line.human_attribute_name('network') %> <%= link_to_if line.network, line.network.name, referential_network_path(@referential, line.network), :title => "#{line.human_attribute_name('network')} #{line.network.name}" %> - + <%= line.human_attribute_name('company') %> <%= link_to_if( line.company, line.company.name, referential_company_path(@referential, line.company), :title => "#{line.human_attribute_name('company')} #{line.company.name}" ) %> <div class="actions"> - <%= link_to "Modifier", edit_referential_line_path(@referential, line), :class => "edit" %> | - <%= link_to "Supprimer", referential_line_path(@referential, line), :method => :delete, :confirm => t('lines.actions.destroy_confirm'), :class => "remove" %> + <%= link_to t("actions.edit"), edit_referential_line_path(@referential, line), :class => "edit" %> | + <%= link_to t("actions.destroy"), referential_line_path(@referential, line), :method => :delete, :confirm => t('lines.actions.destroy_confirm'), :class => "remove" %> </div> </div> <% end %> diff --git a/app/views/lines/edit.html.erb b/app/views/lines/edit.html.erb index 7f1b4bd67..d2c9880ae 100644 --- a/app/views/lines/edit.html.erb +++ b/app/views/lines/edit.html.erb @@ -1,3 +1,3 @@ -<%= title_tag t('lines.show.title', :line => @line.name ) %> +<%= title_tag t('lines.edit.title', :line => @line.name ) %> <%= render "form" %> diff --git a/app/views/lines/index.html.erb b/app/views/lines/index.html.erb index 46a41534f..bd206ea4f 100644 --- a/app/views/lines/index.html.erb +++ b/app/views/lines/index.html.erb @@ -1,29 +1,28 @@ <%= title_tag t('lines.index.title') %> <%= search_form_for @q, :url => referential_lines_path(@referential), :html => {:method => :get} do |f| %> - <%= f.label :name_or_number_cont %> + <%= f.label :name_or_number_cont, "#{t('.name_or_number')} :" %> <%= f.text_field :name_or_number_cont %> <%= f.hidden_field :company_id_eq %> <%= f.hidden_field :network_id_eq %> - <%= f.submit %> ou - <%= link_to "annuler", referential_lines_path(@referential) %> + <%= f.submit t('actions.search') %> <%= t("or") %> + <%= link_to t("cancel"), referential_lines_path(@referential) %> <% end %> -<% if @q.company_id_eq.present? %> +<% if @q.network_id_eq.present? %> <p> - Transporteur : <%= @referential.companies.find(@q.company_id_eq).name %> + <%= Chouette::Line.human_attribute_name('network') %> : <%= @referential.networks.find(@q.network_id_eq).name %> </p> <% end %> -<% if @q.network_id_eq.present? %> +<% if @q.company_id_eq.present? %> <p> - Réseau : <%= @referential.networks.find(@q.network_id_eq).name %> + <%= Chouette::Line.human_attribute_name('company') %> : <%= @referential.companies.find(@q.company_id_eq).name %> </p> <% end %> - <%#= will_paginate @lines %> <div class="lines paginated_content"> <%= render :partial => "line", :collection => @lines %> @@ -35,7 +34,7 @@ <li><%= link_to t('lines.actions.new'), new_referential_line_path(@referential), :class => "add" %></li> </ul> -<h3>Sélection</h3> +<h3><%= t(".selection") %></h3> <h4><%= Chouette::Company.model_name.human.pluralize %></h4> @@ -43,7 +42,7 @@ <% @referential.companies.each do |company| %> <li><%= link_with_search company.name, "company_id_eq" => company.id %></li> <% end %> -<li><%= link_with_search "Toutes", {"company_id_eq" => nil}, :class => "all" %></li> +<li><%= link_with_search t(".selection_all"), {"company_id_eq" => nil}, :class => "all" %></li> </ul> <h4><%= Chouette::Network.model_name.human.pluralize %></h4> @@ -52,7 +51,7 @@ <% @referential.networks.each do |network| %> <li><%= link_with_search network.name, "network_id_eq" => network.id %></li> <% end %> -<li><%= link_with_search "Tous", {"network_id_eq" => nil}, :class => "all" %></li> +<li><%= link_with_search t(".selection_all"), {"network_id_eq" => nil}, :class => "all" %></li> </ul> <% end %> diff --git a/app/views/lines/show.html.erb b/app/views/lines/show.html.erb index 4db5cff99..74ed626b0 100644 --- a/app/views/lines/show.html.erb +++ b/app/views/lines/show.html.erb @@ -4,37 +4,49 @@ <div class="summary"> <p> - <label><%= Chouette::Line.human_attribute_name(:network) %>: </label> - <%= @line.network.name if @line.network.present? %> + <label><%= @line.human_attribute_name("name") %>: </label> + <%= @line.name %> </p> <p> - <label><%= Chouette::Line.human_attribute_name("company") %>: </label> - <%= @line.company.name if @line.company.present? %> + <label><%= @line.human_attribute_name("objectid") %>: </label> + <%= @line.objectid %> </p> <p> - <label><%= Chouette::Line.human_attribute_name("registrationnumber") %>: </label> - <%= @line.registration_number %> + <label><%= @line.human_attribute_name(:network) %>: </label> + <%= link_to @line.network.name, [@referential, @line.network] %> </p> <p> - <label><%= Chouette::Line.human_attribute_name("name") %>: </label> - <%= @line.name %> + <label><%= @line.human_attribute_name("company") %>: </label> + <%= link_to @line.company.name, [@referential, @line.company] %> + </p> + <p> + <label><%= @line.human_attribute_name("registration_number") %>: </label> + <%= @line.registration_number %> </p> <p> - <label><%= Chouette::Line.human_attribute_name("publishedname") %>: </label> + <label><%= @line.human_attribute_name("published_name") %>: </label> <%= @line.publishedname %> </p> <p> - <label><%= Chouette::Line.human_attribute_name("number") %>: </label> + <label><%= @line.human_attribute_name("number") %>: </label> <%= @line.number %> </p> <p> - <label><%= Chouette::Line.human_attribute_name("transport_mode_name") %>: </label> + <label><%= @line.human_attribute_name("transport_mode_name") %>: </label> <%= @line.transport_mode_name %> </p> <p> - <label><%= Chouette::Line.human_attribute_name("comment") %>: </label> + <label><%= @line.human_attribute_name("comment") %>: </label> <%= @line.comment %> </p> + <p> + <label><%= @line.human_attribute_name("creation_time") %>: </label> + <%= @line.creation_time %> + </p> + <p> + <label><%= @line.human_attribute_name("creator_id") %>: </label> + <%= @line.creator_id %> + </p> </div> </div> diff --git a/app/views/networks/_form.erb b/app/views/networks/_form.erb index 877e238bf..e81bc7ce8 100644 --- a/app/views/networks/_form.erb +++ b/app/views/networks/_form.erb @@ -2,16 +2,16 @@ <%= form.inputs do %> <%= form.input :name %> <%= form.input :registration_number %> - <%= form.input :comment, :as => :text %> + <%= form.input :comment %> <%= form.input :version_date %> - <%= form.input :description, :as => :text %> - <%= form.input :source_name, :as => :text %> - <%= form.input :source_identifier, :as => :text %> + <%= form.input :description %> + <%= form.input :source_name %> + <%= form.input :source_identifier %> <% end %> <%= form.buttons do %> <%= form.commit_button %> <li><%= t('or') %></li> - <li><%= link_to t('back'), :back %></li> + <li><%= link_to t('cancel'), :back %></li> <% end %> <% end %> diff --git a/app/views/networks/show.html.erb b/app/views/networks/show.html.erb index 4fb8c3201..489978f49 100644 --- a/app/views/networks/show.html.erb +++ b/app/views/networks/show.html.erb @@ -4,14 +4,14 @@ <div class="summary"> <p> - <label><%= Chouette::Network.human_attribute_name("registrationnumber") %>: </label> - <%= @network.registrationnumber %> - </p> - <p> <label><%= Chouette::Network.human_attribute_name("name") %>: </label> <%= @network.name %> </p> <p> + <label><%= Chouette::Network.human_attribute_name("registration_number") %>: </label> + <%= @network.registrationnumber %> + </p> + <p> <label><%= Chouette::Network.human_attribute_name("comment") %>: </label> <%= @network.comment %> </p> diff --git a/config/initializers/inflections.rb b/config/initializers/inflections.rb index 9e8b0131f..e9642c49c 100644 --- a/config/initializers/inflections.rb +++ b/config/initializers/inflections.rb @@ -1,10 +1,13 @@ +# -*- coding: undecided -*- # Be sure to restart your server when you modify this file. # Add new inflection rules using the following format # (all these examples are active by default): -# ActiveSupport::Inflector.inflections do |inflect| +ActiveSupport::Inflector.inflections do |inflect| # inflect.plural /^(ox)$/i, '\1en' # inflect.singular /^(ox)en/i, '\1' # inflect.irregular 'person', 'people' # inflect.uncountable %w( fish sheep ) -# end + inflect.irregular 'réseau', 'réseaux' +end + diff --git a/config/initializers/ninoxe.rb b/config/initializers/ninoxe.rb index 3c26e41f4..c9b6085a1 100644 --- a/config/initializers/ninoxe.rb +++ b/config/initializers/ninoxe.rb @@ -1,36 +1,25 @@ Chouette::ActiveRecord.establish_chouette_connection = false - class Chouette::Line def self.model_name - name = "Line" - def name.name - self - end - ActiveModel::Name.new name + ActiveModel::Name.new Chouette::Line, Chouette, "Line" end end class Chouette::Network + def self.model_name - name = "Network" - def name.name - self - end - ActiveModel::Name.new name + ActiveModel::Name.new Chouette::Network, Chouette, "Network" end end class Chouette::Company + def self.model_name - name = "Company" - def name.name - self - end - ActiveModel::Name.new name + ActiveModel::Name.new Chouette::Company, Chouette, "Company" end end diff --git a/config/locales/actions.yml b/config/locales/actions.yml new file mode 100644 index 000000000..e6e4687f5 --- /dev/null +++ b/config/locales/actions.yml @@ -0,0 +1,14 @@ +en: + actions: + edit: Edit + destroy: Destroy + search: Search + or: or + cancel: cancel +fr: + actions: + edit: Modifier + destroy: Supprimer + search: Chercher + or: ou + cancel: annuler
\ No newline at end of file diff --git a/config/locales/lines.yml b/config/locales/lines.yml index f7b9d55df..447d61920 100644 --- a/config/locales/lines.yml +++ b/config/locales/lines.yml @@ -8,12 +8,17 @@ en: new: title: "Add a new line" edit: - title: "Update line" + title: "Update line %{line}" show: - title: "Line" + title: "Line %{line}" + index: + title: Lines + name_or_number: "Name or number" + selection: Selection + selection_all: All activerecord: models: - line: Lignes + line: Line attributes: line: network: "Network" @@ -21,10 +26,10 @@ en: registration_number: "Registration number" name: "Name" published_name: "Public name" - number: "NUmber" + number: "Number" transport_mode_name: "Transport mode" comment: "Comments" - object_id: Neptune identifier + objectid: Neptune identifier object_version: Version creation_time: Created on creator_id: Created by @@ -43,10 +48,13 @@ fr: show: title: Ligne %{line} index: + name_or_number: "Nom ou indice" title: Lignes + selection: Sélection + selection_all: Tous activerecord: models: - line: Lignes + line: Ligne attributes: line: network: "Réseau" @@ -57,7 +65,7 @@ fr: number: "Indice" transport_mode_name: "Mode de transport" comment: "Commentaire" - object_id: "Identifiant Neptune" + objectid: "Identifiant Neptune" object_version: "Version" creation_time: "Créé le" creator_id: "Créé par" diff --git a/config/locales/networks.yml b/config/locales/networks.yml index 1a555abc3..1ca90b35e 100644 --- a/config/locales/networks.yml +++ b/config/locales/networks.yml @@ -8,7 +8,7 @@ en: new: title: "Add a new network" edit: - title: "Update network" + title: "Update network %{network}" show: title: "Network" index: diff --git a/config/locales/referentials.yml b/config/locales/referentials.yml index 9a6c0900f..962af34fb 100644 --- a/config/locales/referentials.yml +++ b/config/locales/referentials.yml @@ -1,3 +1,25 @@ +en: + referentials: + edit: + title: "Edit the referentiel" + show: + title: Referential + new: + title: Create a new referential + submit: "Create a referential" + actions: + new: Add a referential + destroy_confirm: "Do you confirm to destroy this referential ?" + destroy: Destroy this referential + edit: Edit this referential + activerecord: + models: + referential: Referential + attributes: + referential: + name: Name + slug: Code + fr: referentials: edit: @@ -9,9 +31,9 @@ fr: submit: "Créer un référentiel" actions: new: Ajouter un référentiel - destroy_confirm: "Etes vous sûr de vouloir supprimer le référentiel ?" - destroy: Supprimer - edit: Modifier + destroy_confirm: "Etes vous sûr de vouloir supprimer ce référentiel ?" + destroy: Supprimer ce référentiel + edit: Modifier ce référentiel activerecord: models: referential: Référentiel diff --git a/config/locales/will_paginate.yml b/config/locales/will_paginate.yml new file mode 100644 index 000000000..e03aca81c --- /dev/null +++ b/config/locales/will_paginate.yml @@ -0,0 +1,18 @@ +fr: + will_paginate: + previous_label: "← Précédent" + next_label: "Suivant →" + page_gap: "…" + + page_entries_info: + single_page: + zero: "Aucun(e) %{model} trouvé(e)" + one: "1 %{model} affiché(e)" + other: "%{count} %{model} affiché(e)s" + single_page_html: + zero: "Aucun(e) %{model} trouvé(e)" + one: "<b>1</b> %{model} affiché(e)s" + other: "<b>%{count}</b> %{model} affiché(e)s" + + multi_page: "%{model} %{from} - %{to} sur %{count} au total" + multi_page_html: "%{model} <b>%{from} - %{to}</b> sur <b>%{count}</b> au total" |
