M
Marco
Hi all,
I need to extract all the string constants in a package, transform
them into patterns (using java.text.MessageFormat), put the patterns
in a resource bundle and replace the strings in the code with calls to
a class that uses such a bundle. For instance this:
System.out.println ( "Process terminated " + n + " file(s)
analyzed" );
would be replaced by something like:
System.out.println ( i18n.tr ( "procTerminated" ), n );
where i18n is a class that wraps the usage of the RB and MessageFormat
(yes, names are ispired by gettext). In addition to code replacement,
a new entry would be created in the resource bundle:
procTerminated = Process terminated {0} file(s) analyzed
I don't actually need this for localization, although the result could
be used for that too. It's just to factorize all the messages in one
place and let other people review them.
Now, Eclipse has a feature that does something similar, but in
practice it works only for constants, in a case like the above it
produces two messages in the RB (!).
Does anyone know if there is some more advanced tool, which is able to
recognize the parameterization?
Thanks in advance for any help.
I need to extract all the string constants in a package, transform
them into patterns (using java.text.MessageFormat), put the patterns
in a resource bundle and replace the strings in the code with calls to
a class that uses such a bundle. For instance this:
System.out.println ( "Process terminated " + n + " file(s)
analyzed" );
would be replaced by something like:
System.out.println ( i18n.tr ( "procTerminated" ), n );
where i18n is a class that wraps the usage of the RB and MessageFormat
(yes, names are ispired by gettext). In addition to code replacement,
a new entry would be created in the resource bundle:
procTerminated = Process terminated {0} file(s) analyzed
I don't actually need this for localization, although the result could
be used for that too. It's just to factorize all the messages in one
place and let other people review them.
Now, Eclipse has a feature that does something similar, but in
practice it works only for constants, in a case like the above it
produces two messages in the RB (!).
Does anyone know if there is some more advanced tool, which is able to
recognize the parameterization?
Thanks in advance for any help.