VirtueMart Forum

VirtueMart 2 + 3 + 4 => Language/Translations => Topic started by: m.davide82 on January 13, 2020, 16:44:30 PM

Title: [SOLVED] Multilingual: Variants label are not translated
Post by: m.davide82 on January 13, 2020, 16:44:30 PM
Hello,

I created multilingual constant for each name of the variant and I inserted the translation in the override are, but this name isn't translated.
Screen in attachment.

Why? A big?


Thanks.
Davide
Title: Re: Multilingual: Variants label are not translated
Post by: Jörgen on January 13, 2020, 21:13:31 PM
What VM version, PHP version, Joomla version ?
Using custom template ?
In what view ?

Jörgen @ Kreativ Fotografi
Title: Re: Multilingual: Variants label are not translated
Post by: m.davide82 on January 14, 2020, 09:23:49 AM
Hi Jörgen,

Virtuemar 3.6.1
Php 7.2
Joomla 3.9.14
Product view
Template VP_Smart, but the problem persists with beez too.

Thanks a lot.
Davide
Title: Re: Multilingual: Variants label are not translated
Post by: Studio 42 on January 14, 2020, 09:35:40 AM
Have you entered the translation using joomla or directly in the override file ?
If you do a syntax error in the file, nothing is translated.
Title: Re: Multilingual: Variants label are not translated
Post by: m.davide82 on January 14, 2020, 11:05:23 AM
I created directly the file.
The other translations are working, only that ones of the custom fields not.

This is the syntax:
CAMPI_QUARTO_SPLIT="cuarto split"
CAMPI_TERZO_SPLIT="tercer split"
CAMPI_SECONDO_SPLIT="segundo split"


Thanks.
Davide
Title: Re: Multilingual: Variants label are not translated
Post by: Studio 42 on January 14, 2020, 13:53:36 PM
Try to use the Joomla extentions > language(s)> susbstitution to add the translation.
If should work here, if you selet the right language
Title: Re: Multilingual: Variants label are not translated
Post by: m.davide82 on January 14, 2020, 17:18:40 PM
Hi,

tested now, same problem.


Thanks,
Davide
Title: Re: Multilingual: Variants label are not translated
Post by: Studio 42 on January 14, 2020, 17:48:35 PM
Is this generic variant or multi-variant customfield type ?
Title: Re: Multilingual: Variants label are not translated
Post by: m.davide82 on January 14, 2020, 17:53:54 PM
They are simple "string".
Title: Re: Multilingual: Variants label are not translated
Post by: jjk on January 14, 2020, 18:52:13 PM
If it's a generic 'string' type variant, did you set it to 'Published' in the custom field list?
Title: Re: Multilingual: Variants label are not translated
Post by: Ventsi Genchev on January 15, 2020, 04:21:38 AM
Did you add the translation to both files? Overwriting Administration and Frontend?
Title: Re: Multilingual: Variants label are not translated
Post by: m.davide82 on January 16, 2020, 10:31:33 AM
@jjk
Yes, it's published.


@Ventsi Genchev
Sure, I did it, but no results.
Title: Re: Multilingual: Variants label are not translated
Post by: Jörgen on January 16, 2020, 11:45:51 AM
 ??? You have this in the language file:
QuoteCAMPI_QUARTO_SPLIT="cuarto split"
CAMPI_TERZO_SPLIT="tercer split"
CAMPI_SECONDO_SPLIT="segundo split"

But you miss these translations:
QuoteCAMPI_COLORE_DEL_MOBILE
CAMPI_COLONNA_140x35x20
Or am I missing something ?

Jörgen @ Kreativ Fotografi
Title: Re: Multilingual: Variants label are not translated
Post by: m.davide82 on January 17, 2020, 17:08:35 PM
Hi Jörgen,

no no, the translation are present, it was just an example...


Thanks.
Davide
Title: Re: Multilingual: Variants label are not translated
Post by: jjk on January 17, 2020, 20:38:23 PM
Did you enable and checked the output of Joomla 'Debug Language' already? If there is a parsing error in your language override file, it can stop loading before it reaches the custom variant labels.
Title: Re: Multilingual: Variants label are not translated
Post by: pinochico on January 18, 2020, 07:14:58 AM
Until today, I thought Virtuemart core should not translate customfiled values and I must always use the Customfield4All plugin from BreakDesign.

