[web-devel] [Yesod] rendering different templates for different languages

Michael Snoyman michael at snoyman.com
Thu Feb 24 07:07:04 CET 2011


On Thu, Feb 24, 2011 at 1:40 AM, "Timo B. Hübel" <t.h at gmx.info> wrote:
> Hi,
>
>> [...]
>> In general, it's very uncommon that you need a completely separate set
>> of templates for each language. Your markup, classes, styles, and
>> logic will likely be identical for each language, and creating a
>> separate template for each will just result in a lot of pain in the
>> long run. Instead, you're likely better off having a single template
>> and just translating strings.
>
> well, from my experience in web-programming it's rather common that you
> want both. Of course, the above is true for most of the "functional" or
> "interactive" parts of the application. But quite often you also have a
> whole bunch of pages with mainly static text content, help pages for
> example. In these pages one wants the overall template functionality
> like including the general page layout and navigation and stuff like
> that, but you want to be able write rather large blocks of texts
> (together with some basic markup, like <p> and friends) as a whole
> I18n-ified template.
>
> Just my 2 cents,
> Timo
>

It could be that this is an important case to take into consideration,
but I think that the approach that Max recommended to Dmitry is
probably about as much as Yesod needs to provide. Serving two
different versions of a template depending on the language is a
relatively simple problem, compared with all of the normal i18n issues
that crop up. If people are not satisfied with the recommendation Max
gave and would like to see something else added to Yesod, let me know.
Otherwise, I'd consider the approach outlined above as a Yesod "best
practice."

Michael



More information about the web-devel mailing list