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

Reply via email to