_locale_import_append_plural

function _locale_import_append_plural

_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.

Related topics

File

includes/locale.inc, line 1449
Administration 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);
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/includes!locale.inc/function/_locale_import_append_plural/7.x

在线笔记
App下载
App下载

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号

意见反馈
返回顶部