Project

General

Profile

Actions

Feature #1687

closed

GetText code inspection

Added by Serg Dvoriancev almost 13 years ago. Updated over 10 years ago.

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

0%

Estimated time:
Plus Target Version:
Release Notes:

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

Actions #1

Updated by Ermal Luçi almost 13 years ago

Can you please point to such locations?

Actions #2

Updated by Serg Dvoriancev almost 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

Actions #3

Updated by Serg Dvoriancev almost 13 years ago

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

Actions #4

Updated by Vinícius Coque almost 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.

Actions #5

Updated by Chris Buechler over 10 years ago

  • Status changed from New to Resolved
Actions

Also available in: Atom PDF