Skip to main content
Topic: $txt['package_will_fail_warning'] (Read 1195 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

$txt['package_will_fail_warning']

As reported here by @Chainy, the string $txt['package_will_fail_warning'] is "terrible" when it comes to translation.

The string is:
Quote
$txt['package_will_fail_warning'] = 'At least one error was encountered during a test %1$s of this package.<br />It is <strong>strongly</strong> recommended that you do not continue with %1$s unless you know what you are doing, and have made a backup very recently.<br /><br />This error may be caused by a conflict between the package you\'re trying to install and another package you have already installed, an error in the package, a package which requires another package that you have not installed yet, or a package designed for another version of the software.';
the %1$s may be $txt['package_install'], or $txt['package_uninstall'].

The two replacements may have to be translated differently, but the replacement at the moment is just one.
Option one would be to use two replacements %1$s and %2$s replaced with two different $txt like: $txt['package_install_1'], $txt['package_uninstall_1'] and $txt['package_install_2'] and $txt['package_uninstall_2'].
This is a solution, but is kind of inelegant to me.

Soooo... was thinking about a possible alternative:
Quote
$txt['package_will_fail_warning'] = 'At least one error was encountered during a test {installation|uninstallation} of this package.<br />It is <strong>strongly</strong> recommended that you do not continue with {installation|uninstallation} unless you know what you are doing...[/nobbc]
so, the two strings would be already contained into the actual string and should be easier to translate (you see directly what you have to translate and what are the possible alternatives and you can adapt the translation) and much more flexible.

The code that would "pick" the correct choice could look like:
Code: [Select]
[...]
preg_replace('~\{([^|]*)\|([^}]*)\}~', $context['uninstalling'] ? '$2' : '$1', $txt['package_will_fail_warning'])
[...]

What would mean in terms of translating?
It would mean that the {|} remain, while the words inside are translated.
For example, in Italian that sentence would look something like:
Quote
$txt['package_will_fail_warning'] = 'E\' stato individuato almeno un error durante il test di [b]{installazione|disinstallazione}[/b] di questo pacchetto.[nobbc]<br />E\' <strong>caldamente</strong> consigliato di non continuare con {l\'installazione|la disinstallazione} a meno che si sappia cosa si sta facendo...[/nobbc]
or even:
Quote
$txt['package_will_fail_warning'] = 'E\' stato individuato almeno un error durante il test di [b]{installazione|disinstallazione}[/b] di questo pacchetto.[nobbc]<br />E\' <strong>caldamente</strong> consigliato di non continuare con la procedura a meno che si sappia cosa si sta facendo...[/nobbc]
So complete flexibility on how the string is translated.

Now, my opinion is biased (for me now that solution is the best thing after sliced bread), so it would be interesting have opinions from people that do translations.
What do you think?
Improvement?
Regression?
Do you prefer change the string?
Take in consideration this is an example and TBH I'm starting thinking that change the string would be the best option, tough this solution may help in several other places.
Bugs creator.
Features destroyer.
Template killer.

Re: $txt['package_will_fail_warning']

Reply #1
Looks good! It is easier for us if we know exactly what's the meaning of a description and we have the most possible flexibility at our work. As you know the different languages have often their specialities.  ;)

Thank you for thinking about making the lives of your translators easier. Thanks!  :)

Re: $txt['package_will_fail_warning']

Reply #2
I seem to remember I received some negative feedback about that one on the basis that reading the string may be difficult (for the kind of syntax involved) and may lead to errors.

While reading it again, I guess it should *at least* use a more common syntax (at least common in the rest of the world) consisting of pairs of brackets like:
Code: [Select]
text {{version 1 | version 2}} other text

It's still open for discussion, if we can find a good way to handle the text, it could go into 1.1 or future versions.
Bugs creator.
Features destroyer.
Template killer.