Author Topic: [SOLVED] Multi-language VAT rule is not translated in several places  (Read 1037 times)

acarvalho

  • Beginner
  • *
  • Posts: 13
  • A beginner
I'm using the latest VM, and for my VAT rule, I defined a language constant in English and Portuguese: COM_VIRTUEMART_VATRULE="VAT (23%)" (and for the PT: "IVA (23%)").

I placed this language constant into the VAT rule, the .ini files for my template and at the language override for the admin in both languages.

When I go to the rule definition, it is correctly trranslated in the back-end.

At the front-end it is correctly translated.

The issue is when the checkout is done and the system sends the email, the column for the VAT displays the constant (COM_VIRTUEMART_VATRULE) and not the translated value!
The same happens at the order edit at the back-end (at the details table) and also at the product edit (the caption at the price "Tax Affecting:") although the VAT rule at the dropdown is translated!

I even placed the constant + value at the language override of the front, but no luck!

How can this be solved?

Jörgen

  • Global Moderator
  • Sr. Member
  • *
  • Posts: 3479
    • Kreativ Fotografi
  • VirtueMart Version: 3.4.x
Re: Multi-language VAT rule is not translated in several places
« Reply #1 on: March 26, 2021, 23:49:35 pm »
Another unknown Vm version and perhaps unknown template overrides ?

Jörgen @ Kreativ Fotografi
Joomla 3.9.18
Virtuemart 3.4.x
Olympiantheme Hera (customized)
This reflects current status when viewing old post.

acarvalho

  • Beginner
  • *
  • Posts: 13
  • A beginner
Re: Multi-language VAT rule is not translated in several places
« Reply #2 on: March 29, 2021, 13:22:31 pm »
I'm using the latest VM: 3.8.8 10472
Joomla 3.9.25
I don't have any overrides for the email product list, nor the admin template.

I'm using the new admin template. I know it's a beta, but the same happened with the original template, I just tested it.

Have you tried it yourself?

Jörgen

  • Global Moderator
  • Sr. Member
  • *
  • Posts: 3479
    • Kreativ Fotografi
  • VirtueMart Version: 3.4.x
Re: Multi-language VAT rule is not translated in several places
« Reply #3 on: March 29, 2021, 15:53:36 pm »
Quote
I even placed the constant + value at the language override of the front, but no luck!

What does this mean ?

Jörgen
Joomla 3.9.18
Virtuemart 3.4.x
Olympiantheme Hera (customized)
This reflects current status when viewing old post.

jenkinhill

  • UK Web Developer & Consultant
  • Global Moderator
  • Super Hero
  • *
  • Posts: 28131
  • Always on vacation
    • Jenkin Hill Internet
Re: Multi-language VAT rule is not translated in several places
« Reply #4 on: March 29, 2021, 16:16:22 pm »
Are you using <?php echo vmText::_('COM_VIRTUEMART_VATRULE') ?>  to display the text in the templates? 
Kelvyn

Jenkin Hill Internet,
Lowestoft, Suffolk, UK

Unsolicited PMs/emails will be ignored.

Please mention your VirtueMart, Joomla and PHP versions when asking a question in this forum

Currently using VirtueMart 3.8.9.10473 on Joomla 3.9.24 PHP 7.4.14

pinochico

  • 3rd party VirtueMart Developer
  • Full Member
  • *
  • Posts: 1126
    • MiniJoomla
  • Skype Name: support-easysoftware
  • VirtueMart Version: 3
Re: Multi-language VAT rule is not translated in several places
« Reply #5 on: March 29, 2021, 16:19:03 pm »
No, only. place in DB as name of rules and into ini file for template, isn't it?  :)
www.minijoomla.org  - new portal for Joomla!, Virtuemart and other extensions
XML Easy Feeder - feeds from products, orders and database table
Virtuemart Email Manager - customs email templates

acarvalho

  • Beginner
  • *
  • Posts: 13
  • A beginner
Re: Multi-language VAT rule is not translated in several places
« Reply #6 on: April 05, 2021, 19:01:33 pm »
The best is to show you:

When I create the VAT rule, I place the constant at its title field, and it displays correctly at the back-end:


The list of the VAT rules prove that it is translated (I have it translated in all languages at my .ini files for the overrides and front language .ini files):


At the front it displays correctly:


It's when it sends the email that it starts to show the issue:


Also at the product details setup at the back-end (Note that at the dropdown it is translated, but the caption on the right is not):


At the orders, not translated:


Also I found out that even if I change the translation, or even remove the constant, the emails sent for this order (if I change the state of the order I have it set-up to send an email), it always sends with the original (in this case) issue (not translated)!!

Can anyone help me, please?

pinochico

  • 3rd party VirtueMart Developer
  • Full Member
  • *
  • Posts: 1126
    • MiniJoomla
  • Skype Name: support-easysoftware
  • VirtueMart Version: 3
Re: Multi-language VAT rule is not translated in several places
« Reply #7 on: April 05, 2021, 21:08:58 pm »
for virtuemart exist more then one ini file
www.minijoomla.org  - new portal for Joomla!, Virtuemart and other extensions
XML Easy Feeder - feeds from products, orders and database table
Virtuemart Email Manager - customs email templates

