Added dutch i18n for invoice generation (controller, template).
This commit is contained in:
parent
a2de4fa6fd
commit
4ca48511ba
|
@ -0,0 +1,131 @@
|
||||||
|
nl:
|
||||||
|
date:
|
||||||
|
formats:
|
||||||
|
default: "%Y-%m-%d"
|
||||||
|
short: "%b %d"
|
||||||
|
long: "%d %B %Y"
|
||||||
|
month_and_year: "%B %Y"
|
||||||
|
|
||||||
|
day_names: [zondag, maandag, dinsdag, woensdag, donderdag, vrijdag, zaterdag]
|
||||||
|
abbr_day_names: [zon, maa, din, woe, don, vrij, zat]
|
||||||
|
|
||||||
|
# Don't forget the nil at the beginning; there's no such thing as a 0th month
|
||||||
|
month_names: [~, januari, februari, maart, april, mei, juni, juli, augustus, september, oktober, november, december]
|
||||||
|
abbr_month_names: [~, jan, feb, mar, apr, mei, jun, jul, aug, sep, okt, nov, dec]
|
||||||
|
order:
|
||||||
|
- :year
|
||||||
|
- :month
|
||||||
|
- :day
|
||||||
|
|
||||||
|
time:
|
||||||
|
formats:
|
||||||
|
default: "%a %d %b %Y %H:%M:%S %z"
|
||||||
|
short: "%d %b %H:%M"
|
||||||
|
long: "%d %B %Y %H:%M"
|
||||||
|
date_only: "%Y-%m-%d"
|
||||||
|
month_and_year: "%B %Y"
|
||||||
|
am: "am"
|
||||||
|
pm: "pm"
|
||||||
|
|
||||||
|
# Used in array.to_sentence.
|
||||||
|
support:
|
||||||
|
array:
|
||||||
|
words_connector: ", "
|
||||||
|
two_words_connector: " en "
|
||||||
|
last_word_connector: " en "
|
||||||
|
|
||||||
|
number:
|
||||||
|
format:
|
||||||
|
separator: ","
|
||||||
|
delimiter: "."
|
||||||
|
precision: 2
|
||||||
|
significant: false
|
||||||
|
strip_insignificant_zeros: false
|
||||||
|
|
||||||
|
currency:
|
||||||
|
format:
|
||||||
|
format: "%u%n"
|
||||||
|
unit: "€"
|
||||||
|
separator: ","
|
||||||
|
delimiter: "."
|
||||||
|
precision: 2
|
||||||
|
significant: false
|
||||||
|
strip_insignificant_zeros: false
|
||||||
|
|
||||||
|
percentage:
|
||||||
|
format:
|
||||||
|
delimiter: ""
|
||||||
|
|
||||||
|
precision:
|
||||||
|
format:
|
||||||
|
delimiter: ""
|
||||||
|
|
||||||
|
human:
|
||||||
|
format:
|
||||||
|
delimiter: ""
|
||||||
|
precision: 3
|
||||||
|
significant: true
|
||||||
|
strip_insignificant_zeros: true
|
||||||
|
storage_units:
|
||||||
|
format: "%n %u"
|
||||||
|
units:
|
||||||
|
byte:
|
||||||
|
one: "Byte"
|
||||||
|
other: "Bytes"
|
||||||
|
kb: "KB"
|
||||||
|
mb: "MB"
|
||||||
|
gb: "GB"
|
||||||
|
tb: "TB"
|
||||||
|
decimal_units:
|
||||||
|
format: "%n %u"
|
||||||
|
units:
|
||||||
|
unit: ""
|
||||||
|
thousand: duizend
|
||||||
|
million: millioen
|
||||||
|
billion: miljard
|
||||||
|
trillion: biljoen
|
||||||
|
quadrillion: biljard
|
||||||
|
|
||||||
|
datetime:
|
||||||
|
distance_in_words:
|
||||||
|
half_a_minute: "een halve minuut"
|
||||||
|
less_than_x_seconds:
|
||||||
|
one: "minder dan 1 seconde"
|
||||||
|
other: "minder dan %{count} seconden"
|
||||||
|
x_seconds:
|
||||||
|
one: "1 seconde"
|
||||||
|
other: "%{count} seconden"
|
||||||
|
less_than_x_minutes:
|
||||||
|
one: "minder dan 1 minuut"
|
||||||
|
other: "minder dan %{count} minuten"
|
||||||
|
x_minutes:
|
||||||
|
one: "1 minuut"
|
||||||
|
other: "%{count} minuten"
|
||||||
|
about_x_hours:
|
||||||
|
one: "ongeveer 1 uur"
|
||||||
|
other: "ongeveer %{count} uren"
|
||||||
|
x_days:
|
||||||
|
one: "1 dag"
|
||||||
|
other: "%{count} dagen"
|
||||||
|
about_x_months:
|
||||||
|
one: "ongeveer 1 maand"
|
||||||
|
other: "ongeveer %{count} maanden"
|
||||||
|
x_months:
|
||||||
|
one: "1 maand"
|
||||||
|
other: "%{count} maanden"
|
||||||
|
about_x_years:
|
||||||
|
one: "ongeveer 1 jaar"
|
||||||
|
other: "ongeveer %{count} jaren"
|
||||||
|
over_x_years:
|
||||||
|
one: "maar dan 1 jaarj"
|
||||||
|
other: "meer dan %{count} jaren"
|
||||||
|
almost_x_years:
|
||||||
|
one: "bijna 1 jaar"
|
||||||
|
other: "bijna %{count} jaren"
|
||||||
|
prompts:
|
||||||
|
year: "Jaar"
|
||||||
|
month: "Maand"
|
||||||
|
day: "Dag"
|
||||||
|
hour: "Uur"
|
||||||
|
minute: "Minuut"
|
||||||
|
second: "Seconden"
|
13
stoptime.rb
13
stoptime.rb
|
@ -10,6 +10,7 @@
|
||||||
# Free Software Foundation; either version 2 of the License, or (at your
|
# Free Software Foundation; either version 2 of the License, or (at your
|
||||||
# option) any later version.
|
# option) any later version.
|
||||||
|
|
||||||
|
require "action_view"
|
||||||
require "active_support"
|
require "active_support"
|
||||||
require "camping"
|
require "camping"
|
||||||
require "markaby"
|
require "markaby"
|
||||||
|
@ -23,6 +24,9 @@ unless defined? PUBLIC_DIR
|
||||||
PUBLIC_DIR = Pathname.new(__FILE__).dirname.expand_path + "public"
|
PUBLIC_DIR = Pathname.new(__FILE__).dirname.expand_path + "public"
|
||||||
TEMPLATE_DIR = Pathname.new(__FILE__).dirname.expand_path + "templates"
|
TEMPLATE_DIR = Pathname.new(__FILE__).dirname.expand_path + "templates"
|
||||||
|
|
||||||
|
# Set up the locales.
|
||||||
|
I18n.load_path += Dir[ File.join('locale', '*.yml') ]
|
||||||
|
|
||||||
# Set the default date(/time) format.
|
# Set the default date(/time) format.
|
||||||
ActiveSupport::CoreExtensions::Time::Conversions::DATE_FORMATS.merge!(
|
ActiveSupport::CoreExtensions::Time::Conversions::DATE_FORMATS.merge!(
|
||||||
:default => "%Y-%m-%d %H:%M",
|
:default => "%Y-%m-%d %H:%M",
|
||||||
|
@ -493,6 +497,9 @@ module StopTime::Controllers
|
||||||
end
|
end
|
||||||
|
|
||||||
class CustomersNInvoicesX
|
class CustomersNInvoicesX
|
||||||
|
include ActionView::Helpers::NumberHelper
|
||||||
|
include I18n
|
||||||
|
|
||||||
def get(customer_id, invoice_number)
|
def get(customer_id, invoice_number)
|
||||||
# FIXME: make this (much) nicer!
|
# FIXME: make this (much) nicer!
|
||||||
if m = invoice_number.match(/(\d+)\.(\w+)$/)
|
if m = invoice_number.match(/(\d+)\.(\w+)$/)
|
||||||
|
@ -535,8 +542,10 @@ module StopTime::Controllers
|
||||||
template = TEMPLATE_DIR + "invoice.tex.erb"
|
template = TEMPLATE_DIR + "invoice.tex.erb"
|
||||||
tex_file = PUBLIC_DIR + "#{number}.tex"
|
tex_file = PUBLIC_DIR + "#{number}.tex"
|
||||||
|
|
||||||
erb = ERB.new(File.read(template))
|
with_locale :nl do
|
||||||
File.open(tex_file, "w") { |f| f.write(erb.result(binding)) }
|
erb = ERB.new(File.read(template))
|
||||||
|
File.open(tex_file, "w") { |f| f.write(erb.result(binding)) }
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def _generate_invoice_pdf(number)
|
def _generate_invoice_pdf(number)
|
||||||
|
|
|
@ -42,9 +42,9 @@
|
||||||
to={<%= @customer.name %>\\<%= @customer.address_street%>\\
|
to={<%= @customer.name %>\\<%= @customer.address_street%>\\
|
||||||
<%= @customer.address_postal_code %> <%= @customer.address_city %>},
|
<%= @customer.address_postal_code %> <%= @customer.address_city %>},
|
||||||
% Headlines.
|
% Headlines.
|
||||||
date=<%= @invoice.updated_at.to_formatted_s(:day_code) %>,
|
date=<%= @invoice.created_at.to_formatted_s(:day_code) %>,
|
||||||
ourref=<%= @number %>,
|
ourref=<%= @number %>,
|
||||||
<% period = @period.map { |m| m.to_formatted_s(:month_and_year) }.uniq
|
<% period = @period.map { |p| I18n.l p, :format => :month_and_year }.uniq
|
||||||
case period.length
|
case period.length
|
||||||
when 1 %> subject=Factuur <%= period.first %>,<%
|
when 1 %> subject=Factuur <%= period.first %>,<%
|
||||||
when 2 %> subject=Factuur <%= period.join(" t/m ") %>,<%
|
when 2 %> subject=Factuur <%= period.join(" t/m ") %>,<%
|
||||||
|
@ -93,11 +93,11 @@
|
||||||
@tasks.each do |task, line|
|
@tasks.each do |task, line|
|
||||||
if line[0].nil? and line[1].nil?
|
if line[0].nil? and line[1].nil?
|
||||||
%> \ifcitem{<%= task %>}%
|
%> \ifcitem{<%= task %>}%
|
||||||
{<%= "%.2f" % line[2] %>}<%
|
{<%= number_with_precision(line[2]) %>}<%
|
||||||
else
|
else
|
||||||
%> \ihitem{<%= task %>}%
|
%> \ihitem{<%= task %>}%
|
||||||
{<%= "%.2f" % line[0] %>}{<%= "%.2f" % line[1] %>}%
|
{<%= number_with_precision(line[0]) %>}{<%= number_with_precision(line[1]) %>}%
|
||||||
{<%= "%.2f" % line[2] %>}<%
|
{<%= number_with_precision(line[2]) %>}<%
|
||||||
end
|
end
|
||||||
subtotal += line[2]
|
subtotal += line[2]
|
||||||
end
|
end
|
||||||
|
@ -106,10 +106,10 @@
|
||||||
\ihnosubtotal{} <%
|
\ihnosubtotal{} <%
|
||||||
else
|
else
|
||||||
vat = subtotal * VATRate/100 %>
|
vat = subtotal * VATRate/100 %>
|
||||||
\ihsubtotal{<%= "%.2f" % subtotal %>}
|
\ihsubtotal{<%= number_with_precision(subtotal) %>}
|
||||||
\ihvat{<%= "%.2f" % vat %>} <%
|
\ihvat{<%= number_with_precision(vat) %>}<%
|
||||||
end %>
|
end %>
|
||||||
\ihtotal{<%= "%.2f" % (subtotal + vat) %>}
|
\ihtotal{<%= number_with_precision(subtotal + vat) %>}
|
||||||
\end{ihtable}
|
\end{ihtable}
|
||||||
\vspace{2em}
|
\vspace{2em}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue