Skip to content

Instantly share code, notes, and snippets.

@altamic
Created June 10, 2010 12:10
Show Gist options
  • Save altamic/432895 to your computer and use it in GitHub Desktop.
Save altamic/432895 to your computer and use it in GitHub Desktop.
# java resource bundles initializer
if defined?(JRUBY_VERSION)
# include config directory in the class path
$CLASSPATH << "file:///#{File.expand_path(File.join(RAILS_ROOT, 'config'))}/"
# because ResourceBundle.getBundle doesn't seem to use the JRuby class loader,
# we need to pass it explicitly.
def load_resource_bundle(basename, lang = java.util.Locale::ENGLISH)
java.util.ResourceBundle::getBundle(basename, lang, JRuby.runtime.jruby_class_loader)
end
JAVA_RESOURCE_BUNDLE = load_resource_bundle('resource')
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment