Escaping C format string for percentage sign
A lightweight file manager for X
Brought to you by:
baudinr
Hello,
I have just finished translating XFE to Turkish. When I was checking my translation for any error with
/usr/bin/msgfmt -c --statistics tr.po
I got this error:
tr.po:6887: 'msgstr' is not a valid C format string, unlike 'msgid'. Reason: In the directive number 1, the character 'y' is not a valid conversion specifier
The problematic line is this:
" * Resmi 100% yakınlaştır - Ctrl-I\n"
The percentage sign in the translated string is perceived as a C format string. The original string is this:
#: src/help.h:8
#, c-format
msgid ""
...
" * Zoom image to 100% - Ctrl-I\n"
...
The original string is not treated as a C string. Curiously enough, there are 4 other similar strings which are not treated as a C string.
#: src/Preferences.cpp:1720
msgid "Zoom image to 100%"
msgstr "Resmi 100% yakınlaştır"
#: src/XFileImage.cpp:843
msgid "Zoom 100%"
msgstr "100% Yakınlaştır"
#: src/XFileImage.cpp:843 src/XFileImage.cpp:934
msgid "Zoom image to 100%."
msgstr "Resmi 100% yakınlaştır."
#: src/XFileImage.cpp:934
msgid "Zoo&m 100%"
msgstr "100% Yakı&nlaştır"
If I escape the problematic line with a double percentage sign — %% — then gettext complains about mismatched number of format specifications:
tr.po:6887: number of format specifications in 'msgid' and 'msgstr' does not match
The only solution that I can think of is escaping the percentage sign both in the original and translated strings.