News:

Looking for documentation? Take a look on our wiki

Main Menu

How to translate customfields?

Started by patrik60, April 05, 2012, 16:32:11 PM

Previous topic - Next topic

patrik60

There is a very complicated explanation of how to translate customfields here at the forum: http://forum.virtuemart.net/index.php?topic=96758.0
Since there is an option in Joomla 2.5 for language override in the backend all these steps are not necessary. Simply do it by choosing Extensions-> Language Manger-> Overrides.

But there is no explanation how to translate the values after selecting the custom field type. Does anybody have an idea how to translate this? I tried it also with a language string but it didn't work.

balai

Add a language string in capital letters.

e.g. COM_VIRTUEMART_COLOR_RED

then in the lang file write:
COM_VIRTUEMART_COLOR_RED="Red"

p.s. COM_VIRTUEMART prefix is not necessary but is usefull to avoid this string to be translated in another extension

patrik60

#2
Do I have to write it in the virtuemart language file? It doesn't work with the language override possibility of Joomla.

EDIT: It can't be the com_virtuemart.ini file. I didn't also find any other language file where it would take effect. So in my opinion a translation of custom field values in VM 2 simply doesn't work :(

Fintan

I would be interested in this as well.

ereallstaff

As eplained in the article below:

http://forum.virtuemart.net/index.php?topic=96758.0

You have to write it inside the override files f.e.

language/overrides/fr-FR.override.ini

I was wondering how to translate the value in custom field as it seems to work only with the name of attribute

and overall I was wondering why it has not been made natively by virtuemart, instead of doing all this fools.

Attributes are the most important thing in an e-commerce!
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ì
Try out our new joomla background rotator ( for joomla 1.x or 2.x), for only 14,99 eur @ innovailweb.it

Studio 42

Hi,

We have added the Jtext for some customfields Types.
Perhaps some jText is missing or you  don't added the translation in your Ini file.
We use INI file because some variant are reused in many product(sometime in all products)
For the translation i do it simple way , i use the english real word Uppercased.
eg.
RED="rouge"
GREEN="vert"

The advantage is when the jtext is missing the name is write in english because you can choice to not uppercase the Name using "jtext::_('red')" find the language key "RED"
Hope this help
When you use simple word, look if this is not existing in joomla before to don't have lnaguage naming conflict.

rvbgnu

Hi,
Thank you for these explanations. I am still discovering some parts of VM2.
Currently with version 2.0.6, I could not find how to have the custom fields in drop down menu translated.
I have made a template override of default_customfields.php, adding JTEXT when missing. The CONSTANT is translated, but not the VALUE.
Then in the cart, VALUE is OK.

Electrocity, please, which files did you modify to get it working properly?
Best Regards, Hervé Boinnard - Irish Time (GMT)
Joomla! multilingual website and online business made easy - https://www.puma-it.ie

3D Secure v1 (3DS1) & Strong Customer Authentication (SCA)! Stripe.com payment plugin for VirtueMart 3: https://www.puma-it.ie/en/joomla-and-virtuemart-extensions/stripe-for-virtuemart
Authipay (AIB Merchant Services) for VirtueMart 2 & 3: https://www.puma-it.ie/en/joomla-and-virtuemart-extensions/authipay-aib-merchant-services-for-virtuemart

rvbgnu

I have read again this thread, this one
http://forum.virtuemart.net/index.php?topic=100784.0
and the original one from jjk
http://forum.virtuemart.net/index.php?topic=96758.0

but I can't get the value translated...
The drop down menu display "SIZE_VALUE_L", that's my constant name in the .ini file.
We probably need to change another file with JText, the one controlling the menu.

Any hints from VM team, or jjk, please?
Best Regards, Hervé Boinnard - Irish Time (GMT)
Joomla! multilingual website and online business made easy - https://www.puma-it.ie

3D Secure v1 (3DS1) & Strong Customer Authentication (SCA)! Stripe.com payment plugin for VirtueMart 3: https://www.puma-it.ie/en/joomla-and-virtuemart-extensions/stripe-for-virtuemart
Authipay (AIB Merchant Services) for VirtueMart 2 & 3: https://www.puma-it.ie/en/joomla-and-virtuemart-extensions/authipay-aib-merchant-services-for-virtuemart

balai

Try to add a suffix.

Something like: COM_VIRTUEMART_SIZE_VALUE_L

rvbgnu

Thanks balai, but I did it already. I actually use ASF_SIZE_VALUE_L, and I search all the existing language files to make sure there is no duplication.
I just tried with the one you suggested, with no avail...
Best Regards, Hervé Boinnard - Irish Time (GMT)
Joomla! multilingual website and online business made easy - https://www.puma-it.ie

