Hello,
I have set-up the custom fields translation by using overrides. but although the overrides works fine on the frontend, they do not in the backend, I still see COM_VIRTUEMART_Whatever in all the field values etc.
Am I doing something wrong, or those cannot be translated?
[the override ini file is present and filled in the admin languages folder...]
Thanks!
OK i think i found a way to make it work on the backend.
go to administrator/components/com_virtuemart/views/product
open the file: view.json.php
at line 146 you will see the code:
<td><span class="hasTip" title="'.JText::_($field->custom_tip).'">'.$field->custom_title.'</td>
change it to
<td><span class="hasTip" title="'.JText::_($field->custom_tip).'">'.JText::_($field->custom_title).'</td>
and the custom field titles will work.
I am on Virtuemart 2.0.24b
Thank you for the reply! :)
Unfortunately I'm still running 2.0.24 since my template brakes with the latest version...
Sounds like a good hack.
Although the titles are beign translates once you save the product, it's the values that stay in the "raw" form...
https://dl.dropboxusercontent.com/u/5072151/values.jpg
ok i know what you are talking about now,
what you need for that is a hack in the another php file.
file administrator/components/com_virtuemart/models/
open file customfields.php and find the function: public function displayProductCustomfieldFE
change the code that says:
$value = $customfield->custom_value;
to
$value = Jtext::_($customfield->custom_value);
I Hope it works for you,
GOOD LUCK
Thanks! But it doesn't seem to work.
I'm using language overrrides for the translation, maybe that's the reason...
Should work without a hack. If you can supply a screenshot of your problem, somebody might have the time to test it.
Translating custom field values for the backend should be similar to the procedure in the frontend, which is described here: http://forum.virtuemart.net/index.php?topic=96758.0
Hello again Nick,
Hmmmm it is strange, because i am using overides too.
I will check it out again and will reply soon.
OK Nick I found out what the problem was that didnt work for you.
I forgot to give you one more file you need to change.
So I will start it all from the beginning here so just in case you or anyone else gets lost along the way.
First step,
We create the extra fields and we give them titles for example COM_VIRTUEMART_CHAR_TYPE
In the language overrides section we create new entries in the desired languages ( my example is for Greek and English )
COM_VIRTUEMART_CHAR_TYPE="Type" for english and
COM_VIRTUEMART_CHAR_TYPE="Τύπος" for greek.
My Values for this extra field in the overrides is:
For English:
ΤΣΕΠΗΣ="Pocket"
ΠΡΟ-ΙΔΙΟΚΤΗΤΟ="Pre-Owned"
ΚΑΙΝΟΥΡΓΙΟ="New"
For Greek:
ΤΣΕΠΗΣ="Τσέπης"
ΠΡΟ-ΙΔΙΟΚΤΗΤΟ="Προ-Ιδιόκτητο"
ΚΑΙΝΟΥΡΓΙΟ="Καινούργιο"
Now lets move on to the next step where i have changed the coding to some files, BUT REMEMBER keep a copy of the original files just in case:
HACKS FOR CUSTOM FIELDS TO WORK WITH MULTILANGUAGE and OVERIDES.
================================================================
Hack 01
file administrator/components/com_virtuemart/views/product/view.json.php
------------------------------------------------------------------------
goto line 146 and change
<td><span class="hasTip" title="'.JText::_($field->custom_tip).'">'.$field->custom_title.'</td>
to
<td><span class="hasTip" title="'.JText::_($field->custom_tip).'">'.JText::_($field->custom_title).'</td>
Hack 02
file administrator/components/com_virtuemart/models/customfields.php
--------------------------------------------------------------------
find the function: public function displayProductCustomfieldFE
change the code that says:
$value = $customfield->custom_value;
to
$value = Jtext::_($customfield->custom_value);
HACK 03
Open File administrator/components/com_virtuemart/views/custom/tmpl/default.php
-------------------------------------------------------------------------------
and on line 101 it has
<td><?php echo JHTML::_('link', JRoute::_($link, FALSE), $custom->custom_title, array('title' => JText::_('COM_VIRTUEMART_EDIT').' '.$custom->custom_title)); ?></td>
change it to
<td><?php echo JHTML::_('link', JRoute::_($link, FALSE), JText::_($custom->custom_title), array('title' => JText::_('COM_VIRTUEMART_EDIT').' '.$custom->custom_title)); ?></td>
GOOD LUCK !!
Alexandros
Thanks for all for the replies!
Alexander, I don't have the exact same code in the json.php I have [running 2.0.24]
$html[] = '<tr class="removable">
<td>'.$field->custom_title.'</td>
<td>'.$field->custom_tip.'</td>
<td>'.$display.'</td>
So I added it to the first <td>
*Made the other changes too
But still no luck :p
I'm attaching caps from the various stages, in case I'm doing something boneheaded :p
[attachment cleanup by admin]
OK Nick, this is what i am going to do,
I will roll back my Virtuemart to Version 2.0.24 and see about it.
In the meanwhile, i see that u are from Greece ? if so, maybe you can send me a pm or i send u a pm and we can talk about it on the phone ?
Hello again Nick,
I rolled back my Virtuemart installation to 2.0.24 and did the corrections i described and its work for me.
I will leave you an pm and maybe you can give me a call so that i could guide you step by step.
Regards
Alexandros
Look At These
[attachment cleanup by admin]
and look at the overrides
[attachment cleanup by admin]
Yeah it looks right :)
Do you also see the translations (the actual translations - not the values - of-course you used easy t read names in caps) while adding the filed to a product?
Like so?
http://forum.virtuemart.net/index.php?action=dlattach;topic=120401.0;attach=57262;image
since my customer is Greek, either he logs in the admin with Greek or English language, the values will be displayed in Greek. The front of the e-shop though will show the values correctly in the desired language of the visitor.
[attachment cleanup by admin]
Ah! OK! That's what I was talking about. Of-course you set it up smartly so it's easy to use but the drop downs don't really show the override translation. If for example you had set it up like VM_UNISEX="Unisex" you would still get "VM_UNISEX" on those dropdowns.
It works fine on my front end as well, it seems there must be somewhere where we can put a Jtext to display those fields in their translation on the back end.