Opened 8 years ago

Closed 5 years ago

#11040 closed Bugs (fixed)

Boost.Locale "Messages Formatting (Translation)" documentation has critical sample code that is missing a call to "format"

Reported by: daniel347x@… Owned by: Artyom Beilis
Milestone: To Be Determined Component: locale
Version: Boost 1.57.0 Severity: Problem
Keywords: locale format Cc:

Description

In the "Extracting messages from code" section of the "Messages Formatting (Translation)" section of the Boost.Locale documentation (http://www.boost.org/doc/libs/1_56_0/libs/locale/doc/html/messages_formatting.html#extracting_messages_from_code) is the following sample code:

   cout << translate("Listing of catalog {1}:") % file_name << endl;
   cout << translate("Catalog {1} contains 1 file","Catalog {1} contains {2,num} files",files_no) % file_name % files_no << endl;

I think that a call to 'format' should wrap each 'translate' call, so that the correct sample code would be the following:

   cout << format(translate("Listing of catalog {1}:")) % file_name << endl;
   cout << format(translate("Catalog {1} contains 1 file","Catalog {1} contains {2,num} files",files_no)) % file_name % files_no << endl;

This bug in the documentation is especially frustrating because this is the very place people go to learn *how* to properly pass format strings to the library as a whole.

Change History (1)

comment:1 by Artyom Beilis, 5 years ago

Resolution: fixed
Status: newclosed

Already fixed

Note: See TracTickets for help on using tickets.