Is there a way to display languages using sfFormLanguage, but in their respective language?
I mean, instead of this: English, French, Spanish
I want this: English, Français, Español
Is there a way to display languages using sfFormLanguage, but in their respective language?
I mean, instead of this: English, French, Spanish
I want this: English, Français, Español
No, sfFormLanguage is fully-formed and vacuum-packed, so you have to take it as it is. It's a handy bit of code which I've used myself, but I guess it would be nice to have some configuration options.
However it should be quite easy to write your own by delving into the sfFormLanguage class and changing the parts which do the culture lookup and instead use a static list of your own creation.
There's an even simpler option though: just create your own dropdown list which connects to the sfFormLanguage form in the manner it expects:
<form action="/change-language">
<label for="language">Language</label>
<select name="language" id="language">
<option value="es">Español</option>
<option value="en" selected="selected">English</option>
<option value="fr">Français</option>
</select>
<input type="submit" value="ok">
</form>
What I have is this:
<?php $languages = array('en' => 'English', 'es' => 'Español', 'ca' => 'Català'); ?>
<?php foreach (array_keys($languages) as $lang):?>
<?php echo link_to($languages[$lang], 'language/changeLanguage?lang='.$lang)?>
<?php endforeach ?>
With links. I find this easier for people that just scans the page looking for their language.