?
=?ISO-8859-1?Q?Phil_H=FChn?=
Hi, I'm starting a new project which needs to support i18n.
I also have the situation where a user needs the ability to change the
text on some buttons, graphics on others, etc. It occured to me that
this is a great use for a resource bundle (RB). I.e if a particular
resource is in the users RB, that gets used, otherwise we fall back to
the default.
This is ok if we treat the users RB as if it belongs with a special
'locale' for that user, and if a particular setting isn't found then
fall back to the setting in the default locale.
HOWEVER, what happens if our default locale is english, but we have
changed locale to german, and we have a user RB on top of that? I.e, to
get a setting:
get setting from users RB
if setting not found, get setting from german RB
if setting not found, return setting from default (english) RB.
Is it possible to cascade the resource bundles like this?
Will it work, and is this a sensible approach, or is there a better way?
It's occurred to me that I could manually (at runtime) create a new
locale("de", "DE", "MyUserLocale") and change the resource bundle to
match... similarly if they switch to french then change it to
locale("fr", "FR", "MyUserLocale"), etc, but it gets a bit messy when
there's a "fr-FR" and "fr-CA" and "fr-CH"!!
Thanks,
Phil
I also have the situation where a user needs the ability to change the
text on some buttons, graphics on others, etc. It occured to me that
this is a great use for a resource bundle (RB). I.e if a particular
resource is in the users RB, that gets used, otherwise we fall back to
the default.
This is ok if we treat the users RB as if it belongs with a special
'locale' for that user, and if a particular setting isn't found then
fall back to the setting in the default locale.
HOWEVER, what happens if our default locale is english, but we have
changed locale to german, and we have a user RB on top of that? I.e, to
get a setting:
get setting from users RB
if setting not found, get setting from german RB
if setting not found, return setting from default (english) RB.
Is it possible to cascade the resource bundles like this?
Will it work, and is this a sensible approach, or is there a better way?
It's occurred to me that I could manually (at runtime) create a new
locale("de", "DE", "MyUserLocale") and change the resource bundle to
match... similarly if they switch to french then change it to
locale("fr", "FR", "MyUserLocale"), etc, but it gets a bit messy when
there's a "fr-FR" and "fr-CA" and "fr-CH"!!
Thanks,
Phil