function LocalePluralFormatTest::getPoFileWithComplexPlural

Same name in other branches
  1. 7.x modules/locale/locale.test \LocalePluralFormatTest::getPoFileWithComplexPlural()
  2. 9 core/modules/locale/tests/src/Functional/LocalePluralFormatTest.php \Drupal\Tests\locale\Functional\LocalePluralFormatTest::getPoFileWithComplexPlural()
  3. 8.9.x core/modules/locale/tests/src/Functional/LocalePluralFormatTest.php \Drupal\Tests\locale\Functional\LocalePluralFormatTest::getPoFileWithComplexPlural()
  4. 10 core/modules/locale/tests/src/Functional/LocalePluralFormatTest.php \Drupal\Tests\locale\Functional\LocalePluralFormatTest::getPoFileWithComplexPlural()

Returns a .po file with a complex plural formula.

2 calls to LocalePluralFormatTest::getPoFileWithComplexPlural()
LocalePluralFormatTest::testGetPluralFormat in core/modules/locale/tests/src/Functional/LocalePluralFormatTest.php
Tests locale_get_plural() and \Drupal::translation()->formatPlural().
LocalePluralFormatTest::testPluralEditExport in core/modules/locale/tests/src/Functional/LocalePluralFormatTest.php
Tests plural editing and export functionality.

File

core/modules/locale/tests/src/Functional/LocalePluralFormatTest.php, line 429

Class

LocalePluralFormatTest
Tests plural handling for various languages.

Namespace

Drupal\Tests\locale\Functional

Code

public function getPoFileWithComplexPlural() {
    return <<<EOF
msgid ""
msgstr ""
"Project-Id-Version: Drupal 8\\n"
"MIME-Version: 1.0\\n"
"Content-Type: text/plain; charset=UTF-8\\n"
"Content-Transfer-Encoding: 8bit\\n"
"Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\\n"

msgid "@count hour"
msgid_plural "@count hours"
msgstr[0] "@count sat"
msgstr[1] "@count sata"
msgstr[2] "@count sati"

msgid "Monday"
msgstr "Ponedjeljak"
EOF;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.