Repository navigation
Conversation
| db_d_append_error(_("SQL parser error (%s) in statement:\n%s\n"), | ||
| st->errmsg, sql); |
There was a problem hiding this comment.
Is there a usual way to allow reordering placeholders like in python? It needs to be possible to compile with all our platforms.
There was a problem hiding this comment.
POSIX positional arguments (%1$s) are the usual gettext way, but I have not confirmed they work on all our platforms. The Windows CRT printf does not support them, and I have not checked whether libintl covers it for our MinGW/MSVC builds. There is no use of %N$ anywhere in the tree to rely on. For this message the order is not a practical problem, since the error text is in parentheses and the statement is on its own line. If you prefer, I can split it into two complete messages instead.
There was a problem hiding this comment.
How should it be checked on windows?
There was a problem hiding this comment.
I could not test it here, as I had no Windows compiler available. A direct check is a small C program built with each toolchain we ship (MSYS2/MinGW and MSVC via OSGeo4W) that calls snprintf(buf, sizeof buf, "%2$s %1$s", "a", "b"), run from the existing Windows CI. Also relevant is the vsnprintf in G_vasprintf() (lib/gis/asprintf.c), which is what G_message() and G_fatal_error() use. Until that is confirmed, I would avoid positional placeholders and restructure the strings so the order does not matter.
There was a problem hiding this comment.
I split it in 5cdf757 so this no longer depends on positional placeholders: SQL parser error: %s and Statement: %s are now two complete messages, each with a single placeholder.
89a6fb3 to
b0edf13
Compare
|
This PR is now C-only. The Python and wxGUI changes moved to #724. The commits were rebuilt (one per tool), so earlier commit hashes in the replies above no longer exist; |
731702f to
f1da28e
Compare
Join the 'Illegal reclass rule' and 'invalid reclass rule' messages instead of translating their pieces separately.
The msgids were built with a preprocessor macro inside _(), so xgettext extracted a fragment and the runtime msgid never matched a catalog entry. Write the format with PRIu64, as done for other 64-bit values in translated strings, so the msgid is the same whatever the type of the count. Report the final counts in separate messages, each with a single placeholder, instead of one message built with snprintf().
The direction was a separately translated word substituted into the sentence, which cannot agree in gender or case in all languages.
The error was split over two warnings and a fatal error, so the sentence was translated in pieces. Use complete sentences with a single placeholder each, so that no positional placeholders are needed.
The message was joined from separately translated fragments. Use two complete messages with one placeholder each.
The format string '%15s%15s%15s' was translated, which splits a table header over three untranslatable arguments. Translate each column header instead.
Leading whitespace in a msgid is easy to lose or misplace in translations.
Fix 'where' for 'were' and the capitalized 'Your'.
f1da28e to
0a48f5a
Compare
Description
Fix C source strings flagged by comments on Weblate: messages built from separately translated fragments or with a substituted word, which translators cannot adapt, plus a few typos and an inconsistent term.
r.in.pdal: the point count messages used_(GPOINT_COUNT_FORMAT " points ...").xgettextextracted a fragment, and the msgid at runtime (%llu points ...) matched no catalog entry, so they were never translated. They now usePRIu64, so the msgid is the same whatever the type of the count, and the final message is split into sentences with one placeholder each.r.reclass,r.horizon,v.rectify,db.dbf: no more strings translated in pieces or with a substituted word.v.class: translate the column headers instead of the%15s%15s%15sformat string, with translator comments.lib/gis/view.c: remove leading spaces in the window overlap warnings.v.in.ogr,v.profile: fix typos.Positional placeholders (
%1$s) are not used. With plainsnprintf/vsnprintfthey are not interpreted on MSVC (the output is$s $s), so messages that would need reordering are split into sentences with one placeholder each. They do work on MinGW.Motivation and context
Translators cannot reorder or adapt text that is split across several
_()calls or filled with a substituted word, and some strings were never translated at all (r.in.pdal).How has this been tested?
Built by CI on Linux, macOS, MinGW and MSVC. Positional placeholder support was checked with a small C program on MSVC and MinGW64 (MSYS2), with and without libintl.
For the
PRIu64messages:xgettextwith the options oflocale/Makefileextracts%<PRIu64> points found in region.; aftermsgfmtand a French catalog, a program usingunsigned long longandunsigned longcounts printed the translated message with the number substituted in both cases.Types of changes
functionality to not work as before)
Checklist
pre-defined prefixes
of this project.
AI assistance (Claude) was used to find the affected strings from the Weblate comments and to draft these changes.