Feature #1687
closedGetText code inspection
0%
Description
In some cases, you can find such code:
$myname = 'NameName';
$myvar = 'abcd123';
$mytext = gettext("This is {$myname} have value {$myvar1}");
The gettext never translate this text. The variables change keyString each time.
Probably best way use sprintf
$mytext = sprintf(gettext("This is $s have value $s"), $myname, $myvsr1);
In this case GetText keyString is constant and can be translated.
PS Construction as
$mytext = gettext("This is ") . $myname . gettext("have value ") . $myvar1;
less effective because a short key string can cause a conflict of meaning translation in different places of project
Updated by Serg Dvoriancev over 13 years ago
ver 2.0
Quickly i able to find it here
/diag_logs_ppp.php [91]
<td colspan="2" class="listtopic"></td>
And i try to remember a few more seats
Updated by Serg Dvoriancev over 13 years ago
<td colspan="2" class="listtopic">< ? php printf (gettext("Last $nentries PPP log entries"),$nentries); ? ></td>
Updated by Vinícius Coque over 13 years ago
We are reviewing the gettext code, strings with incorrect use of printf are already fixed. Soon they will be merged into the pfSense master branch.