I think this is a reasonable addition, but I would use

def ?(key : String, defaultKey : String) = ...

That way changing the default text just doesn't require changes to code.

Derek

On Fri, Mar 6, 2009 at 6:29 AM, Tim Perrett <[email protected]> wrote:

>
> Guys,
>
> I have a situation where I want to localize a bunch of dynamic texts,
> however the current behavior of S.? is to return the input text if its
> found in a resource bundle. Whilst I see the rational for this, I have
> another situation where I want to pass a key, and if it doesn't find
> it, display something else (the english version). Id rather not use
> the english text as the translation key, as if the english text
> changes, my database translations will break (not good!)
>
> I can achieve the functionality needed right by doing something like:
>
>        S.loc(item.localization_key.toString + ".name") match {
>          case Full(t) => t
>          case _ => Text(doc.name.toString)
>        }
>
> But it would be nice if we could have a utility method in S which
> allowed you do do:
>
> ?("my.localization.key", defaultText.toString)
>
> 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