1043 Posts in 379 Topics by 373 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 1170 Views |
-
$SearchForm didn't translate to other languages

10 May 2010 at 8:49am
Hi
This might help somebody. After doing a FulltextSearchable::enable(); in _config.php I got the $SearchForm up and running in the blackcandy theme.
However even though I've enabled i18n and translatable the word "Search" wasn't translated. I had a look into the sapphire folder and there is a file called: ContentControllerSearchExtension.php with a function called SearchForm. Inside this form the _t()-function hadn't been used and that caused the problem.
Here is how the function looks after a few corrections that made it work:
/**
* Site search form
*/
function SearchForm() {
$searchText = isset($_REQUEST['Search']) ? $_REQUEST['Search'] : _t('SearchForm.SEARCH', 'Search');
$fields = new FieldSet(
new TextField('Search', '', $searchText)
);
$actions = new FieldSet(
new FormAction('results', _t('SearchForm.GO', 'Search'))
);
return new SearchForm($this->owner, 'SearchForm', $fields, $actions);
}Joel
-
Re: $SearchForm didn't translate to other languages

11 May 2010 at 9:30pm
Fixed in r104596, that was an oversight on our part, sorry about that! In general, you have better chances of your patch being noticed if you put it up on open.silverstripe.org.
-
Re: $SearchForm didn't translate to other languages

11 May 2010 at 9:50pm
Ok, will do that in the future...
| 1170 Views | ||
|
Page:
1
|
Go to Top |


