Here's my idea, it checks in this order: ExampleUiLabels_ru.xml ExampleUiLabels_ru.properties ExampleUiLabels_ru ExampleUiLabels.xml (for ru locale) ExampleUiLabels_en.xml ExampleUiLabels_en.properties ExampleUiLabels_en ExampleUiLabels.xml (for en locale) ExampleUiLabels.xml (for blank locale) ExampleUiLabels.properties ExampleUiLabels ExampleUiLabels.xml (for blank locale again lol, that can be fixed)
I also added a static Set xmlPropertiesNotFound, so that we don't keep checking the same xml url for the same locale Don't worry, I won't be offended if you don't like it :-) Regards Scott Index: framework/base/src/base/org/ofbiz/base/util/UtilProperties.java =================================================================== --- framework/base/src/base/org/ofbiz/base/util/UtilProperties.java (revision 608288) +++ framework/base/src/base/org/ofbiz/base/util/UtilProperties.java (working copy) @@ -697,6 +697,11 @@ if (url != null) { return url; } + // Lastly check in ${resource}.xml (ie. ExampleUiLabels.xml) because it can hold multiple locales + url = FlexibleLocation.resolveLocation(resource + ".xml"); + if (url != null) { + return url; + } } catch (Exception e) { Debug.logInfo("Properties resolver: invalid URL - " + e.getMessage(), module); } @@ -867,10 +872,16 @@ public ExtendedProperties(Properties defaults) { super(defaults); } + protected static Set<String> xmlPropertiesNotFound = FastSet.newInstance(); public ExtendedProperties(URL url, Locale locale) throws IOException, InvalidPropertiesFormatException { InputStream in = new BufferedInputStream(url.openStream()); if (url.getFile().endsWith(".xml")) { - xmlToProperties(in, locale, this); + if (xmlPropertiesNotFound.contains(url.toString() + locale.toString())) { + xmlToProperties(in, locale, this); + if (UtilValidate.isEmpty(this)) { + xmlPropertiesNotFound.add(url.toString() + locale.toString()); + } + } } else { load(in); } On 03/01/2008, Adrian Crum <[EMAIL PROTECTED]> wrote: > > I was thinking about it too. Maybe around line 479 we could have something > like "if bundle is null > and resource name doesn't contain '.xml', append '.xml' to resource name > and call > UtilResourceBundle.getBundle(...) again." > > -Adrian > > Scott Gray wrote: > > > I had an idea on that, I'll put it down in code and see if it looks any > > good. I'll send a patch here if works out. > > > > Regards > > Scott > > > > On 03/01/2008, Adrian Crum <[EMAIL PROTECTED]> wrote: > > > >>Scott Gray wrote: > >> > >>>Ok got it (finally) thanks for persevering , perhaps we'll need to > >> > >>detail > >> > >>>this in a readme in the config folders otherwise we'll get endless > >> > >>questions > >> > >>>on the user list. I'll take care of when I get a chance. > >>> > >>>Regards > >>>Scott > >> > >>Well, I'd still like to see the process change so it's less confusing. > The > >>only component being > >>affected right now is the Example component. Maybe we can come up with a > >>better resolver strategy > >>before the custom xml format is more widely adopted. > >> > >>In other words, the behavior you expected at the start should work. We > >>just have to figure out how > >>to make it work that way. > >> > >>-Adrian > >> > >> > >> > >> > > > > > >