Added dutch i18n for invoice generation (controller, template).
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
|
||||
# option) any later version.
|
||||
|
||||
require "action_view"
|
||||
require "active_support"
|
||||
require "camping"
|
||||
require "markaby"
|
||||
|
@ -23,6 +24,9 @@ unless defined? PUBLIC_DIR
|
|||
PUBLIC_DIR = Pathname.new(__FILE__).dirname.expand_path + "public"
|
||||
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.
|
||||
ActiveSupport::CoreExtensions::Time::Conversions::DATE_FORMATS.merge!(
|
||||
:default => "%Y-%m-%d %H:%M",
|
||||
|
@ -493,6 +497,9 @@ module StopTime::Controllers
|
|||
end
|
||||
|
||||
class CustomersNInvoicesX
|
||||
include ActionView::Helpers::NumberHelper
|
||||
include I18n
|
||||
|
||||
def get(customer_id, invoice_number)
|
||||
# FIXME: make this (much) nicer!
|
||||
if m = invoice_number.match(/(\d+)\.(\w+)$/)
|
||||
|
@ -535,8 +542,10 @@ module StopTime::Controllers
|
|||
template = TEMPLATE_DIR + "invoice.tex.erb"
|
||||
tex_file = PUBLIC_DIR + "#{number}.tex"
|
||||
|
||||
erb = ERB.new(File.read(template))
|
||||
File.open(tex_file, "w") { |f| f.write(erb.result(binding)) }
|
||||
with_locale :nl do
|
||||
erb = ERB.new(File.read(template))
|
||||
File.open(tex_file, "w") { |f| f.write(erb.result(binding)) }
|
||||
end
|
||||
end
|
||||
|
||||
def _generate_invoice_pdf(number)
|
||||
|
|
|
@ -42,9 +42,9 @@
|
|||
to={<%= @customer.name %>\\<%= @customer.address_street%>\\
|
||||
<%= @customer.address_postal_code %> <%= @customer.address_city %>},
|
||||
% Headlines.
|
||||
date=<%= @invoice.updated_at.to_formatted_s(:day_code) %>,
|
||||
date=<%= @invoice.created_at.to_formatted_s(:day_code) %>,
|
||||
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
|
||||
when 1 %> subject=Factuur <%= period.first %>,<%
|
||||
when 2 %> subject=Factuur <%= period.join(" t/m ") %>,<%
|
||||
|
@ -93,11 +93,11 @@
|
|||
@tasks.each do |task, line|
|
||||
if line[0].nil? and line[1].nil?
|
||||
%> \ifcitem{<%= task %>}%
|
||||
{<%= "%.2f" % line[2] %>}<%
|
||||
{<%= number_with_precision(line[2]) %>}<%
|
||||
else
|
||||
%> \ihitem{<%= task %>}%
|
||||
{<%= "%.2f" % line[0] %>}{<%= "%.2f" % line[1] %>}%
|
||||
{<%= "%.2f" % line[2] %>}<%
|
||||
{<%= number_with_precision(line[0]) %>}{<%= number_with_precision(line[1]) %>}%
|
||||
{<%= number_with_precision(line[2]) %>}<%
|
||||
end
|
||||
subtotal += line[2]
|
||||
end
|
||||
|
@ -106,10 +106,10 @@
|
|||
\ihnosubtotal{} <%
|
||||
else
|
||||
vat = subtotal * VATRate/100 %>
|
||||
\ihsubtotal{<%= "%.2f" % subtotal %>}
|
||||
\ihvat{<%= "%.2f" % vat %>} <%
|
||||
\ihsubtotal{<%= number_with_precision(subtotal) %>}
|
||||
\ihvat{<%= number_with_precision(vat) %>}<%
|
||||
end %>
|
||||
\ihtotal{<%= "%.2f" % (subtotal + vat) %>}
|
||||
\ihtotal{<%= number_with_precision(subtotal + vat) %>}
|
||||
\end{ihtable}
|
||||
\vspace{2em}
|
||||
|
||||
|
|
Loading…
Reference in New Issue