diff --git a/app/controllers/stock_takings_controller.rb b/app/controllers/stock_takings_controller.rb index e183b8f2..6c45852c 100644 --- a/app/controllers/stock_takings_controller.rb +++ b/app/controllers/stock_takings_controller.rb @@ -11,11 +11,11 @@ class StockTakingsController < ApplicationController end def create - create!(:notice => "Inventur wurde erfolgreich angelegt.") + create!(:notice => I18n.t('stockit.stock_taking_create.notice')) end def update - update!(:notice => "Inventur wurde aktualisiert.") + update!(:notice => I18n.t('stockit.stock_taking_update.notice')) end def fill_new_stock_article_form diff --git a/app/controllers/stockit_controller.rb b/app/controllers/stockit_controller.rb index cdd9b633..d2fd2413 100644 --- a/app/controllers/stockit_controller.rb +++ b/app/controllers/stockit_controller.rb @@ -12,7 +12,7 @@ class StockitController < ApplicationController def create @stock_article = StockArticle.new(params[:stock_article]) if @stock_article.save - redirect_to stock_articles_path, :notice => "Lagerartikel wurde gespeichert." + redirect_to stock_articles_path, :notice => I18n.t('stockit.stock_create.notice') else render :action => 'new' end @@ -25,7 +25,7 @@ class StockitController < ApplicationController def update @stock_article = StockArticle.find(params[:id]) if @stock_article.update_attributes(params[:stock_article]) - redirect_to stock_articles_path, :notice => "Lagerartikel wurde gespeichert." + redirect_to stock_articles_path, :notice => I18n.t('stockit.stock_update.notice') else render :action => 'edit' end @@ -35,7 +35,7 @@ class StockitController < ApplicationController StockArticle.find(params[:id]).destroy redirect_to stock_articles_path rescue => error - flash[:error] = "Ein Fehler ist aufgetreten: " + error.message + flash[:error] = I18n.t('errors.general_msg', :msg => error.message) redirect_to stock_articles_path end diff --git a/app/models/stock_article.rb b/app/models/stock_article.rb index 6050c8c4..d8f5ef50 100644 --- a/app/models/stock_article.rb +++ b/app/models/stock_article.rb @@ -26,7 +26,7 @@ class StockArticle < Article protected def check_quantity - raise "#{name} kann nicht gelöscht werden. Der Lagerbestand ist nicht null." unless quantity == 0 + raise I18n.t('stockit.check.not_empty'), :name => name) unless quantity == 0 end # Overwrite Price history of Article. For StockArticles isn't it necessary. diff --git a/app/views/stockit/_form.html.haml b/app/views/stockit/_form.html.haml index 0305aefd..1f1301bb 100644 --- a/app/views/stockit/_form.html.haml +++ b/app/views/stockit/_form.html.haml @@ -9,9 +9,8 @@ = f.input :tax = f.input :deposit - else - = f.input :price, :input_html => {:disabled => 'disabled'}, - :hint => "Um Chaos zu vermeiden können bis auf weiteres die Preise von angelegten Lagerartikeln nicht mehr verändert werden." + = f.input :price, :input_html => {:disabled => 'disabled'}, :hint => t('.form.price_hint') = f.association :article_category .form-actions = f.submit class: 'btn' - = link_to "oder abbrechen", stock_articles_path \ No newline at end of file + = link_to t('.cancel'), stock_articles_path diff --git a/app/views/stockit/edit.html.haml b/app/views/stockit/edit.html.haml index e27bebf3..bdf498c6 100644 --- a/app/views/stockit/edit.html.haml +++ b/app/views/stockit/edit.html.haml @@ -1,3 +1,3 @@ -- title "Lagerartikel bearbeiten" +- title t('.title') -= render :partial => 'form', :locals => {:stock_article => @stock_article} \ No newline at end of file += render :partial => 'form', :locals => {:stock_article => @stock_article} diff --git a/app/views/stockit/index.html.haml b/app/views/stockit/index.html.haml index 5fee8934..e675e24f 100644 --- a/app/views/stockit/index.html.haml +++ b/app/views/stockit/index.html.haml @@ -9,21 +9,21 @@ .btn-toolbar .btn-group.pull-right = link_to '#', data: {toggle: 'dropdown'}, class: 'btn dropdown-toggle' do - Ansichtsoptionen + = t '.view_options' %span.caret %ul.dropdown-menu - %li= link_to "Nicht verfügbare Artikel zeigen/verstecken", "#", 'data-toggle-this' => 'tr.unavailable', tabindex: -1 + %li= link_to t('.toggle_unavailable'), "#", 'data-toggle-this' => 'tr.unavailable', tabindex: -1 .btn-group - = link_to_if @current_user.role_orders?, "Lagerbestellung online stellen", new_order_path(supplier_id: 0), + = link_to_if @current_user.role_orders?, t('.order_online'), new_order_path(supplier_id: 0), class: 'btn', class: 'btn btn-primary' - = link_to "Neuen Lagerartikel anlegen", new_stock_article_path, class: 'btn' - = link_to "Inventur anlegen", new_stock_taking_path, class: 'btn' - = link_to "Inventurübersicht", stock_takings_path, class: 'btn' + = link_to t('.new_stock_article'), new_stock_article_path, class: 'btn' + = link_to t('.new_stock_taking'), new_stock_taking_path, class: 'btn' + = link_to t('.show_stock_takings'), stock_takings_path, class: 'btn' .btn-group = link_to '#', data: {toggle: 'dropdown'}, class: 'btn dropdown-toggle' do - Neue Lieferung .. + = t '.new_delivery' %span.caret %ul.dropdown-menu - Supplier.all.each do |supplier| @@ -33,15 +33,15 @@ %table.table.table-hover#articles %thead %tr - %th Artikel - %th im Lager - %th davon bestellt - %th verfügbar - %th Einheit - %th Preis - %th MwSt - %th Lieferantin - %th Kategorie + %th= t '.article.article' + %th= t '.article.stock' + %th= t '.article.ordered' + %th= t '.article.available' + %th= t '.article.unit' + %th= t '.article.price' + %th= t '.article.vat' + %th= t '.article.supplier' + %th= t '.article.category' %th %tbody - for article in @stock_articles @@ -56,13 +56,13 @@ %td= link_to article.supplier.name, article.supplier %td= article.article_category.name %td - = link_to "Bearbeiten", edit_stock_article_path(article), class: 'btn btn-mini' - = link_to "Löschen", article, :method => :delete, :confirm => "Bist Du sicher?", + = link_to t('ui.edit'), edit_stock_article_path(article), class: 'btn btn-mini' + = link_to t('ui.delete'), article, :method => :delete, :confirm => t('.confirm_delete'), class: 'btn btn-mini btn-danger' %p - Aktueller Lagerwert: + = t '.stock_worth' = number_to_currency StockArticle.stock_value | - Artikelanzahl: + =t '.stock_count' = StockArticle.available.count diff --git a/app/views/stockit/new.html.haml b/app/views/stockit/new.html.haml index c3a5747e..05609a84 100644 --- a/app/views/stockit/new.html.haml +++ b/app/views/stockit/new.html.haml @@ -1,4 +1,4 @@ -- title "Neuen Lagerartikel anlegen" +- title t('.title') - content_for :head do :javascript @@ -16,7 +16,7 @@ / TODO: Fix this %p - Suche nach Artikeln aus allen Katalogen: + = t '.search_text' = text_field_tag 'article_search' #stock_article_form - = render :partial => 'form', :locals => {:stock_article => @stock_article} \ No newline at end of file + = render :partial => 'form', :locals => {:stock_article => @stock_article} diff --git a/config/locales/de/de.stockit.yml b/config/locales/de/de.stockit.yml new file mode 100644 index 00000000..6631f946 --- /dev/null +++ b/config/locales/de/de.stockit.yml @@ -0,0 +1,46 @@ +de: + stockit: + edit: + title: 'Lagerartikel bearbeiten' + form: + price_hint: 'Um Chaos zu vermeiden können bis auf weiteres die Preise von angelegten Lagerartikeln nicht mehr verändert werden.' + cancel: 'or cancel' + index: + view_options: 'Ansichtsoptionen' + toggle_unavailable: 'Nicht verfügbare Artikel zeigen/verstecken' + order_online: 'Lagerbestellung online stellen' + new_stock_article: 'Neuen Lagerartikel anlegen' + new_stock_taking: 'Inventur anlegen' + show_stock_takings: 'Inventurübersicht' + new_delivery: 'Neue Lieferung ..' + article: + article: 'Artikel' + stock: 'im Lager' + ordered: 'davon bestellt' + available: 'verfügbar' + unit: 'Einheit' + price: 'Preis' + vat: 'MwSt' + supplier: 'Lieferantin' + category: 'Kategorie' + confirm_delete: 'Bist Du sicher?' + stock_worth: 'Aktueller Lagerwert:' + stock_count: 'Artikelanzahl:' + new: + title: 'Neuen Lagerartikel anlegen' + search_text: 'Suche nache Artikeln aus allen Katalogen:' + + # used by controller + stock_create: + notice: 'Lagerartikel wurde gespeichert.' + stock_update: + notice: 'Lagerartikel wurde gespeichert.' + stock_taking_create: + notice: 'Inventur wurde erfolgreich angelegt.' + stock_taking_update: + notice: 'Inventur wurde aktualisiert.' + + # used by model + check: + not_empty: '%{name} kann nicht gelöscht werden. Der Lagerbestand ist nicht null.' +