Java - Setting ResourceBundle Values at Runtime

43 Views Asked by At

I have an application that is handed some xml, part of which looks like this:

<resource name='Do this thing">
  <attribute name="name" type="string" xml:Lang="ar" value="Do that thing in ar"/>
  <attribute name="name" type="string" xml:Lang="fr" value="Do that thing in fr"/>
  <attribute name="name" type="string" xml:Lang="fr-CA" value="Do that thing in fr-    CA"/>
</resource>

Though of course there are 25 languages instead of three. We then use this xml to build a dialog we present to our users which contains the translated version of 'Do this thing.' I thought that this would be as straight forward as parsing the xml and building a ResourceBundle and then using that to get the translation based on current Locale. But it looks like it's not possible to set the ResourceBundle contents at runtime. Or at least I can't figure out how to do it. Am I missing something or can someone suggest an alternative besides just comparing the langauge / country codes myself?

Thanks!

0

There are 0 best solutions below