public function ConfigTranslationUiTest::getPoFile in Drupal 8
Same name and namespace in other branches
- 9 core/modules/config_translation/tests/src/Functional/ConfigTranslationUiTest.php \Drupal\Tests\config_translation\Functional\ConfigTranslationUiTest::getPoFile()
- 10 core/modules/config_translation/tests/src/Functional/ConfigTranslationUiTest.php \Drupal\Tests\config_translation\Functional\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/ tests/ src/ Functional/ ConfigTranslationUiTest.php - Test translation of plural strings with multiple plural forms in config.
- ConfigTranslationUiTest::testPluralConfigStringsSourceElements in core/
modules/ config_translation/ tests/ src/ Functional/ ConfigTranslationUiTest.php - Test the number of source elements for plural strings in config translation forms.
File
- core/
modules/ config_translation/ tests/ src/ Functional/ ConfigTranslationUiTest.php, line 1173
Class
- ConfigTranslationUiTest
- Translate settings and entities to various languages.
Namespace
Drupal\Tests\config_translation\FunctionalCode
public function getPoFile($plurals) {
$po_file = [];
$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];
}