Last active
December 2, 2015 04:07
-
-
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)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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