diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 7670f74..93183ef 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -93,24 +93,27 @@ def allow_login_as_specific_user? helper_method :allow_login_as_specific_user? def page_title(value=nil) + model_name = controller_name.singularize.underscore + model_name_singular_human = t("activerecord.models.#{model_name}.one", :default => controller_name.singularize.humanize).downcase + @page_title = value unless value.nil? if @page_title.nil? @page_title ||= case action_name.to_sym when :index - t("activerecord.models.#{controller_name.downcase}" , :default => controller_name.humanize.titleize) + t("activerecord.models.#{model_name}.other" , :default => controller_name.humanize.titleize) when :new, :create - t("title.model.new",:modelname => t("activerecord.models.#{controller_name.singularize.downcase}" , :default => controller_name.singularize.humanize.downcase)) + t("title.model.new", :modelname => model_name_singular_human) when :edit, :update - t("title.model.edit",:modelname => t("activerecord.models.#{controller_name.singularize.downcase}", :default => controller_name.singularize.humanize.downcase)) + t("title.model.edit",:modelname => model_name_singular_human) when :destroy - t("title.model.destroy",:modelname => t("activerecord.models.#{controller_name.singularize.downcase}", :default => controller_name.singularize.humanize.downcase)) + t("title.model.destroy",:modelname => model_name_singular_human) else begin get_resource_ivar.name rescue Exception => e - t("activerecord.models.#{controller_name.singularize.downcase}") + model_name_singular_human.titleize end end else diff --git a/app/views/site/_custom_slug_field.html.haml b/app/views/site/_custom_slug_field.html.haml index 8aa6433..06ea99a 100644 --- a/app/views/site/_custom_slug_field.html.haml +++ b/app/views/site/_custom_slug_field.html.haml @@ -2,9 +2,9 @@ -# -# ARGUMENTS: -# * form: The Rails form instance. -- hint = "%{example} %{url}/%{my}-%{model}" % { | +- hint = "%{example} %{url}/%{my}_%{model}" % { | :example => t('field.example.fragment'), | :url => "#{SETTINGS.organization.url}/#{controller_path}", | :my => t('field.my.fragment'), | - :model => t("activerecord.models.#{form.send(:model_name).underscore}").underscore } + :model => form.object.class.model_name.human.underscore } = form.input :custom_slug, :hint => hint.html_safe diff --git a/config/locales/en.yml b/config/locales/en.yml index 44e3118..36ca5d8 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -25,7 +25,28 @@ en: url: "Website (URL)" activerecord: - # models: # Defaults are fine for English. + models: + authentication: + one: Authentication + other: Authentications + company: + one: Company + other: Companies + group: + one: Group + other: Groups + person: + one: Person + other: People + project: + one: Project + other: Projects + resource_link: + one: Ressource + other: Ressources + user: + one: User + other: Users attributes: # Common attribute names provided by `attributes`. person: diff --git a/config/locales/fr.yml b/config/locales/fr.yml index 7fc3de4..87f553d 100644 --- a/config/locales/fr.yml +++ b/config/locales/fr.yml @@ -24,18 +24,27 @@ fr: activerecord: models: - group: Groupe - groups: Groupes - people: Personnes - person: Personne - company: Entreprise - companies: Entreprises - project: Projet - projects: Projets - resource_link: Ressource - resources_links: Ressources - user: Utilisateur - users: Utilisateurs + authentication: + one: Authentification + other: Authentifications + company: + one: Entreprise + other: Entreprises + group: + one: Groupe + other: Groupes + person: + one: Personne + other: Personnes + project: + one: Projet + other: Projets + resource_link: + one: Ressource + other: Ressources + user: + one: Utilisateur + other: Utilisateurs attributes: # Common attribute names provided by `attributes`. person: