How to check positional notes of notes in format strings using msgfmt?

When using printf strings in text msgfmt --check, it is verified that the translation still contains placeholders. For example, run xgettextin the following code

printf( gettext( "string: %s, int: %d" ), str, i )

creates a file .powith msgid, marked as c-formatand whose value "string: %s, int: %d". If the translator forgets either %sor %din the translation, then he msgfmtcomplains:

the number of format specifications in 'msgid' and 'msgstr' does not match

Unfortunately, this check does not apply to format strings using positional notation, for example

boost::format( gettext( "string: %1%, int %2%" ) ) % str % i

How can I check for substitutional designations in my translations?

+4
1

, , , :

boost::format( gettext( "string: %1$s, int %2$d" ) ) % str % i;

0

Source: https://habr.com/ru/post/1673685/


All Articles