Veerappan Saravanan wrote:
> 
> 1. change the resource bundle entry to
> ERROR_101=ERROR_101:some error in the system
> but, this is erorr prone, since developers could always enter the wrong id
> in the message.
> 
Veerappan,

I use that very method on my projects.  I don't find it error prone. 
The two "ERROR_101" strings are right next to each other.  It's pretty
easy to eyeball.

If, nevertheless, you feel it's a problem, consider running the
following AWK script on your message file.

======= messageCheck.awk =============
BEGIN { FS = "[=:]" }
/.+=.+:.+/ { if ($1 != $2) print "Whoa, better check ", $1 }
======= messageCheck.awk =============

The first line tells awk to use either '=' or ':' as field separators. 
The second line says (in English) "If the line has (some stuff)=(other
stuff):(more stuff), then print a message if (some stuff) is different
than (other stuff)."

With the following input file

======= msgid.txt =========
# This is just a comment.

ERROR_101=ERROR_101:this is message 101
ERROR_102=ERROR_102:this is message 102
ERROR_103=ERROR_103:this message has a = and a : inside it.
ERROR_104=ERROR_101:Cut and paste gone bad.
ERROR_105=ERROR_105:This is message 105
INFO_108=This message does not repeat its message id.
======= msgid.txt ==========

Then you get the following result:

$ awk -f messageCheck.awk msgid.txt
Whoa, better check ERROR_104
$

I suppose this would be a problem if you didn't have AWK. :(

- Paul

-- 
Beware of bugs in the above code.  I have
only proved it correct, not tried it.
-Don Knuth

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to