For setting custom product label, create a resource Product.Label and use HTML codes to format label.
if(product.getProperty("russian")!=null)
{
return "<html>"+product.printName()+"<br>"+product.getProperty("russian");
}
else
{
return product.printName();
}
The above code set label based on the properties set for a product.
For the product product properties use code like below:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">
<properties>
<entry key="russian">яблоко</entry>
</properties>
The above product property set the Russian variant for product name.
Restart Saleculator to reflect the changes made.
The product button label shows product name with both English and Russian names if a Russian name is set in the properties.
Leave a Reply