acarvalho

  • Beginner
  • *
  • Posts: 13
  • A beginner
Re: Multi-language VAT rule is not translated in several places
« Reply #8 on: April 05, 2021, 21:43:09 pm »
But the language override for the admin should be enough, it overrides everything in the back-end.

What other overrides are there for the back-end?
(note that I don't want to touch the original language ini files, as soon as the component is updated, the changes are gone).

Jörgen

  • Global Moderator
  • Sr. Member
  • *
  • Posts: 3479
    • Kreativ Fotografi
  • VirtueMart Version: 3.4.x
Re: Multi-language VAT rule is not translated in several places
« Reply #9 on: April 05, 2021, 22:46:36 pm »
IVA 27% an VAT is not the same language key. It is hard to follow your example.
I would guess that You should check Your overrides to see if this is included correctly:
Code: [Select]
<td style="text-align: right;width: 11%;"><strong><?php echo vmText::_('COM_VIRTUEMART_ORDER_PRINT_SUBTOTAL_DISCOUNT_AMOUNT'?></strong></td>
Jörgen @ Kreativ Fotografi
Joomla 3.9.18
Virtuemart 3.4.x
Olympiantheme Hera (customized)
This reflects current status when viewing old post.

Studio 42

  • Contributing Developer
  • Sr. Member
  • *
  • Posts: 4448
  • Joomla & Virtuemart developper
    • Studio 42 - Virtuemart & Joomla extentions
  • VirtueMart Version: 2.6 & 3
Re: Multi-language VAT rule is not translated in several places
« Reply #10 on: April 06, 2021, 09:02:21 am »
If you translate in the right language in front+admin. It should be right
Adding a language key in the template is not always used, so use standard Joomla override for each language.

acarvalho

  • Beginner
  • *
  • Posts: 13
  • A beginner
Re: Multi-language VAT rule is not translated in several places
« Reply #11 on: April 06, 2021, 10:09:35 am »
IVA 27% an VAT is not the same language key. It is hard to follow your example.
My example at the back-end is in English and the Front is in Portuguese.

All is working as expected in the front! Sorry for not having it in English, I assure you the translation also works in the front for every language.

Also, how can you explain that the constant is correctly translated in the back-end in the VAT rule definition (I've switched my language to see it in Portuguese and English and it is translated).

What I've found is that VM saves the VAT rule into this table: #__virtuemart_order_calc_rules and in the column calc_rule_name it places my constant and not the translated value.

If you translate in the right language in front+admin. It should be right
Adding a language key in the template is not always used, so use standard Joomla override for each language.
That's what I'm doing, as explained, I have used the labguage override for the admin in every language (stored in /administrator/language/overrides), and it partially works (as explained and detailed in my examples), and also at my template language files (in my template files), and as shown, it works.

The only thing that doesn't work is at the email, orders and partially at the product edit.

The key is where VM updates the db with the constant for the VAT rule, it is ignoring the translation.

Could any of you try it by yourself? it doesn't even need to be multi-language. Just place a constant into the VAT rule and translate it in the language overrides and in your template language, then see what happens.

Jörgen

  • Global Moderator
  • Sr. Member
  • *
  • Posts: 3479
    • Kreativ Fotografi
  • VirtueMart Version: 3.4.x
Re: Multi-language VAT rule is not translated in several places
« Reply #12 on: April 06, 2021, 10:29:26 am »
Quote
The key is where VM updates the db with the constant for the VAT rule, it is ignoring the translation.
Why should is store the translated value ? And if it did in which language, the calcs table should be for all languages right ?

Jörgen
Joomla 3.9.18
Virtuemart 3.4.x
Olympiantheme Hera (customized)
This reflects current status when viewing old post.

acarvalho

  • Beginner
  • *
  • Posts: 13
  • A beginner
Re: Multi-language VAT rule is not translated in several places
« Reply #13 on: April 06, 2021, 17:01:27 pm »
Quote
The key is where VM updates the db with the constant for the VAT rule, it is ignoring the translation.
Why should is store the translated value ? And if it did in which language, the calcs table should be for all languages right ?
Of course not, I just pointed out the place where the constant is saved in that particular table, and it may help the devs. I don't appreciate your sarcasm.

Also, did you read that even if I change the VAT rule name (can even be something not to be translated), it will always use the initial one that the order used? (the initial one saved in the database table for that order).

Have you tried it yourself? I'm curious to see your findings.

I'm positive this is not working correctly and either there is a place for this kind of translation (which may not be standard, because I'm more than used to do this kind of translations with the ini files and ini overrides), or there is a different techinque to translate these elements? (like the one for the products, where VM has a table for each language).

Jörgen

  • Global Moderator
  • Sr. Member
  • *
  • Posts: 3479
    • Kreativ Fotografi
  • VirtueMart Version: 3.4.x
Re: Multi-language VAT rule is not translated in several places
« Reply #14 on: April 07, 2021, 08:17:22 am »
I know when I am not wanted, this is not sarkasm ...

Jörgen
Joomla 3.9.18
Virtuemart 3.4.x
Olympiantheme Hera (customized)
This reflects current status when viewing old post.