According to the discussion, it looks like it's a bug in Virtuemart?
Title: Re: Multilingual: Variants label are not translated
Post by: jjk on January 18, 2020, 12:28:04 PM
Quote from: pinochico on January 18, 2020, 07:14:58 AM
According to the discussion, it looks like it's a bug in Virtuemart?
I don't think so. I've been using core VM custom fields in my shop since many years, including latest version.
See: http://forum.virtuemart.net/index.php?topic=96758.msg318220#msg318220 (http://forum.virtuemart.net/index.php?topic=96758.msg318220#msg318220)
Title: Re: Multilingual: Variants label are not translated
Post by: m.davide82 on January 21, 2020, 18:22:32 PM
Hi to everybody,

just tested everything, debug included, but the overrides are working for everything, but not for the custom fields.

Any help please?


Thanks.
Davide
Title: Re: Multilingual: Variants label are not translated
Post by: jflash on January 21, 2020, 21:04:34 PM
Try to put this strings into your languagefile xx-XX.com_virtuemart.ini and just in case do it in admin and site languagefiles. Is it working this way?
Title: Re: Multilingual: Variants label are not translated
Post by: m.davide82 on January 22, 2020, 15:30:04 PM
Hi,

just tested, but the answer is NO.
It's not working.
Title: Re: Multilingual: Variants label are not translated
Post by: jjk on January 22, 2020, 23:14:58 PM
Can you post screenshots of a custom field settings and of the 'Product [Edit] custom fields tab of a product to which you have assigned the custom field?
Title: Re: Multilingual: Variants label are not translated
Post by: m.davide82 on January 23, 2020, 11:28:47 AM
Hi jjk,

sure, please see the attachments.

Thanks.
Davide
Title: Re: Multilingual: Variants label are not translated
Post by: jjk on January 23, 2020, 21:29:41 PM
I just tested the label translation with the settings from your screenshots in VM 3.6.11 build number 10238 (without finetuning the display for my template). It works in my case. See images attached. Note that the '0.00 €' is the translation of 'no additional charge' in my german language file. Also I didn't create a language key to translate the value (your 'Si')

When you enable 'Debug Language' in Joomla, does it really show now parsing errors in a language file?
Title: Re: Multilingual: Variants label are not translated
Post by: m.davide82 on January 29, 2020, 09:04:34 AM
Hi Jjk,

in debug language...

For that variables I see ?? instead off **.
Please see the attachment.

Any idea?


Thanks.
Davide
Title: Re: Multilingual: Variants label are not translated
Post by: Studio 42 on January 29, 2020, 09:52:53 AM
Quote from: m.davide82 on January 29, 2020, 09:04:34 AM
Hi Jjk,

in debug language...

For that variables I see ?? instead off **.

This mean that you have an error in the language file.
Try to remove or rename old override file and enter only 1 translation in the back-end and check if it work.
Title: Re: Multilingual: Variants label are not translated
Post by: jjk on January 29, 2020, 11:27:51 AM
The question marks mean that the string is translatable but no match was found in the language definition file. In this case I suppose that Davide didn't enter a language key in the VM custom field value. In one of the examples above there should be something like:
In the VM custom field selected as the custom field type in the 'Custom Field' tab of the product: CAMPI_TEMPORIZZATORE
In the VM custom field value: CAMPI_TEMPORIZZATORE_VALUE_YES

Both language keys/strings have to be added to the site language override files (English/Italian).
So the override for the custom value field should be for example: CAMPI_TEMPORIZZATORE_VALUE_YES="Yes"
Title: Re: Multilingual: Variants label are not translated
Post by: m.davide82 on January 29, 2020, 14:39:45 PM
Hi,

I inserted just the:
CAMPI_TEMPORIZZATORE="Temporizzatore"

The dropdown results for the moment can be in english.


Thanks.
Davide
Title: Re: Multilingual: Variants label are not translated
Post by: m.davide82 on February 05, 2020, 07:54:49 AM
Any idea on how can I solve it?


Thanks.
Davide
Title: Re: Multilingual: Variants label are not translated
Post by: m.davide82 on February 05, 2020, 08:05:24 AM
Hi,

I just did anothet test.

I created another language variable, I inserted it near the custom field title and it is translated.

