Ticket #1625 (assigned enhancement)

Opened 1 year ago

Last modified 1 week ago

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

Changed 9 months ago by sminnee

  • owner changed from nlou to ischommer

This seems like a good candidate for your 2.2.2 work, Ingo.

Changed 9 months ago by ischommer

  • status changed from new to assigned

Changed 8 months ago by sminnee

  • milestone changed from 2.2.2 feature-lock to 2.2.3 feature-lock

Changed 8 months ago by sminnee

  • type changed from defect to enhancement

Changed 1 week ago by sminnee

  • milestone changed from 2.2.3* to 2.3.0

We should probably clear out some of these i18n-infrastructure issues as part of 2.3.

Note: See TracTickets for help on using tickets.