You are here

public function ConfigTranslationUiTest::getPoFile in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/config_translation/src/Tests/ConfigTranslationUiTest.php \Drupal\config_translation\Tests\ConfigTranslationUiTest::getPoFile()

Helper function that returns a .po file with a given number of plural forms.

2 calls to ConfigTranslationUiTest::getPoFile()
ConfigTranslationUiTest::testPluralConfigStrings in core/modules/config_translation/src/Tests/ConfigTranslationUiTest.php
Test translation of plural strings with multiple plural forms in config.
ConfigTranslationUiTest::testPluralConfigStringsSourceElements in core/modules/config_translation/src/Tests/ConfigTranslationUiTest.php
Test the number of source elements for plural strings in config translation forms.

File

core/modules/config_translation/src/Tests/ConfigTranslationUiTest.php, line 1066
Contains \Drupal\config_translation\Tests\ConfigTranslationUiTest.

Class

ConfigTranslationUiTest
Translate settings and entities to various languages.

Namespace

Drupal\config_translation\Tests

Code

public function getPoFile($plurals) {
  $po_file = array();
  $po_file[1] = <<<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=1; plural=0;\\n"
EOF;
  $po_file[2] = <<<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=2; plural=(n>1);\\n"
EOF;
  $po_file[4] = <<<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=4; plural=(((n%100)==1)?(0):(((n%100)==2)?(1):((((n%100)==3)||((n%100)==4))?(2):3)));\\n"
EOF;
  return $po_file[$plurals];
}