<div class="product-fields-title-wrapper">
        <span <?php echo $titleClass $title ?>> <?php echo vmText::_($field->custom_title) . vmText::_('TEST'?> </span>
</div>


So, the problem is in the custom field title code.
Why I'm not able to translate this dynamic part?  $field->custom_title

Thanks.
Davide
Title: Re: Multilingual: Variants label are not translated
Post by: Jörgen on February 05, 2020, 10:56:05 AM
THE problem lies in THE text string. Are you Syre that you have No hidden characters and correct syntax for the customs field data. Place THE key string immediately arter THE custom field language string and try again.
IF THE custom field string is outputted it Will get translated only IF THE syntax is correct. Check for extra characters.

Jörgen
Title: Re: Multilingual: Variants label are not translated
Post by: jjk on February 05, 2020, 11:40:46 AM
Just wondering - does VP Framework have it's own override file?
Title: Re: Multilingual: Variants label are not translated
Post by: m.davide82 on February 05, 2020, 14:16:11 PM
Hi Jorgen,

as I thought, the problem is in the custom field title.

If I insert the variable after the code, it is translated.


<span <?php echo $titleClass $title ?>>
          <?php echo vmText::_($field->custom_title) . vmText::_('TEST') .' ' vmText::_('CAMPI_MOBILE'); ?>
</span>


Any idea?


Thank. Davide
Title: Re: Multilingual: Variants label are not translated
Post by: Studio 42 on February 05, 2020, 18:41:03 PM
Try to use trim to be sure you have no special char
vmText::_(trim($field->custom_title));
Title: Re: Multilingual: Variants label are not translated
Post by: pinochico on February 05, 2020, 19:10:16 PM
If you constantly insist on this version and want to use this functionality that I only used in conjunction with CustomField4All -

there is no problem in the order of triggering individual triggers:
- rendering value customfiled_title
- call translation function (vmtext,  JTEXT)
???

For me, I would be the first (before writing on the forum) to test using the right Joomla function JTEXT.

Replacing all internal Joomla functions with their own "hooray now all VM instead of Joomla" may not always be required and useful (maybe for a standalone application installed subsequently on WordPress - once Virtuemart was already a standalone application - PS_SHOP).

Only then would I wonder how to render the content of customfield_title before calling the vmTEXT function respectively. JTEXT.

If I still fail here, I would ask here or return to the proven and functional method of using the CustomField4All plugin.
Title: Re: Multilingual: Variants label are not translated
Post by: m.davide82 on February 05, 2020, 21:00:10 PM
Quote from: Studio 42 on February 05, 2020, 18:41:03 PM
Try to use trim to be sure you have no special char
vmText::_(trim($field->custom_title));

Hi,

thank you very much, finally it works!!!

Probably the best will be to resolve this in VM core.


Thanks a lot,
Davide

Title: Re: Multilingual: Variants label are not translated
Post by: m.davide82 on February 05, 2020, 21:02:12 PM
Quote from: pinochico on February 05, 2020, 19:10:16 PM
If you constantly insist on this version and want to use this functionality that I only used in conjunction with CustomField4All -

there is no problem in the order of triggering individual triggers:
- rendering value customfiled_title
- call translation function (vmtext,  JTEXT)
???

For me, I would be the first (before writing on the forum) to test using the right Joomla function JTEXT.

Replacing all internal Joomla functions with their own "hooray now all VM instead of Joomla" may not always be required and useful (maybe for a standalone application installed subsequently on WordPress - once Virtuemart was already a standalone application - PS_SHOP).

Only then would I wonder how to render the content of customfield_title before calling the vmTEXT function respectively. JTEXT.

If I still fail here, I would ask here or return to the proven and functional method of using the CustomField4All plugin.

Before to write I tested JText, but the result was the same.
If you have a website with more than 10.000 products, you can't change all the custom fields, trust me.
Title: Re: [SOLVED] Multilingual: Variants label are not translated
Post by: Studio 42 on February 05, 2020, 23:08:44 PM
if it work with trim, then you have hidden special char in your custom_title
Title: Re: [SOLVED] Multilingual: Variants label are not translated
Post by: m.davide82 on February 06, 2020, 10:26:19 AM
Hi,

it's very strange, I checked everything...
I deleted all the strings from override, I inserted just one string and it wasn't working...

Have a nice day,
Davide
Title: Re: [SOLVED] Multilingual: Variants label are not translated
Post by: Jörgen on February 06, 2020, 19:45:53 PM
There are a a lot of installs that do not need trim. If You don´t insert space characters in Your language keys, You simply do not need the extra trim call. Checking the strings for strange characters, spaces and syntax errors would probably do the trick.

Jörgen @ Kreati Fotografi
Title: Re: [SOLVED] Multilingual: Variants label are not translated
Post by: pinochico on February 07, 2020, 17:51:02 PM
QuoteIf you have a website with more than 10.000 products, you can't change all the custom fields, trust me.

I trust You, we have eshops with 220 000 products :)