LiftRules.localizationLookupFailureNotice is not called on S.loc("xxxxxxxx")
- Dominant language
- Scala
- Stars
- 1.3k
- Forks
- 275
- PR merge metrics
- No merged PRs in 30d
Description
In reference of : http://groups.google.com/group/liftweb/browse_thread/thread/0e5f52077ef15395/a31dacb5110656cc#a31dacb5110656cc
> Hello,
>
> So if I overload LiftRules.localizationLookupFailureNotice to log notices
> to error log then errors are generated on S.??("xxxxxxxx") but not on
> S.loc("xxxxxxxx") or Not Found.
> Can we improve lift localization to avoid this?
>
> Lift version : 2.4
At looks like S.loc logs for each resourceBundle that is tried and no
key found. If there are no resourceBundles, no logging occurs.
This does seem a bit odd an in contrast to S.? that only logs once for
the key even if there are multiple bundles.
I'm looking at some other stuff with resources so please open a ticket
and assign it to me (on GitHub)
/Jeppe
S.loc code:
def loc(str: String): Box[NodeSeq] =
resourceBundles.flatMap(r => tryo(r.getObject(str) match {
case null => LiftRules.localizationLookupFailureNotice.foreach(_(str, locale)); Empty
case s: String => Full(LiftRules.localizeStringToXml(s))
case g: Group => Full(g)
case e: Elem => Full(e)
case n: Node => Full(n)
case ns: NodeSeq => Full(ns)
case x => Full(Text(x.toString))
}).flatMap(s => s)).find(e => true)
S.?! code:
private def ?!(str: String, resBundle: List[ResourceBundle]): String = resBundle.flatMap(r => tryo(r.getObject(str) match {
case s: String => Full(s)
case n: Node => Full(n.text)
case ns: NodeSeq => Full(ns.text)
case _ => Empty
}).flatMap(s => s)).find(s => true) getOrElse {
LiftRules.localizationLookupFailureNotice.foreach(_(str, locale));
str
}
Contributor guide
Assessment
This issue has not been assessed yet.