Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Translating ORM Model properties
  • I have currently a model with properties defined, and I use those properties in de Fieldset class to generate a form. But how can I define translations for those model properties?
  • You mean, for the 'label' fields? The Form class instance will automatically do a \Lang::get() on the defined label, so if a language string exists that matches the defined label, it will load the translation. I code my labels as "label.model.column", which translate to array('label' => array('model' => array('column' => 'label-for-column-name'))); in your lang file. This allows me to have per-model language files. I do a \Lang::load() in the model _init() method, so they are loaded before they are needed, and they are loaded only once.
  • Is it that simple? Very nice! Thank you very much.
  • But the translation is not done on the verification errors :(

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion