News:

Support the VirtueMart project and become a member

Main Menu

How to translate availability message?

Started by sebmolo, January 29, 2015, 14:31:47 PM

Previous topic - Next topic

sebmolo

Hello,
I'd like to translate the availablity message set in the configuration.
For example to have :
"3 weeks max" in English
"3 semaines maximum" in French.

I tried to do the same as for custom fields and insert strings and to work with the language override files but I couldn't get it to work.
Any help?

jjk

Non-English Shops: Are your language files up to date?
http://virtuemart.net/community/translations

sebmolo

Hello and thanks for your answer.
Unfortunately your solution doesn't work for availability texts.
I already tried using language keys, the availability text doesn't seem to be recognised as such.
(that is what i meant with : I tried to do the same as for custom fields.)

Miku

#3
I'd like to refresh the topic looking for a solution in the related issue. Namely - availability images in a multilanguage site. Is that possible to set different ones per language? I have been looking for a solution but like other users:
http://forum.virtuemart.net/index.php?topic=121388.0
http://forum.virtuemart.net/index.php?topic=114378.0
I haven't found it... :( 

In VM3 I even can see an 'flag icon' next to the field 'availability image' which would suggest that there is such an option but there's no such though

Could anyone help?

bortolani

In fact there is a way.
Put your image files in two different directories, one for each language.
Then modify the php file where you show the product details (usually it depends on the template you are using) and change the existing code for the availability display with something like this:


if (!empty($this->product->product_availability)) {
$stockhandle = VmConfig::get('stockhandle','none');
if($stockhandle=='none') {
$GifToPNG = substr($this->product->product_availability, 0, -3); }
else if($stockhandle=='risetime' and ($this->product->product_in_stock - $this->product->product_ordered)<1){
$GifToPNG = substr(VmConfig::get('rised_availability'), 0, -3); }
else if($stockhandle=='disableadd' and ($this->product->product_in_stock - $this->product->product_ordered)>=1){
$GifToPNG = substr($this->product->product_availability, 0, -3); }
if($stockhandle=='risetime' and ($this->product->product_in_stock - $this->product->product_ordered)>=1){
$GifToPNG = substr($this->product->product_availability, 0, -3); }
$imgUrl= JURI::root().'templates/'.$template.'/html/com_virtuemart/assets/images/availability/'. JTEXT::_('PUFFO_AVAILABILITY_DIR').$GifToPNG; ?>
<div class="availability">
<img src="<?php echo $imgUrl ?>png" class="FlexibleavailabilityIMG" alt="" /> </div>
<?php }
}


In practice use a language override variable to change the name of the directory where to look for the image.

Hope this helps,
Bruno