prestashop 1.7.6.1
when i translation some with %string%,can not save and log this error:
translation:
The password must be at least %length% characters long.
to:
密码长度不能少于%length%个字符
Hi @langziyang,
Thanks for your report.
I manage to reproduce the issue with PS1.7.6.1 & PS1.7.5.2 in the back.
In the FO, it is OK.
Steps to reproduce the issue
This field cannot be shorter than 8 characters
Translations successfully updated
PS: I tried with the FO => OK


I’ll add this to the debug roadmap so that it’s fixed. If you have already fixed it on your end or if you think you can do it, please do send us a pull request!
Thanks!
(Continuing from discussion in #16421)
@khouloudbelguith After taking a closer look at this I don't think it's a 5 minute fix.
According to TranslateCore::checkAndReplaceArgs() the legacy strings are substituted with strtr instead of vsprintf, so it makes little sense to apply a PassVsprintf constraint to them.
Unfortunately, the way TranslateCore checks which type of string it is is to... Just do the vsprintf regex and see if it's a match.
So if we want to avoid applying a PassVsprintf constraint to legacy strings the whole thing would boil down to "If it matches, check it again. If it doesn't match, ignore"
We could change PassVsprintfValidator to check that both string types match and have different paths to check the string types, but I'm not sure what design considerations there would be there. I'm going to change #16359 to only refer to the other bug for now.
@khouloudbelguith please add 1.7.6.3 too cause of same issue :-(
Any news ?
Hi @Gipielle,
Sorry, not yet.
But PrestaShop is an open source project, so it can be solved before if someone submits a pull request to solve it.
Thanks!
Most helpful comment
(Continuing from discussion in #16421)
@khouloudbelguith After taking a closer look at this I don't think it's a 5 minute fix.
According to
TranslateCore::checkAndReplaceArgs()the legacy strings are substituted withstrtrinstead ofvsprintf, so it makes little sense to apply aPassVsprintfconstraint to them.Unfortunately, the way
TranslateCorechecks which type of string it is is to... Just do the vsprintf regex and see if it's a match.So if we want to avoid applying a
PassVsprintfconstraint to legacy strings the whole thing would boil down to "If it matches, check it again. If it doesn't match, ignore"We could change
PassVsprintfValidatorto check that both string types match and have different paths to check the string types, but I'm not sure what design considerations there would be there. I'm going to change #16359 to only refer to the other bug for now.