I am running an application on Ruby On Rails (3.1) and need to handle translations into various languages. I got my controller texts properly handled using the I18N feautures, but what about validations in models, especially those like this:
validate :valid_quantities?
def valid_quantities?
if self.quantity*self.unitprice < 1.00
errors.add("The transaction value", "is < 1.00")
return false
end
How would I code this to provide support for other languages?
In addition, how to I handle the formatting of the numbers? I cannot call the ActionView helpers and user e.g. number_to_currency
Ok, I made partial progress, looks like the following works:
Change the code in the model validation to
Enter the translation into de.yml
But I am still looking for a way to format that number correctly (1.00 for English, 1,00 for German).