<i18n dev> ResourceBundleControlProvider replacement for java 9?

Naoto Sato naoto.sato at oracle.com
Thu Jan 11 00:39:56 UTC 2018


Hi Romain,

The idea of ResourceBundleControlProvider that silently intercepts 
getBundle of every application on the system is not well fit with the 
module system, especially in terms of resource encapsulation. That's one 
of the reasons behind the decision to disable ResourceBundle.Control in 
named modules. It still works fine with unnamed modules so it's not a 
regression per se.

As you noted below, ResourceBundleProvider serves as the migration path 
for applications that control the loading of resource bundles in named 
modules. I'd suggest trying to migrate your application using the 
interface. Although you need to implement this new interface, the 
contents of your existing resource bundles shouldn't be affected by this 
migration. Mandy has updated the javadoc (not in jdk10, but in the 
current jdk repository) with this issue:

http://cr.openjdk.java.net/~mchung/jdk11/webrevs/8193767/

I hope that would be useful.

Naoto

On 1/10/18 12:48 AM, Romain Manni-Bucau wrote:
> Hi guys,
> 
> Opened https://bugs.java.com/bugdatabase/view_bug.do?bug_id=JDK-8193680 and
> it got closed - not fully sure what was missing - but I got the
> recommandation to contact that list on that topic.
> 
> The issue is simple: java 8 introduced ResourceBundleControlProvider which
> is really nice and allows to replace the resource bundle lookup for all the
> app transparently. Concretely in my case I get the translations from a rest
> service in one case or - as a fallback - from a specific folder on the
> filesystem. You will note that both are outside the application.
> 
> I didn't find a way to migrate my application to named modules because
> there is no replacement for that feature in java 9 if you are outside
> unamed modules. The ResourceBundleProvider was looking like a good
> candidate but is too impacting and requires to modify the bundle itself.
> 
> Any way to avoid functional regressions and migrate to java 9 named modules?
> 
> Thanks,
> Romain Manni-Bucau
> @rmannibucau <https://twitter.com/rmannibucau> |  Blog
> <https://rmannibucau.metawerx.net/> | Old Blog
> <http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
> LinkedIn <https://www.linkedin.com/in/rmannibucau>
> 


More information about the i18n-dev mailing list