Ivan Shmakov wrote: > There's no need to use sprintf () along with G_warning (), since > the latter is already capable of the printf ()-style formatting. > > Also, the following are /not/ equivalent fragments of code: > > G_warning (FMT, <arguments...>); > > sprintf (s, FMT, <arguments...>); > G_warning (s); > > Instead, the former is equivalent to the following: > > sprintf (s, FMT, <arguments...>); > G_warning ("%s", s); > > While the latter behaves differently should any percent signs > (`%') be put into `s' as a result of sprintf (). > > Hopefully, the following patch will resolve the issue.
The above is an artifact of printf-style formatting having been retrofitted to G_warning() etc. Unsurprisingly, no-one went to the trouble of fixing every single usage at that time ;) > * the code like the following could bring all the sorts of woe > upon the heads of unsuspecting translators (this issue may > deserve a mention on Trac.) > > --cut-- > sprintf(buf, > _("Unable to read header file for raster map <%...@%s>."), > name, mapset); > tail = buf + strlen(buf); > sprintf(tail, _(" It is a reclass of raster map <%...@%s> "), > real_name, real_mapset); > tail = buf + strlen(buf); > if (!G_find_cell(real_name, real_mapset)) > sprintf(tail, _("which is missing.")); > else > sprintf(tail, _("whose header file can't be opened.")); > G_warning ("%s", buf); > return -1; > --cut-- Please fix this, e.g.: G_warning( !G_find_cell(real_name, real_mapset) ? _("Unable to read header file for raster map <%...@%s>. It is a reclass of raster map <%...@%s> which is missing.") : _("Unable to read header file for raster map <%...@%s>. It is a reclass of raster map <%...@%s> whose header file can't be opened."), name, mapset); I don't think that mentioning it on Trac is particularly helpful, as no-one will find it unless they're specifically looking for it, in which case they probably already know. But it's worth mentioning here, and probably on the Wiki (if it isn't already): The translation macro _(...) must be applied to entire messages, not fragments. Code such as the above needs to be fixed to have the entire message as a single string before it can be internationalised. -- Glynn Clements <gl...@gclements.plus.com> _______________________________________________ grass-dev mailing list grass-dev@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/grass-dev