#1336 Please only use named parameters in translatable strings
Closed: Fixed None Opened 7 years ago by jfenal.

Hi all,

Latest example from tonight's push to transifex :

"No such %s named %s, skipping⏎"

What happens if a particular language needs to reverse order from %s to %s... ?

Please use solely named parameters.


Details from transifex:

String ID: No such %s named %s, skipping
Description: None
Comment:
Occurrences: src/tools/sss_cache.c:172

Could you point me to a reference on how to do named parameters in C? I am aware of the process for Python, but I do not know how to do so in C. I'll happily correct our strings.

description: Hi all,

Latest example from tonight's push to transifex :

"No such %s named %s, skipping⏎"

What happens if a particular language needs to reverse order from %s to %s... ?

Please use solely named parameters. => Hi all,

Latest example from tonight's push to transifex :
{{{
"No such %s named %s, skipping⏎"
}}}
What happens if a particular language needs to reverse order from %s to %s... ?

Please use solely named parameters.

Fields changed

rhbz: => 0

Found this in printf(3):

The arguments must correspond properly (after type promotion) with the conversion specifier.
By default, the arguments are used in the order given, where each '*' and each conversion
specifier asks for the next argument (and it is an error if insufficiently many arguments
are given). One can also specify explicitly which argument is taken, at each place where an
argument is required, by writing "%m$" instead of '%' and "*m$" instead of '*', where the
decimal integer m denotes the position in the argument list of the desired argument, indexed
starting from 1. Thus,

    printf("%*d", width, num);

and

    printf("%2$*1$d", width, num);

are equivalent. The second style allows repeated references to the same argument. The C99
standard does not include the style using '$', which comes from the Single UNIX
Specification. If the style using '$' is used, it must be used throughout for all
conversions taking an argument and all width and precision arguments, but it may be mixed
with "%%" formats which do not consume an argument. There may be no gaps in the numbers of
arguments specified using '$'; for example, if arguments 1 and 3 are specified, argument 2
must also be specified somewhere in the format string.

Fields changed

component: SSSD => Documentation
milestone: NEEDS_TRIAGE => SSSD 1.9.0 beta 2
owner: somebody => sgallagh
patch: 0 => 1
status: new => assigned

Fields changed

priority: major => trivial

Fixed by:
- 95cc957

resolution: => fixed
status: assigned => closed

Metadata Update from @jfenal:
- Issue assigned to sgallagh
- Issue set to the milestone: SSSD 1.9.0 beta 2

2 years ago

Login to comment on this ticket.

Metadata