liangzai-cool / hamcrest

Automatically exported from code.google.com/p/hamcrest
0 stars 0 forks source link

Support i18n'ed error messages #80

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
I dont know if its so important for hamcrest's own design to give its
user's error messages translated in their own language instead of in english.
In some countries, like brazil, simple i18n'ed messages might break a
strong barrier which is the language one.

In our specific case (www.github.com/caelum/vraptor) we are using hamcrest
to provide validation messages, therefore i18ning messages is vital to our
process.

You find attached a patch to hamcrest wich allows users to recieve i18n
messages.

This is the most non-intrusive way i tought about implementing i18n
messages within hamcrest without breaking any backward compatibility.

Original issue reported on code.google.com by guilherm...@gmail.com on 10 May 2009 at 10:52

Attachments:

GoogleCodeExporter commented 9 years ago
i.e.: Calendar, is(equatTo(Calendar)) --> works fine
      SimpleDateFormat.format(calendar.time),
is(equalTo(SimpleDateFormat(calendar.time)) --> humm, Resource not found 
exception

the way the patch was implemented, all compared strings should be i18ned 
because the
ResourceBundle will complain about not finding the key... if the patch is 
useful, the
ResourceBundleDescription should write the key itself if its value is not found 
in
the bundle... its just a try/catch block within the appendText method.
(the containsKey method was only implemented in java 1.6)

Original comment by guilherm...@gmail.com on 11 May 2009 at 12:07

GoogleCodeExporter commented 9 years ago

Original comment by t.denley on 12 May 2012 at 10:57