wildcard lang and country if variant specified?
Hi,
I use Locale's in my app which can be like "en_US_0000001" where the variant is a licenseId for my client. Depending on this licenseId I want to set client specific localisation. But I would like the properties file to have something like
labels_*_*_0000001.properties
so that when a licenseId is specified, it will overrule the lang and country. I know it doesn't work with the "*"s. but is there any other way to achieve this?
Thank you,
Joost
# 1
> labels_*_*_0000001.properties
>
> so that when a licenseId is specified, it will
> overrule the lang and country. I know it doesn't work
> with the "*"s. but is there any other way to achieve
> this?
Not sure but have you tried using the license ID as part of the package name?like com.foo.0000001.labels_en_US.properties and com.foo.0000001.labels_zh_CN.properties etc....
Gary
# 2
Dear Gary,
No I have not, but I don't think I want that as the license may only specify one or two terms where the entire default properties file contains thousands. We wish to give our clients the option to for example rename a "User" to an "Employee" or "Administrator" to "Accountant", but don't want the underlying default fallback to fall away, which would happen when you add the license to the package right?
Do you know any other way to achieve thsi behaviour?
Thank you,
Joost
# 3
See ResourceBundle.Control for Java 1.6.I you need a solution for pre 1.6 you will need to provide your own mechanism to look-up for bundles. I used this approach for application branding, but should work with your use case.