package org.mg.javalib.util;

import java.text.MessageFormat;
import java.util.ResourceBundle;

public class ResourceBundleOwner
{
	private String resourceBundleName;

	private ResourceBundle bundle;

	public ResourceBundleOwner(String resourceBundleName)
	{
		this.resourceBundleName = resourceBundleName;
	}

	private ResourceBundle bundle()
	{
		if (bundle == null)
			bundle = ResourceBundle.getBundle(resourceBundleName);
		//		ResourceBundle.clearCache();
		//		bundle = ResourceBundle.getBundle(resourceBundleName);
		return bundle;
	}

	public String text(String key)
	{
		return bundle().getString(key);
	}

	public String text(String key, Object... params)
	{
		return MessageFormat.format(bundle().getString(key), params);
	}
}

@@ -161,16 +161,42 @@
 eName;%0A%0A
+%09private boolean reload;%0A%0A
 %09private
@@ -219,16 +219,16 @@
 bundle;%0A
-
 %0A%09public
@@ -278,16 +278,129 @@
 ame)%0A%09%7B%0A
+%09%09this(resourceBundleName, false);%0A%09%7D%0A%0A%09public ResourceBundleOwner(String resourceBundleName, boolean reload)%0A%09%7B%0A
 %09%09this.r
@@ -439,16 +439,40 @@
 leName;%0A
+%09%09this.reload = reload;%0A
 %09%7D%0A%0A%09pri
@@ -513,35 +513,61 @@
 if (
-bundle == null)%0A%09%09%09bundle =
+reload)%0A%09%09%7B%0A%09%09%09ResourceBundle.clearCache();%0A%09%09%09return
  Res
@@ -615,45 +615,46 @@
 ;%0A%09%09
-//%09%09ResourceBundle.clearCache();
+%7D%0A%09%09else%0A%09%09%7B%0A%09%09%09if (bundle == null)
 %0A%09%09
-//
 %09%09bu
@@ -708,16 +708,17 @@
 ame);%0A%09%09
+%09
 return b
@@ -724,16 +724,20 @@
 bundle;%0A
+%09%09%7D%0A
 %09%7D%0A%0A%09pub

add flag to reload bundle properties