If the mechanism was something more along the lines of:

display name calculator: (Mapper[_], Locale, String) => Box[String] // we
could use Lift's factory mechanism here

Then you have lots of room to keep the current implementation as the default
if there is no actual name calculated.  Further, the calculation is not
based on the currently logged in user, so you could cache the results (or
not if you're in development mode).

My issue is that I like to not push functions like this towards external
files, but allow external files (and other resources) to be consulted
depending on the localization mechanism chosen for the given project.

On Mon, Mar 1, 2010 at 12:56 PM, Jeppe Nejsum Madsen <je...@ingolfs.dk>wrote:

> Jim Barrows <jim.barr...@gmail.com> writes:
>
> > My point was that you've moved the boilerplate, not eliminated it.  If
> what
> > you suggest was in place you'd have to add 100+ properties in a file.
>
> I'm not sure if we're wandering out on a philosophical tangent here, but
> would genuinely like to hear if you have better solutions:
>
> Given that I have say 100 fields and need it translated to say 5
> different languages.
>
> I need to have at least 500 words stored somewhere. If I don't want to
> use a word's position in the file as key, I'll need a key per word. I
> would also like one file per language since this allows independent
> translation. So now I have 5 files each with 100 lines containing two
> words.
>
> But AFAIKS, there's no repetition (except for the keys, which I think
> are unavoidable), so no boilerplate.
>
> Now I have to add the 100 overrides to actually look up the translated
> names. This is the only place I see boilerplate, and it could be easily
> removed :-)
>
> I agree 100% that if you don't need translation, properties are often
> the wrong approach, but when you do need it I've yet to see a better
> alternative (but would love to hear about it!)
>
> /Jeppe
>
> --
> You received this message because you are subscribed to the Google Groups
> "Lift" group.
> To post to this group, send email to lift...@googlegroups.com.
> To unsubscribe from this group, send email to
> liftweb+unsubscr...@googlegroups.com<liftweb%2bunsubscr...@googlegroups.com>
> .
> For more options, visit this group at
> http://groups.google.com/group/liftweb?hl=en.
>
>


-- 
Lift, the simply functional web framework http://liftweb.net
Beginning Scala http://www.apress.com/book/view/1430219890
Follow me: http://twitter.com/dpp
Surf the harmonics

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

Reply via email to