Skip to content

Instantly share code, notes, and snippets.

@Allan-Gong
Last active December 2, 2015 04:07
Show Gist options
  • Save Allan-Gong/45e5d8caf4fee0b6545d to your computer and use it in GitHub Desktop.
Save Allan-Gong/45e5d8caf4fee0b6545d to your computer and use it in GitHub Desktop.
Scala Lift: How to move language bundles out of the default resource folder (src/main/resource)
// Default way of loading language bundle in Scala Lift
// Relying on language bundle file(s) to be found in src/main/resources/
// LiftRules.resourceNames = List("languageBundle_en_AU")
val appConfDir = System.getProperty("appConfigDirectory")
LiftRules.resourceBundleFactories.prepend {
case (key, locale) => {
val file = new File(appConfDir)
val urls = Array(file.toURI.toURL)
val loader = new URLClassLoader(urls)
ResourceBundle.getBundle("languageBundle_en_AU", locale, loader)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment