euro-total2.taq

$ java -jar taq.jar euro-total2 amount=“12.345,67 €”

Running query item_query in belgium_fr scope 
Parameters [euro-total2, amount=12.345,67 €]
item_query(fr_BE, total=13703.69, total_text=le total + impôt: 13 703,69 EUR)

Running query item_query in french scope 
item_query(fr_FR, total=14197.52, total_text=le total + impôt: 14 197,52 EUR)

Running query item_query in german scope 
item_query(
 de_DE,
 total=14567.89,
 total_text=Gesamtkosten + Steuer: 14.567,89 EUR
)

Running query item_query in global scope 
item_query(
 de_DE,
 total=14567.89,
 total_text=Gesamtkosten + Steuer: 14.567,89 EUR
)
item_query(fr_BE, total=13703.69, total_text=le total + impôt: 13 703,69 EUR)
item_query(fr_FR, total=14197.52, total_text=le total + impôt: 14 197,52 EUR)```

Description

euro-total2.taq demonstrates using an axiom list in a scope to apply locale-specific data to a query. In addition, each scope has a query for just itself.

The “charge_plus_tax” template has the benefit of not needing to reference the current scope to derive parameters that are locale=specific.


template charge_plus_tax
{
currency amount,
double tax_rate,
string Total,
string Tax
}
(
term scope.locale,
currency total = amount * 1 + tax_rate),
string total_text = Total + " + " + Tax + ": " + total.format)
)

scope french (language="fr", region="FR")
{
axiom locale
( tax_rate, Total, Tax )
{ 0.15, "le total", "impôt" }

query<term> item_query(locale : charge_plus_tax)
}

scope german (language="de", region="DE")
{
axiom locale
( tax_rate, Total, Tax )
{ 0.18, "Gesamtkosten", "Steuer" }

query<term> item_query(locale : charge_plus_tax)
}

scope belgium_fr (language="fr", region="BE")
{
axiom locale
( tax_rate, Total, Tax )
{ 0.11, "le total", "impôt" }

query<term> item_query(locale : charge_plus_tax)
}

query item_query
(french.locale : french.charge_plus_tax,
german.locale : german.charge_plus_tax,
belgium_fr.locale : belgium_fr.charge_plus_tax)