You are here

function _locale_import_append_plural in Drupal 4

Same name and namespace in other branches
  1. 5 includes/locale.inc \_locale_import_append_plural()
  2. 6 includes/locale.inc \_locale_import_append_plural()
  3. 7 includes/locale.inc \_locale_import_append_plural()

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:

1 string reference to '_locale_import_append_plural'
_locale_import_one_string in includes/locale.inc
Imports a string into the database

File

includes/locale.inc, line 977
Admin-related functions for locale.module.

Code

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);
}