helpers i18n
This commit is contained in:
parent
3f82138d84
commit
a501fac76f
7 changed files with 41 additions and 21 deletions
|
@ -58,7 +58,7 @@ module ApplicationHelper
|
||||||
nil
|
nil
|
||||||
end
|
end
|
||||||
html_options = {
|
html_options = {
|
||||||
:title => "Nach #{text} sortieren",
|
:title => I18n.t('helpers.application.sort_by', text: text),
|
||||||
:remote => remote,
|
:remote => remote,
|
||||||
:class => class_name
|
:class => class_name
|
||||||
}
|
}
|
||||||
|
@ -83,7 +83,7 @@ module ApplicationHelper
|
||||||
|
|
||||||
# Returns the weekday. 0 is sunday, 1 is monday and so on
|
# Returns the weekday. 0 is sunday, 1 is monday and so on
|
||||||
def weekday(dayNumber)
|
def weekday(dayNumber)
|
||||||
weekdays = ["Sonntag", "Montag", "Dienstag", "Mittwoch", "Donnerstag", "Freitag", "Samstag"]
|
weekdays = I18n.t('date.day_names')
|
||||||
return weekdays[dayNumber]
|
return weekdays[dayNumber]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -103,9 +103,9 @@ module ApplicationHelper
|
||||||
|
|
||||||
def icon(name, options={})
|
def icon(name, options={})
|
||||||
icons = {
|
icons = {
|
||||||
:delete => { :file => 'b_drop.png', :alt => 'Löschen'},
|
:delete => { :file => 'b_drop.png', :alt => I18n.t('ui.delete')},
|
||||||
:edit => { :file => 'b_edit.png', :alt => 'Bearbeiten'},
|
:edit => { :file => 'b_edit.png', :alt => I18n.t('ui.edit')},
|
||||||
:members => { :file => 'b_users.png', :alt => 'Mitlglieder bearbeiten'}
|
:members => { :file => 'b_users.png', :alt => I18n.t('helpers.application.edit_user')}
|
||||||
}
|
}
|
||||||
options[:alt] ||= icons[name][:alt]
|
options[:alt] ||= icons[name][:alt]
|
||||||
options[:title] ||= icons[name][:title]
|
options[:title] ||= icons[name][:title]
|
||||||
|
@ -126,16 +126,16 @@ module ApplicationHelper
|
||||||
|
|
||||||
def format_roles(record)
|
def format_roles(record)
|
||||||
roles = []
|
roles = []
|
||||||
roles << 'Admin' if record.role_admin?
|
roles << I18n.t('helpers.application.role_admin') if record.role_admin?
|
||||||
roles << 'Finanzen' if record.role_finance?
|
roles << I18n.t('helpers.application.role_finance') if record.role_finance?
|
||||||
roles << 'Lieferanten' if record.role_suppliers?
|
roles << I18n.t('helpers.application.role_suppliers') if record.role_suppliers?
|
||||||
roles << 'Artikel' if record.role_article_meta?
|
roles << I18n.t('helpers.application.role_article_meta') if record.role_article_meta?
|
||||||
roles << 'Bestellung' if record.role_orders?
|
roles << I18n.t('helpers.application.role_orders') if record.role_orders?
|
||||||
roles.join(', ')
|
roles.join(', ')
|
||||||
end
|
end
|
||||||
|
|
||||||
def link_to_gmaps(address)
|
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"
|
:target => "_blank"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -143,7 +143,7 @@ module ApplicationHelper
|
||||||
# checks for nil (useful for relations)
|
# checks for nil (useful for relations)
|
||||||
def link_to_user_message_if_valid(user)
|
def link_to_user_message_if_valid(user)
|
||||||
user.nil? ? '??' : link_to(user.nick, new_message_path('message[mail_to]' => user.id),
|
user.nil? ? '??' : link_to(user.nick, new_message_path('message[mail_to]' => user.id),
|
||||||
:title => 'Nachricht schreiben')
|
:title => I18n.t('write_message'))
|
||||||
end
|
end
|
||||||
|
|
||||||
def bootstrap_flash
|
def bootstrap_flash
|
||||||
|
@ -152,7 +152,7 @@ module ApplicationHelper
|
||||||
type = :success if type == :notice
|
type = :success if type == :notice
|
||||||
type = :error if type == :alert
|
type = :error if type == :alert
|
||||||
text = content_tag(:div,
|
text = content_tag(:div,
|
||||||
content_tag(:button, raw("×"), :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}")
|
message, :class => "alert fade in alert-#{type}")
|
||||||
flash_messages << text if message
|
flash_messages << text if message
|
||||||
end
|
end
|
||||||
|
|
|
@ -3,9 +3,9 @@ module DeliveriesHelper
|
||||||
def link_to_invoice(delivery)
|
def link_to_invoice(delivery)
|
||||||
if delivery.invoice
|
if delivery.invoice
|
||||||
link_to number_to_currency(delivery.invoice.amount), [:finance, delivery.invoice],
|
link_to number_to_currency(delivery.invoice.amount), [:finance, delivery.invoice],
|
||||||
title: "Rechnung anzeigen"
|
title: I18n.t('helpers.deliveries.show_invoice')
|
||||||
else
|
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'
|
class: 'btn btn-mini'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -15,6 +15,6 @@ module MessagesHelper
|
||||||
link_text = content_tag :id, nil, class: 'icon-envelope'
|
link_text = content_tag :id, nil, class: 'icon-envelope'
|
||||||
link_text << " #{options[:text]}" if options[:text].present?
|
link_text << " #{options[:text]}" if options[:text].present?
|
||||||
link_to(link_text.html_safe, new_message_path(message: messages_params), class: 'btn',
|
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
|
||||||
end
|
end
|
||||||
|
|
|
@ -6,13 +6,13 @@ module OrdersHelper
|
||||||
end
|
end
|
||||||
|
|
||||||
def order_pdf(order, document, text)
|
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
|
end
|
||||||
|
|
||||||
def options_for_suppliers_to_select
|
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 += 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)
|
options_for_select(options)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -10,7 +10,7 @@ module TasksHelper
|
||||||
def highlighted_required_users(task)
|
def highlighted_required_users(task)
|
||||||
unless task.enough_users_assigned?
|
unless task.enough_users_assigned?
|
||||||
content_tag :span, task.still_required_users, class: 'badge badge-important',
|
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
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -282,6 +282,26 @@ de:
|
||||||
create: 'Nachricht verschicken'
|
create: 'Nachricht verschicken'
|
||||||
invite:
|
invite:
|
||||||
create: Einladung verschicken
|
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
|
# general user-interface
|
||||||
ui:
|
ui:
|
||||||
|
|
|
@ -39,7 +39,7 @@ de:
|
||||||
task_description: 'Beschreibung'
|
task_description: 'Beschreibung'
|
||||||
next_weekly_tasks_number: "Für wieviel Wochen im Voraus sollen Aufgaben erstellt werden?"
|
next_weekly_tasks_number: "Für wieviel Wochen im Voraus sollen Aufgaben erstellt werden?"
|
||||||
role_admin: "Administration"
|
role_admin: "Administration"
|
||||||
role_finance: "Fianzen"
|
role_finance: "Finanzen"
|
||||||
role_suppliers: "Lieferanten"
|
role_suppliers: "Lieferanten"
|
||||||
role_article_meta: "Artikeldatenbank"
|
role_article_meta: "Artikeldatenbank"
|
||||||
role_orders: "Bestellverwaltung"
|
role_orders: "Bestellverwaltung"
|
||||||
|
|
Loading…
Reference in a new issue