Retrieves translations through the `Catalog` class by using `$id` as the lookup key and taking the current or - if specified - the provided locale as well as the scope into account. Hereupon the correct plural form is determined by passing the value of the `'count'` option to a closure.

Parameters

  • string $id The lookup key.
  • integer $count Used to determine the correct plural form.
  • string $locale The target locale.
  • array $options Passed through to `Catalog::read()`. Valid options are: - `'scope'`: The scope of the message.

Returns

string The translation or `null` if none could be found or the plural form could not be determined.
This method can be filtered.

Source

						protected static function _translated($id, $count, $locale, array $options = array()) {
		$params = compact('id', 'count', 'locale', 'options');

		$cache =& static::$_cachedPages;
		return static::_filter(__FUNCTION__, $params, function($self, $params) use (&$cache) {
			extract($params);

			if (!isset($cache[$options['scope']][$locale])) {
				$cache[$options['scope']][$locale] = Catalog::read(
					true, 'message', $locale, $options
				);
			}
			$page = $cache[$options['scope']][$locale];

			if (!isset($page[$id])) {
				return null;
			}
			if (!is_array($page[$id])) {
				return $page[$id];
			}

			if (!isset($page['pluralRule']) || !is_callable($page['pluralRule'])) {
				return null;
			}
			$key = $page['pluralRule']($count);

			if (isset($page[$id][$key])) {
				return $page[$id][$key];
			}
		});
	}