Author Topic: How to translate customfields?  (Read 11726 times)

rvbgnu

  • 3rd party VirtueMart Developer
  • Jr. Member
  • *
  • Posts: 114
    • Puma-IT.ie
Re: How to translate customfields?
« Reply #15 on: June 08, 2012, 15:59:30 pm »
Yes, I know. Very frustrating not to find it... I am still upgrading my php and Joomla programming skills, so I will eventually.
But in the meantime, the website will not look good.

A work around will be to have something else that a menu: text area, radio button, ...
Best Regards, Hervé Boinnard - Irish Time (GMT)
Joomla! multilingual website and online business made easy - https://www.puma-it.ie

Updated for VM3 and Joomla 3.x! Stripe.com payment plugin for VirtueMart: 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

  • Beginner
  • *
  • Posts: 6
Re: How to translate customfields?
« Reply #16 on: June 20, 2012, 01:40:59 am »
hi,

i have found a workaround. this is a manual solution and works for me. but is a bug in vmart (if exists price modification in custom field - translations does not work!)

solution:
in file: administrator/components/com_virtuemart/models/customfields.php:623
                       
            //   ORIGINAL:   $group->display = VmHTML::select('customPrice['.$row.']['.$group->virtuemart_custom_id.']',$group->options,$default->custom_value,'','value','text',false);
            // REPAIR (translations are in language overrides)
            $MMMtemp = '';
       $MMMtemp = VmHTML::select('customPrice['.$row.']['.$group->virtuemart_custom_id.']',$group->options,$default->custom_value,'','value','text',false);
            $MMMtemp = str_replace('COM_CUSTOM_FIELD_DOLZINA_ROKAVA_KRATKI',JText::_('COM_CUSTOM_FIELD_DOLZINA_ROKAVA_KRATKI'), $MMMtemp);
            $MMMtemp = str_replace('COM_CUSTOM_FIELD_DOLZINA_ROKAVA_DOLGI',JText::_('COM_CUSTOM_FIELD_DOLZINA_ROKAVA_DOLGI'), $MMMtemp);
            $group->display = $MMMtemp;

hope this helps (took me 7 hours to reverse engineere that with firebug)...

matic

rvbgnu

  • 3rd party VirtueMart Developer
  • Jr. Member
  • *
  • Posts: 114
    • Puma-IT.ie
Re: How to translate customfields?
« Reply #17 on: June 20, 2012, 12:13:58 pm »
Thanks for getting closer, but I have tens of constants in language overrides  :'(

But I think there is some translation methods missing in
administrator/components/com_virtuemart/helpers/html.php,
 for example line 335 (public function select), it is where the menu drop down (html tags select / option).
But a simple JText::_() doesn't help here, unfortunately.
Best Regards, Hervé Boinnard - Irish Time (GMT)
Joomla! multilingual website and online business made easy - https://www.puma-it.ie

Updated for VM3 and Joomla 3.x! Stripe.com payment plugin for VirtueMart: 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

Zegenrijk

  • Beginner
  • *
  • Posts: 16
Re: How to translate customfields?
« Reply #18 on: October 01, 2012, 13:10:07 pm »
SOLVED

Change in: /administrator/components/com_virtuemart/models/customfields.php

Line 870
OLD:
$productCustom->text = $productCustom->custom_value . ' ' . $price;

NEW:
$productCustom->text =  JText::_ ($productCustom->custom_value) . ' ' . $price;

In your product give as a value of the custom field by example: COM_VIRTUEMART_COLOR_BLACK
In the language overrides you give the translations of COM_VIRTUEMART_COLOR_BLACK

Of course, nicer is it that you can translate this fields in the same way as you can translate the productname/product description in another language.