You are here

function _potx_get_plural_form in Translation template extractor 8

Return the plural form of a language. source: the gettext library.

@returns The plural form of the language, used in the .po file header.

Parameters

string $langcode: The language code.

1 call to _potx_get_plural_form()
_potx_get_header in ./potx.inc
Returns a header generated for a given file.

File

./potx.inc, line 651
Extraction API used by the web and command line interface.

Code

function _potx_get_plural_form($langcode) {
  $plural_forms = [
    'ja' => '0',
    'vi' => '0',
    'ko' => '0',
    'en' => '(n != 1)',
    'de' => '(n != 1)',
    'nl' => '(n != 1)',
    'sv' => '(n != 1)',
    'da' => '(n != 1)',
    'no' => '(n != 1)',
    'nb' => '(n != 1)',
    'nn' => '(n != 1)',
    'fo' => '(n != 1)',
    'es' => '(n != 1)',
    'pt' => '(n != 1)',
    'it' => '(n != 1)',
    'bg' => '(n != 1)',
    'el' => '(n != 1)',
    'fi' => '(n != 1)',
    'et' => '(n != 1)',
    'he' => '(n != 1)',
    'eo' => '(n != 1)',
    'hu' => '(n != 1)',
    'tr' => '(n != 1)',
    'fa' => '(n != 1)',
    'pt_BR' => '(n > 1)',
    'fr' => '(n > 1)',
    'lv' => '(n%10==1 && n%100!=11 ? 0 : n != 0 ? 1 : 2)',
    'ga' => 'n==1 ? 0 : n==2 ? 1 : 2',
    'ro' => 'n==1 ? 0 : (n==0 || (n%100 > 0 && n%100 < 20)) ? 1 : 2',
    'lt' => '(n%10==1 && n%100!=11 ? 0 : n%10>=2 && (n%100<10 || n%100>=20) ? 1 : 2)',
    'ru' => '(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2)',
    'uk' => '(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2)',
    'be' => '(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2)',
    'sr' => '(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2)',
    'hr' => '(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2)',
    'cs' => '(n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2',
    'sk' => '(n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2',
    'pl' => '(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2)',
    'sl' => '(n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 || n%100==4 ? 2 : 3)',
  ];
  return isset($plural_forms[$langcode]) ? $plural_forms[$langcode] : NULL;
}