You are here

protected function TwigTransTest::poFileContents in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/system/src/Tests/Theme/TwigTransTest.php \Drupal\system\Tests\Theme\TwigTransTest::poFileContents()

Generate a custom .po file for a specific test language.

Parameters

string $langcode: The langcode of the specified language.

Return value

string|FALSE The .po contents for the specified language or FALSE if none exists.

1 call to TwigTransTest::poFileContents()
TwigTransTest::installLanguages in core/modules/system/src/Tests/Theme/TwigTransTest.php
Helper function: install languages.

File

core/modules/system/src/Tests/Theme/TwigTransTest.php, line 216
Contains \Drupal\system\Tests\Theme\TwigTransTest.

Class

TwigTransTest
Tests Twig "trans" tags.

Namespace

Drupal\system\Tests\Theme

Code

protected function poFileContents($langcode) {
  if ($langcode === 'xx') {
    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=2; plural=(n > 1);\\n"

msgid "Hello sun."
msgstr "OH HAI SUNZ"

msgctxt "Lolspeak"
msgid "Hello sun."
msgstr "O HAI SUNZZZZZZZ"

msgid "Hello Earth."
msgstr "O HERRO ERRRF."

msgid "Hello moon."
msgstr "OH HAI TEH MUUN"

msgid "Hello star."
msgid_plural "Hello @count stars."
msgstr[0] "O HAI STARRRRR"
msgstr[1] "O HAI @count STARZZZZ"

msgid "Escaped: @string"
msgstr "ESCAPEE: @string"

msgid "Placeholder: %string"
msgstr "PLAYSHOLDR: %string"

msgid "This @token.name has a length of: @count. It contains: %token.numbers and @token.bad_text."
msgstr "DIS @token.name HAZ LENGTH OV: @count. IT CONTAYNZ: %token.numbers AN @token.bad_text."

msgctxt "Lolspeak"
msgid "I have context."
msgstr "I HAZ KONTEX."
EOF;
  }
  else {
    if ($langcode === 'zz') {
      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=2; plural=(n > 1);\\n"

msgid "Hello new text."
msgstr "O HAI NU TXT."

msgctxt "Lolspeak"
msgid "Hello new text."
msgstr "O HAI NU TXTZZZZ."
EOF;
    }
  }
  return FALSE;
}