_locale_import_append_plural

Versions
4.6 – 7
_locale_import_append_plural($entry, $key)

Modify a string to contain proper count indices

This is a callback function used via array_map()

Parameters

$entry An array element

$key Index of the array element

Code

includes/locale.inc, line 977

<?php
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);
}
?>
Login or register to post comments
 
 

All source code and documentation on this site is released under the terms of the GNU General Public License, version 2 and later. Drupal is a registered trademark of Dries Buytaert.