VirtueMart Forum

VirtueMart 2 + 3 + 4 => Language/Translations => Topic started by: funny-rabbit on October 15, 2020, 15:07:22 PM

Title: I can't find the language string for translation
Post by: funny-rabbit on October 15, 2020, 15:07:22 PM
In Virtuemart I have a language string that I want to translate into the German language.
The language string is "Maximum coupon usage limit reached, please try different code."

I have searched all joomla and virtuemart files with notepad++ with "search inside files" but notepad++ doesn't find that expression.
Next I searched the sql database, the expression isn't there either.

How can I find and translate that expression?
Title: Re: I can't find the language string for translation
Post by: Jörgen on October 15, 2020, 15:23:26 PM
You have not searched all files. I guess You are using Awocoupon. Please search these files.

Have You really searched for the right string ? It could be made up of multiple strings.

You may also search Joomla language manager, visit Joomla forum for instructions to use.

Jörgen @ Kreativ Fotografi
Title: Re: I can't find the language string for translation
Post by: GJC Web Design on October 15, 2020, 15:30:07 PM
Yes .. searching for parts of the string .. e.g. 'try different' is very good advice
Title: Re: I can't find the language string for translation
Post by: funny-rabbit on October 15, 2020, 16:08:47 PM
yeah, I searched the half-part of the expression: nada
that expression also couldn't be found (neither part of it) in the language manager.
what I'm trying to do now, is to only search for the word 'coupon' in the database.
Title: Re: I can't find the language string for translation
Post by: Jörgen on October 15, 2020, 16:25:59 PM
In the language manager?
You said you searched ALL the Joomla and VM files.
What coupons manager are you using?

Jörgen @ Kreativ Fotografi
Title: Re: I can't find the language string for translation
Post by: pinochico on October 15, 2020, 19:55:23 PM
it's funny:

https://www.google.com/search?client=safari&rls=en&q=linux+how+find+text+expression+in+ftp&ie=UTF-8&oe=UTF-8


1. Ask VM DEV why use non-sense hard coded text and don't use Language Constant and ask for repair
2. Change core file VM self and change to override language constant
3. Wait for VM DEV for fix on next version or every upgrade fix self
4. Learn to use develper tools for eshop development (grep, ...) [easygrep is our custom version from grep, developed by EasySoftware]
Title: Re: I can't find the language string for translation
Post by: jjk on October 16, 2020, 16:41:04 PM
Notepad++ also finds this old (probably forgotten) hard coded string if you set the search filter to 'all' or 'php' files  ;)
Title: Re: I can't find the language string for translation
Post by: pinochico on October 16, 2020, 19:25:30 PM
The Problem is not in method use
Title: Re: I can't find the language string for translation
Post by: funny-rabbit on October 16, 2020, 19:30:21 PM
the problem is probably witch-craft because see my uploaded image. I don't have activated 'use english for untranslated strings' which to me means, that english isn't even used when a string is not translated in the language manager in another language. and that string definitely belongs to virtuemart. so what's going on here?

in short: virtuemart configuration menu -> use english for untranslated strings is set to 'no'
Title: Re: I can't find the language string for translation
Post by: pinochico on October 16, 2020, 19:38:39 PM
Quoteso what's going on here?

The problem is this, that your setup "use english for untranslated strings is set to 'no' or 'yes'  doesn't solve your problem, you can't really see it in my picture?
This sentence is not in LANGUAGE CONSTANT then you can't find and use with your actions in post.

The marginal problem is that you only searched in language constants and you can't work when searching for a text string on FTP (one of the basic steps in debugging a problem with program code in the e-shop).
The positive is that now you can do it, thanks to advice.

Title: Re: I can't find the language string for translation
Post by: funny-rabbit on October 16, 2020, 19:53:13 PM
ok I helped you can you clarify for me now?

https://drive.google.com/file/d/1dsufrYI9Umv_5q9n7VPr7fUrjQ5XSo_s/view?usp=sharing (https://drive.google.com/file/d/1dsufrYI9Umv_5q9n7VPr7fUrjQ5XSo_s/view?usp=sharing)

use english for untranslated strings is set to no, so normally english language values can't appear in the cart view?
Title: Re: I can't find the language string for translation
Post by: pinochico on October 16, 2020, 20:26:51 PM
In this post we communicate only about "Maximum coupon usage limit reached, please try different code."

This text are not as LANGUAGE CONSTANT, then your sending setup not help to you.
You must make step by step as I wrote there: http://forum.virtuemart.net/index.php?topic=145661.msg517362#msg517362 for fix this problem (but only this).

I think the best is change code from

return 'Maximum coupon usage limit reached, please try different code.';

to

return vmText::_( 'COM_VIRTUEMART_CART_COUPON_CODE_NOVALID' );

But you must test self :)

Title: Re: I can't find the language string for translation
Post by: GJC Web Design on October 16, 2020, 20:51:22 PM
@funny-rabbit

to clarify ..  the text "Maximum coupon usage limit reached, please try different code." is mistakenly HARDCODED in the file helpers/cart.php as a string .. not a lang constant.

So in the short term u need to replace it with a constant of your own  -- I am sure in the next release it will be corrected
Title: Re: I can't find the language string for translation
Post by: jjk on October 16, 2020, 20:58:59 PM
pinochico and GJC replied while I was typing this. but maybe I can clarify the procedure a little bit further...  :)

At present Maximum coupon usage limit reached, please try different code. is hard-coded in the file ...\components\com_virtuemart\helpers\cart.php. line 1130, which means it is not translatable in the de-DE.com_virtuemart.ini file.

In order to make it translatable, you would have to replace that with something like:
return vmText::_('COM_VM_COUPON_MAX_LIMIT_REACHED');

and afterwards add
COM_VM_COUPON_MAX_LIMIT_REACHED="Maximum coupon usage limit reached, please try different code."
to the frontend en-GB.com_virtuemart.ini file and maybe
COM_VM_COUPON_MAX_LIMIT_REACHED="Maximale Coupon-Verwendungsgrenze erreicht, bitte anderen Code ausprobieren.."
to the German frontend de- DE.com_virtuemart.ini file.

A similar change will be needed for line 1201 in cart.php

...or wait for the next release of VirtueMart. It should be corrected there.