3D Secure v1 (3DS1) & Strong Customer Authentication (SCA)! Stripe.com payment plugin for VirtueMart 3: https://www.puma-it.ie/en/joomla-and-virtuemart-extensions/stripe-for-virtuemart
Authipay (AIB Merchant Services) for VirtueMart 2 & 3: https://www.puma-it.ie/en/joomla-and-virtuemart-extensions/authipay-aib-merchant-services-for-virtuemart

balai

Maybe the problem is in the code.

Check if the values are within a JText constructor.

rvbgnu

Well that is the point, but where in the code?
I failed to trace the file requested to build the drop down menu for the custom fileds. It is in the product details view only, inside the add to cart section.
Here is an extract of the HTML code. I have two custom fields that appears in menu (select / option part):


<div class="addtocart-area">

    <form action="index.php" class="product js-recalculate" method="post">
    <div class="product-fields">
    <div class="product-field product-field-type-V">
<span class="product-fields-title">ASF_SIZE</span>
<span class="product-field-display">

<select name="customPrice[0][7]" id="customPrice07">
<option value="290">ASF_SIZE_VALUE_S </option>
<option value="288">ASF_SIZE_VALUE_M </option>
<option value="287">ASF_SIZE_VALUE_L </option>
<option value="286">ASF_SIZE_VALUE_XL </option>
<option value="285">ASF_SIZE_VALUE_XXL 2,00 €</option>
</select>

</span>

<span class="product-field-desc"></span>
    </div><br>
        <div class="product-field product-field-type-V">
<span class="product-fields-title">ASF_COLOUR</span>
<span class="product-field-display">

<select name="customPrice[1][8]" id="customPrice18">
<option value="291">ASF_COLOUR_ORANGE </option>
<option value="292">ASF_COLOUR_BURGUNDY </option>
<option value="293">ASF_COLOUR_NAVY </option>
</select>

</span>

<span class="product-field-desc"></span>
    </div><br>
        [...]

        </div>
<div id="productPrice33" class="product-price" style="opacity: 1;">
    <strong>Price: </strong><div style="display : none;" class="PricevariantModification">0</div>
<div style="display : none;" class="PricebasePriceWithTax">0</div><div style="display : none;" class="PricesalesPriceWithDiscount">0</div>
<div style="display : block;" class="PricesalesPrice"><span class="PricesalesPrice">14,00 €</span></div>
<div style="display : none;" class="PricediscountAmount">0</div></div>
<div class="addtocart-bar">

<!-- <label for="quantity33" class="quantity_box">Quantity: </label> -->
    <span class="quantity-box">
<input type="text" value="1" name="quantity[]" class="quantity-input js-recalculate">
    </span>
    <span class="quantity-controls js-recalculate">
<input type="button" class="quantity-controls quantity-plus">
<input type="button" class="quantity-controls quantity-minus">
    </span>
   
    <span class="addtocart-button">
<input type="submit" title="Add to Cart" value="Add to Cart" class="addtocart-button" name="addtocart">
</span>

    <div class="clear"></div>
</div>

[...]

    </form>

    <div class="clear"></div>
</div>


Where is(are) the file(s) building the menu (select / option)? A JText function should be inserted there...
Best Regards, Hervé Boinnard - Irish Time (GMT)
Joomla! multilingual website and online business made easy - https://www.puma-it.ie

3D Secure v1 (3DS1) & Strong Customer Authentication (SCA)! Stripe.com payment plugin for VirtueMart 3: https://www.puma-it.ie/en/joomla-and-virtuemart-extensions/stripe-for-virtuemart
Authipay (AIB Merchant Services) for VirtueMart 2 & 3: https://www.puma-it.ie/en/joomla-and-virtuemart-extensions/authipay-aib-merchant-services-for-virtuemart

balai

Within the <option></option> write:

<option value="VALUE"><?php echo JText::_('COM_VIRTUEMART_VALUE');?></option>

VALUE->The integer number of that value
COM_VIRTUEMART_VALUE->the value you want to use

rvbgnu

Thank you Balai,
But this is the HTML rendered, not the source. In which is the php file the menu is built ?
Best Regards, Hervé Boinnard - Irish Time (GMT)
Joomla! multilingual website and online business made easy - https://www.puma-it.ie

3D Secure v1 (3DS1) & Strong Customer Authentication (SCA)! Stripe.com payment plugin for VirtueMart 3: https://www.puma-it.ie/en/joomla-and-virtuemart-extensions/stripe-for-virtuemart
Authipay (AIB Merchant Services) for VirtueMart 2 & 3: https://www.puma-it.ie/en/joomla-and-virtuemart-extensions/authipay-aib-merchant-services-for-virtuemart

DarthVaderNow

#14
Hi,
i'm very interrested in any information regarding this too.

no way to know how <option>... menus are built OR what object "$field->display" in default_addtocart.php is reffered to.

BUT: in cart everything working perfectly

Thanks in advance, matic