1 gettext.inc _locale_import_append_plural($entry, $key)

Adds count indices to a string.

Callback for array_map() within _locale_import_one_string().


array $entry: An array element.

int $key: Index of the array element.

Return value

array: The modified $entry parameter with "@count" strings replaced with the given $key value.

Related topics


core/includes/gettext.inc, line 829
Gettext parsing and generating API.


function _locale_import_append_plural($entry, $key) {
  // No modifications for 0, 1.
  if ($key == 0 || $key == 1) {
    return $entry;

  // First remove any possibly false indices, then add new ones.
  $entry = preg_replace('/(@count)\[[0-9]\]/', '\\1', $entry);
  return preg_replace('/(@count)/', "\\1[$key]", $entry);