Hi, Elaborating on your extension problem: It looks like currently only a single ResourceBundleProvider is used for all resources and locales.
How about an extension: * Multiple providers are supported * Each provider may indicate the supported locales When resolving a resource bundle for a certain locale, the I18nFilter calls all registered ResourceBundleProvider services matching the request locale for a resource bundle. The first service supplying a resource bundle wins. Services are called in service rank order. Alternatively all ResourceBundleProviders matching the request locale are called and a combined ResourceBundle of all non-null results are used. You could then register your test ResourceBundleProvider for the zz_zz locale with a higher service rank as the JcrResourceBundleProvider. WDYT ? Regards Felix Am 20.08.2012 um 13:00 schrieb Alexander Klimetschek: > Hi everyone, > > I would like to extend sling i18n with a new resource bundle that is aimed > for testing: it will handle a special "zz_zz" pseudo language (that language > code is not used) [0] that will simply automatically produce the translated > string by decorating the key. This allows to quickly discover untranslated > strings in the UI, as they will not be decorated. > > Now the sling i18n is built like this: the I18nFilter gets the locale via the > LocaleResolver, then asks a ResourceBundleProvider (reference cardinality is > 0 or 1) for a ResourceBundle for a given locale. Hence my approach would be > first to build a custom PseudoTranslationResourceBundle. > > To hook that into the I18nFilter, I would need to: > 1) provide a custom ResourceBundleProvider > 2) uses a higher service rank than the sling i18n JcrResourceBundleProvider > 3) which uses my PseudoTranslationResourceBundle for zz_zz > 4) has a multi-cardinality reference to ResourceBundleProvider > 5) tries to find the first ResourceBundleProvider that is not itself > 6) for other locales, calls this one > > Seems a bit ugly. I am not sure if at 4), I can rely on the service.ranking? > (so that I emulate what happens with the I18nFilter's reference when my > custom provider is not there). > > Or should I just provide a patch for sling i18n directly :-)? > > [0] http://timor.corp.adobe.com/mediawiki/index.php?title=Pseudo-translation > > Cheers, > Alex
