Question

I was just wondering how the labels of a sfWidgetFormChoice can be localized when these are defined in the model tabel as suggested in http://www.symfony-project.org/jobeet/1_4/Doctrine/en/10 ?

class JobeetJobTable extends Doctrine_Table {
  static public $types = array(
    'full-time' => 'Full time',
    'part-time' => 'Part time',
    'freelance' => 'Freelance',
  );
}

Thanks in advanche :)

Was it helpful?

Solution

TEMPLATE:

__('my translated string')

OTHER:

sfContext::getInstance()->getI18N()->__('my translated string')

If I recall right, stuff inside form classes won't get extracted by the CLI extract tasks but they'll still work fine as long as Symfony finds the translations in the XLIFF files.

OTHER TIPS

If you are using non-verbose forms and the i18n helper is enabled, the labels should automatically be run through the appropriate i18n functions.

I looked up some of the old symfony 1.1 i18n and forms documentation and most of this information should still be valid. You'll have to play around and see what still works.

General i18n and l10n is covered in day 19 of the jobeet tutorial.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top