VirtueMart Forum

VirtueMart 2 + 3 + 4 => Virtuemart Development and bug reports => Topic started by: Jason Farmer on November 02, 2012, 12:43:43 PM

Title: BUG: Language not being applied to custom fields
Post by: Jason Farmer on November 02, 2012, 12:43:43 PM
J 2.5.6 vm 2.0.12b

BUG REPORT

I want a field that I will apply to many products and if I need to change it I want to do so via Language Overrides without having to reapply it to many products.This issue will also create problems for anyone running multi language sites.

(http://www.diigo.com/item/image/3bdsl/7jq2)
Create a custom field : Cart Variant with Language Elements (http://www.diigo.com/item/image/3bdsl/7jq2)

(http://www.diigo.com/item/image/3bdsl/u8eg)
Set up language overrides (http://www.diigo.com/item/image/3bdsl/u8eg)

(http://www.diigo.com/item/image/3bdsl/4a3u)
Apply to a product (http://www.diigo.com/item/image/3bdsl/4a3u)

Have a look at how it looks on the site ...
(http://www.diigo.com/item/image/3bdsl/63gr)
Featured products module (http://www.diigo.com/item/image/3bdsl/63gr)

(http://www.diigo.com/item/image/3bdsl/57no)
Product Detail (http://www.diigo.com/item/image/3bdsl/57no)

I have already fixed some of these using template overrides .. simply adding JTEXT:: calls around the appropriate fields,  it was worse before - I would demo this on the demo site but there's no access to Language Overrides there. However some of the html is still being created in core files. Notably administrator/components/com_virtuemart/models/customfields.php.

Please fix.

Title: Re: BUG: Language not being applied to custom fields
Post by: Milbo on November 02, 2012, 20:28:17 PM
Thanks for the good report.

the whole area is completly redesigned, but you are right. It would be nice to be able to use JText there. So you used it for the title and description?
Title: Re: BUG: Language not being applied to custom fields
Post by: Jason Farmer on November 03, 2012, 16:17:43 PM
Good to hear, I'll upgrade to the latest version.

Title & Description, Yes, I thought that it would be important to have these covered by language overrides for a multilingual shop.
Title: Re: BUG: Language not being applied to custom fields
Post by: bombayx on April 02, 2014, 22:49:19 PM
It seems this is not solved, you mentioned you'll update it but nothing happened yet. Will you do so? Thanks.
Title: Re: BUG: Language not being applied to custom fields
Post by: Milbo on April 03, 2014, 16:19:14 PM
Ehrm, this post is more than a year old and talking about vm2.0.12, and yes that is working since a year.
Title: Re: BUG: Language not being applied to custom fields
Post by: bombayx on April 03, 2014, 19:41:58 PM
Could you please bring some details how to use more translations of the Custom field - Cart Variant? How to translate fields like "Title"? Many thanks.
Title: Re: BUG: Language not being applied to custom fields
Post by: jjk on April 03, 2014, 21:24:43 PM
Quote from: bombayx on April 03, 2014, 19:41:58 PM
Could you please bring some details how to use more translations of the Custom field - Cart Variant? How to translate fields like "Title"? Many thanks.
The title translation was made much easier in VM 2.5.4.
Title: Re: BUG: Language not being applied to custom fields
Post by: bombayx on April 03, 2014, 22:21:50 PM
But that version is not officially available and I need to work with VM2 version.

Please tell me how to proceed. Please see enclosed screenshot below. Thanks.

http://share.pho.to/5Azpc/cg/original (http://share.pho.to/5Azpc/cg/original)
Title: Re: BUG: Language not being applied to custom fields
Post by: jjk on April 03, 2014, 22:27:50 PM
Your attached jpg consists of a single dot.
Title: Re: BUG: Language not being applied to custom fields
Post by: bombayx on April 05, 2014, 17:02:45 PM
I fixed the link.
Title: Re: BUG: Language not being applied to custom fields
Post by: Milbo on April 06, 2014, 10:27:34 AM
Just try with the vm2.5.5. Should directly work then.
Title: Re: BUG: Language not being applied to custom fields
Post by: bombayx on April 06, 2014, 11:03:24 AM
Any documentation for VM 2.5.5? What about compatibility with the modules and template?  Update procedure is the same as for VM 2.0.26d? Thanks.
Title: Re: BUG: Language not being applied to custom fields
Post by: jjk on April 07, 2014, 14:53:39 PM
http://forum.virtuemart.net/index.php?topic=96758.msg318220#msg318220
If you didn't hack the code, the update from 2.0.26d to the just released 2.6.0 should work without problems. But do test test this on a backup copy of your life site first!
Title: Re: BUG: Language not being applied to custom fields
Post by: bombayx on April 08, 2014, 20:51:12 PM
Quote from: jjk on April 07, 2014, 14:53:39 PM
http://forum.virtuemart.net/index.php?topic=96758.msg318220#msg318220
If you didn't hack the code, the update from 2.0.26d to the just released 2.6.0 should work without problems. But do test test this on a backup copy of your life site first!

Doesn't work because there is no option to define strings like "Title" in more languages!?
Title: Re: BUG: Language not being applied to custom fields
Post by: jjk on April 08, 2014, 21:27:29 PM
The english language keys/strings for Mr. and Mrs. are in the file your-root-folder\components\com_virtuemart\language\en-GB\en-GB.com_virtuemart_shoppers.ini
Search for:
COM_VIRTUEMART_SHOPPER_TITLE_MISS="Miss"
COM_VIRTUEMART_SHOPPER_TITLE_MR="Mr"
COM_VIRTUEMART_SHOPPER_TITLE_MRS="Mrs"

If those are not yet in your (slovak?) xx-XX.com_virtuemart_shoppers.ini, just copy the above keys/strings into it and replace the strings (for example "Miss") with the salutations in your language.
Title: Re: BUG: Language not being applied to custom fields
Post by: bombayx on April 08, 2014, 22:06:26 PM
Quote from: jjk on April 08, 2014, 21:27:29 PM
The english language keys/strings for Mr. and Mrs. are in the file your-root-folder\components\com_virtuemart\language\en-GB\en-GB.com_virtuemart_shoppers.ini
Search for:
COM_VIRTUEMART_SHOPPER_TITLE_MISS="Miss"
COM_VIRTUEMART_SHOPPER_TITLE_MR="Mr"
COM_VIRTUEMART_SHOPPER_TITLE_MRS="Mrs"

If those are not yet in your (slovak?) xx-XX.com_virtuemart_shoppers.ini, just copy the above keys/strings into it and replace the strings (for example "Miss") with the salutations in your language.

Maybe you don't get my point, here, how can I translate to a second language that string? This string is shown on he site ...

(http://i57.tinypic.com/2mg2mue.jpg)
Title: Re: BUG: Language not being applied to custom fields
Post by: jjk on April 08, 2014, 22:35:59 PM
Sorry, I misunderstood your question. If you want to translate 'Velkost', you have to enter a language key. Instead of 'Velkost' enter something like com_virtuemart_velkost. Then go to your Joomla language file override folders or use the Joomla language manager and add that key followed by a string to your english and (slovak?) override files.

For example:
COM_VIRTUEMART_PRODUCT_SIZE="Velkost" (place this one into the (slovak?) site and perhaps also into the administrator language override files)

COM_VIRTUEMART_PRODUCT_SIZE="Size" (place this one into the (english) site and perhaps also into the administrator language override files)

It is pretty similar to the way described in this tutorial (which is now obsolete concerning the Mr./Mrs. translation):
http://docs.virtuemart.net/tutorials/36-multilingual-store/105-using-language-keys-in-form-fields.html
Title: Re: BUG: Language not being applied to custom fields
Post by: bombayx on April 09, 2014, 19:35:09 PM
Quote from: jjk on April 08, 2014, 22:35:59 PM
Sorry, I misunderstood your question. If you want to translate 'Velkost', you have to enter a language key. Instead of 'Velkost' enter something like com_virtuemart_velkost. Then go to your Joomla language file override folders or use the Joomla language manager and add that key followed by a string to your english and (slovak?) override files.

For example:
COM_VIRTUEMART_PRODUCT_SIZE="Velkost" (place this one into the (slovak?) site and perhaps also into the administrator language override files)

COM_VIRTUEMART_PRODUCT_SIZE="Size" (place this one into the (english) site and perhaps also into the administrator language override files)

It is pretty similar to the way described in this tutorial (which is now obsolete concerning the Mr./Mrs. translation):
http://docs.virtuemart.net/tutorials/36-multilingual-store/105-using-language-keys-in-form-fields.html

Many thanks. Worked!
Title: Re: BUG: Language not being applied to custom fields
Post by: taenny on April 19, 2014, 17:45:55 PM
Hello,

I had the exact same question - thanks for sharing the answer!

I am also trying to translate all available values of my custom field for both front- and backend - in the example above represented by "XXS" etc, which I already named according to my own needs COM_VIRTUEMART_PRODUCT_USED,...
Translation of the title works well by placing it in the joomla language override section in the backend. Doing the same thing for the values of my custom field doesn't do the trick.

There is a thread in here (even sticky), which describes this scenario (http://forum.virtuemart.net/index.php?topic=96758.0) but I failed to locate the "ini" file, in which I am supposed to write my strings into. (tried xx-XX.com_virtuemart_shoppers.ini)
I also tried inserting those language keys into the joomla language override folder (/mydomain/language/overrides) with no effect.
Joomla Version: 2.5.18
VM Version: 2.6.0

Am I missing something? Any hints would be very much appreciated!
Title: Re: BUG: Language not being applied to custom fields
Post by: taenny on April 27, 2014, 20:43:40 PM
Resolved it on my own but I guess it is only a workaround.
Since no type of language override  (neither file nor backend entries) worked for the custom field values (Type:String, Is a list) I took a look at the code.

I created a template override for the productdetails view and changed in default_customfields.php around line 39

<?php echo $field->display ?> to <?php echo JText::_($field->custom_value); ?>

Creating a language override now takes effect.
Still wonder though, whether this is truly necessary..

I know this thread is in the bug report section and this is obviously no bug per se but I thought others might also run into this when using default templates.
Title: Re: BUG: Language not being applied to custom fields
Post by: Milbo on April 28, 2014, 14:49:19 PM
Quote from: taenny on April 19, 2014, 17:45:55 PM

I am also trying to translate all available values of my custom field for both front- and backend - in the example above represented by "XXS" etc, which I already named according to my own needs COM_VIRTUEMART_PRODUCT_USED,...
Translation of the title works well by placing it in the joomla language override section in the backend. Doing the same thing for the values of my custom field doesn't do the trick.

should be in the frontend language.


Quote from: taenny on April 27, 2014, 20:43:40 PM
Resolved it on my own but I guess it is only a workaround.
Since no type of language override  (neither file nor backend entries) worked for the custom field values (Type:String, Is a list) I took a look at the code.

I created a template override for the productdetails view and changed in default_customfields.php around line 39

<?php echo $field->display ?> to <?php echo JText::_($field->custom_value); ?>

Creating a language override now takes effect.
Still wonder though, whether this is truly necessary..

I know this thread is in the bug report section and this is obviously no bug per se but I thought others might also run into this when using default templates.


Seems that the vmText is missing for type string, "is a list".