Project

General

Profile

Feature #1687

GetText code inspection

Added by Serg Dvoriancev about 9 years ago. Updated almost 7 years ago.

Status:
Resolved
Priority:
Low
Assignee:
-
Category:
-
Target version:
-
Start date:
07/15/2011
Due date:
% Done:

0%

Estimated time:

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

History

#1 Updated by Ermal Luçi about 9 years ago

Can you please point to such locations?

#2 Updated by Serg Dvoriancev about 9 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

#3 Updated by Serg Dvoriancev about 9 years ago

<td colspan="2" class="listtopic">< ? php printf (gettext("Last $nentries PPP log entries"),$nentries); ? ></td>

#4 Updated by Vinícius Coque about 9 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.

#5 Updated by Chris Buechler almost 7 years ago

  • Status changed from New to Resolved

Also available in: Atom PDF