java - Load ResourceBundle depending on context -


i have application separated in several contexts same layout each context different messages.

example on context "a":

title

label: text

example on context "b":

title b

label: text b

note "label" same on each context , context "a" default context.

i need have 1 properties files per context:

  • resources.properties (context - default)

title=title

label=label

text=text

  • resources_b.properties (context b)

title=title b

text=text b

and load property file depending on context.

the first solution found use locale this:

// context either "a", "b"... resources = resourcebundle.getbundle(config, new locale(context)); 

this way, if message not found in resources_b.properties, return 1 resources.properties expected.

what best way have "pretty" resource loading per context not using locale ?

the application in english, may change in future...

do not use locale context. can rather have locale variant like:

de_de_<variant>, e.g., de_de_a, de_de_b 

but note variant not possible without country.


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -