Ticket #1625 (assigned enhancement)
i18n: Make statics translatable by implementing TextCollectable
| Reported by: | ischommer | Assigned to: | ischommer (accepted) |
|---|---|---|---|
| Type: | enhancement | Priority: | critical |
| Milestone: | 2.3.0 | Component: | i18n |
| Version: | Severity: | medium effort / impact | |
| Keywords: | Cc: | ischommer | |
| Due date: | Hours: | 4 |
Description
- add TextCollectable? interface
- in textcollector(), singleton all classes implementing TextCollectable? and run collectText()
- fix up CMSMain $site_tree_filter_options
- implement _t_array() in core.php
- look for untranslated statics throughout cms/sapphire
CMSMain.php
/**
* SiteTree Columns that can be filtered using the the Site Tree Search button.
* Values should be translation tuples: array('I18N_CODE', 'This is the default name')
*/
static $site_tree_filter_options = array(
'ClassName' => array('PAGE_TYPE', 'Page Type'),
'Status' => 'Status',
'MetaDescription' => 'Description',
'MetaKeywords' => 'Keywords'
);
function collectText() {
return array_values(self::$site_tree_filter_options);
}
static function site_tree_filter_options() {
return _t_array(self::$site_tree_filter_options);
}
Core.php
/**
* Call _t() on every item in the map/array. Doesn't support nested arrays
*/
function _t_array($array) {
foreach(self::$site_tree_filter_options as $k => $v) {
if(is_array($v)) $new[$k] = _t_arr($v);
else $new[$k] = $v;
}
return $new;
}
Attachments
Change History
Note: See
TracTickets for help on using
tickets.
