helpers i18n

This commit is contained in:
wvengen 2013-04-10 17:29:06 +02:00
parent 3f82138d84
commit a501fac76f
7 changed files with 41 additions and 21 deletions

View File

@ -58,7 +58,7 @@ module ApplicationHelper
nil
end
html_options = {
:title => "Nach #{text} sortieren",
:title => I18n.t('helpers.application.sort_by', text: text),
:remote => remote,
:class => class_name
}
@ -83,7 +83,7 @@ module ApplicationHelper
# Returns the weekday. 0 is sunday, 1 is monday and so on
def weekday(dayNumber)
weekdays = ["Sonntag", "Montag", "Dienstag", "Mittwoch", "Donnerstag", "Freitag", "Samstag"]
weekdays = I18n.t('date.day_names')
return weekdays[dayNumber]
end
@ -103,9 +103,9 @@ module ApplicationHelper
def icon(name, options={})
icons = {
:delete => { :file => 'b_drop.png', :alt => 'Löschen'},
:edit => { :file => 'b_edit.png', :alt => 'Bearbeiten'},
:members => { :file => 'b_users.png', :alt => 'Mitlglieder bearbeiten'}
:delete => { :file => 'b_drop.png', :alt => I18n.t('ui.delete')},
:edit => { :file => 'b_edit.png', :alt => I18n.t('ui.edit')},
:members => { :file => 'b_users.png', :alt => I18n.t('helpers.application.edit_user')}
}
options[:alt] ||= icons[name][:alt]
options[:title] ||= icons[name][:title]
@ -126,16 +126,16 @@ module ApplicationHelper
def format_roles(record)
roles = []
roles << 'Admin' if record.role_admin?
roles << 'Finanzen' if record.role_finance?
roles << 'Lieferanten' if record.role_suppliers?
roles << 'Artikel' if record.role_article_meta?
roles << 'Bestellung' if record.role_orders?
roles << I18n.t('helpers.application.role_admin') if record.role_admin?
roles << I18n.t('helpers.application.role_finance') if record.role_finance?
roles << I18n.t('helpers.application.role_suppliers') if record.role_suppliers?
roles << I18n.t('helpers.application.role_article_meta') if record.role_article_meta?
roles << I18n.t('helpers.application.role_orders') if record.role_orders?
roles.join(', ')
end
def link_to_gmaps(address)
link_to h(address), "http://maps.google.de/?q=#{h(address)}", :title => "Show it on google maps",
link_to h(address), "http://maps.google.com/?q=#{h(address)}", :title => I18n.t('helpers.application.show_google_maps'),
:target => "_blank"
end
@ -143,7 +143,7 @@ module ApplicationHelper
# checks for nil (useful for relations)
def link_to_user_message_if_valid(user)
user.nil? ? '??' : link_to(user.nick, new_message_path('message[mail_to]' => user.id),
:title => 'Nachricht schreiben')
:title => I18n.t('write_message'))
end
def bootstrap_flash
@ -152,7 +152,7 @@ module ApplicationHelper
type = :success if type == :notice
type = :error if type == :alert
text = content_tag(:div,
content_tag(:button, raw("&times;"), :class => "close", "data-dismiss" => "alert") +
content_tag(:button, I18n.t('ui.marks.close'), :class => "close", "data-dismiss" => "alert") +
message, :class => "alert fade in alert-#{type}")
flash_messages << text if message
end

View File

@ -3,9 +3,9 @@ module DeliveriesHelper
def link_to_invoice(delivery)
if delivery.invoice
link_to number_to_currency(delivery.invoice.amount), [:finance, delivery.invoice],
title: "Rechnung anzeigen"
title: I18n.t('helpers.deliveries.show_invoice')
else
link_to "Rechnung anlegen", new_finance_invoice_path(supplier_id: delivery.supplier.id, delivery_id: delivery.id),
link_to I18n.t('helpers.deliveries.new_invoice'), new_finance_invoice_path(supplier_id: delivery.supplier.id, delivery_id: delivery.id),
class: 'btn btn-mini'
end
end

View File

@ -15,6 +15,6 @@ module MessagesHelper
link_text = content_tag :id, nil, class: 'icon-envelope'
link_text << " #{options[:text]}" if options[:text].present?
link_to(link_text.html_safe, new_message_path(message: messages_params), class: 'btn',
title: 'Nachricht verschicken')
title: I18n.t('helpers.submit.message.create'))
end
end

View File

@ -6,13 +6,13 @@ module OrdersHelper
end
def order_pdf(order, document, text)
link_to text, order_path(order, document: document, format: :pdf), title: "PDF erstellen"
link_to text, order_path(order, document: document, format: :pdf), title: I18n.t('helpers.orders.order_pdf')
end
def options_for_suppliers_to_select
options = [["Lieferantin/Lager auswählen"]]
options = [[I18n.t('helpers.orders.option_choose')]]
options += Supplier.all.map {|s| [ s.name, url_for(action: "new", supplier_id: s)] }
options += [["Lager", url_for(action: 'new', supplier_id: 0)]]
options += [[I18n.t('helpers.orders.option_stock'), url_for(action: 'new', supplier_id: 0)]]
options_for_select(options)
end
end

View File

@ -10,7 +10,7 @@ module TasksHelper
def highlighted_required_users(task)
unless task.enough_users_assigned?
content_tag :span, task.still_required_users, class: 'badge badge-important',
title: "Es fehlen #{task.still_required_users} Mitstreiterinnen!"
title: I18n.t('helpers.tasks.required_users', :count => task.still_required_users)
end
end
end

View File

@ -282,6 +282,26 @@ de:
create: 'Nachricht verschicken'
invite:
create: Einladung verschicken
application:
sort_by: 'Nach %{text} sortieren'
edit_user: 'Mitglieder bearbeiten'
show_google_maps: 'Show it on Google maps'
# long names in simple_form.labels.workgroup
role_admin: 'Admin'
role_finance: 'Finanzen'
role_suppliers: 'Lieferanten'
role_article_meta: 'Artikel'
role_orders: 'Bestellung'
write_message: 'Nachricht_schreiben'
deliveries:
show_invoice: 'Rechnung anzeigen'
new_invoice: 'Rechnung anlegen'
orders:
order_pdf: 'PDF erstellen'
option_choose: 'Lieferantin/Lager auswählen'
option_stock: 'Lager'
tasks:
required_users: 'Es fehlen %{count} Mitstreiterinnen!'
# general user-interface
ui:

View File

@ -39,7 +39,7 @@ de:
task_description: 'Beschreibung'
next_weekly_tasks_number: "Für wieviel Wochen im Voraus sollen Aufgaben erstellt werden?"
role_admin: "Administration"
role_finance: "Fianzen"
role_finance: "Finanzen"
role_suppliers: "Lieferanten"
role_article_meta: "Artikeldatenbank"
role_orders: "Bestellverwaltung"