Guys,

Me and Derek have just been chatting over IM debating the whole
resource bundle loading mech in Lift. As you know, im working on this
database localization stuff right now as I need it for work.

Right now, were loading bundles using the normal
ResourceBundle.getBundle methods from Java. Whilst this is good for
most applications, when you need flexibility to do more compelx
localization, it falls down a bit.

Id like to propose adding a configurable "bundle factory" to
LiftRules, so that we provide a localization hook. Something like:

// LiftRules.scala
type ResourceBundleFactoryPF = (String,Locale) => Box[ResourceBundle]
var resourceBundleFactories : RulesSeq[ResourceBundleFactory]

Then, in S.scala where we load the bundles, rather than having openOr
Nil, it could fall through to the custom loaders like so:

case Nil => _resBundle.set(LiftRules.resourceNames.flatMap(name =>
tryo {
  List(ResourceBundle.getBundle(name, locale))
} openOr {
  // load bundle factories, do something
  // here to load them (not sure what yet!)
  LiftRules.resourceBundleFactories
}))

Then in Boot.scala you could do:

LiftRules.resourceBundleFactories.prepend {
  case (basename, locale) => DBResourceBundle(basename, locale)
}

Thoughts?

Cheers

Tim



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to