wiki:MessageStandardization

Version 10 (modified by martinl, 15 years ago) ( diff )

macros

In progress, see http://grass.osgeo.org/wiki/Development_Specs

Message Standardization

How should Errors/Warnings/Messages be formatted

  • Only user derived variables should be bracketed, not GRASS derived variables, for example:
     Yes: Creating raster map <%s>.  Pass 1 of 7 ...
     No:  Creating <raster> map <%s>.  Pass [1] of [7] ...
    
  • strings < > - raster, vector maps, group names, etc., e.g.
    • Raster map <%s> not found
  • strings ' ' - paths, SQL queries, etc., e.g.
    • File '%s' not found
    • Unable to create table: '%s'

Discussion

  • The [bracketed] parenthetical disrupts the flow of the phrase and doesn't help enhance clarity of meaning. IMHO, this reads better without [] brackets: "Line %d deleted." [] Brackets should be used when value is outside of the phrase: "Unknown line [%d]". --HB

Statistics

symbol number of code lines (2007-04-11) 2008-02-14 (6.3svn) 2009-08-02 (7.0svn)
<%s> 637 1406 1935
[%s] 690 427 222
'%s' 354 370 537
<%d> 12 7 11
[%d] 207 13 137
'%d' 3 1 1
TYPES="<%s> \[%s\] '%s' <%d> \[%d\] '%d'"

for TYPE in $TYPES ; do
  NUM_HITS=`grep -rI "$TYPE" * | grep -v '/.svn/\|^dist.i686-\|locale/po/' | wc -l`
  echo "$TYPE  $NUM_HITS"
done

Macros to be defined for C library

  • MSG_RASTER_NOT_FOUND_IN_MAPSET - "Raster map <%s> not found in <%s>"
  • MSG_CANNOT_OPEN_RASTER - "Unable to open raster map <%s>"
  • MSG_CANNOT_OPEN_FILE - Unable to open file <%s>

Note: Problem with xgettext package. How to use macros to work with xgettext?

Note: See TracWiki for help on using the wiki.