Last modified: 2010-09-15 08:44:00 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T26064, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 24064 - Translate extension should warn translators about common printf formatting errors
Translate extension should warn translators about common printf formatting er...
Status: RESOLVED FIXED
Product: MediaWiki extensions
Classification: Unclassified
Translate (Other open bugs)
unspecified
All All
: Normal enhancement (vote)
: ---
Assigned To: Niklas Laxström
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2010-06-21 15:47 UTC by Brion Vibber
Modified: 2010-09-15 08:44 UTC (History)
1 user (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Brion Vibber 2010-06-21 15:47:50 UTC
It's not uncommon for translators to accidentally drop some printf-style formatting characters from strings, particularly things like ordered parameters:

en "1$s's status on 2$s"

ja "%2$s における %1$ のステータス"

Here, the 's' string specifier got dropped by mistake. This should be fairly easy to detect: make sure we have the same number of params and that we're not missing any explicitly-numbered ones. We could highlight the suspicious parts and prompt the translator to correct it or accept anyway.

Since this particular check is applicable only to programs using printf-style formatting from their strings, it could perhaps be applied only when using gettext (which usually is paired with lots of sprintf fun)
Comment 1 Niklas Laxström 2010-09-11 16:28:27 UTC
I'm not familiar with positional formatting characters. What is the meaning of each letter in %2$s for example? Can there be something else in their place or in addition to?
Comment 2 Siebrand Mazeland 2010-09-12 07:57:58 UTC
%2%s is the second parameter for a message; it's similar to $2 in MediaWiki messages. %2$s can be replaced by %s only. There's also %[n$]d for integers. Basically the gettext products need a Checker for this parameter type.

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links