MrG
MrG

Reputation: 5287

Selections and localization with Smarty

I'm trying to implements selection lists using Smarty and I'm aware of the {html_options}. The application must support localization (which I implemented as described in this post).

Is it possible to combine the two?

I'm currently handling it by parsing through the items with {section name=i loop=$list} and "manually" generating the HTML code (handling the translation with {eval}). I don't like the solution, but couldn't find a better way yet.

Many, many thanks!

Upvotes: 3

Views: 1260

Answers (1)

Hexdoll
Hexdoll

Reputation: 2146

Write a custom Smarty plugin that calls your existing translation code.

Either a modifier that allows variables to be passed translation eg

{$myvar|translate}

Or a block function like

{translate}This text{/translate}

Upvotes: 2

Related Questions