LocaleImportFunctionalTest.php 22.4 KB
Newer Older
1 2 3 4 5
<?php

namespace Drupal\locale\Tests;

use Drupal\simpletest\WebTestBase;
6
use Drupal\Core\Language\LanguageInterface;
7 8

/**
9 10 11
 * Tests the import of locale files.
 *
 * @group locale
12 13
 */
class LocaleImportFunctionalTest extends WebTestBase {
14 15 16 17 18 19 20 21

  /**
   * Modules to enable.
   *
   * @var array
   */
  public static $modules = array('locale', 'dblog');

22 23
  /**
   * A user able to create languages and import translations.
24 25 26 27 28 29 30 31 32 33
   *
   * @var \Drupal\user\Entity\User
   */
  protected $adminUser;

  /**
   * A user able to create languages, import translations and access site
   * reports.
   *
   * @var \Drupal\user\Entity\User
34
   */
35
  protected $adminUserAccessSiteReports;
36

37 38 39
  /**
   * {@inheritdoc}
   */
40
  protected function setUp() {
41
    parent::setUp();
42

43
    // Copy test po files to the translations directory.
44 45
    file_unmanaged_copy(__DIR__ . '/../../tests/test.de.po', 'translations://', FILE_EXISTS_REPLACE);
    file_unmanaged_copy(__DIR__ . '/../../tests/test.xx.po', 'translations://', FILE_EXISTS_REPLACE);
46

47
    $this->adminUser = $this->drupalCreateUser(array('administer languages', 'translate interface', 'access administration pages'));
48
    $this->adminUserAccessSiteReports = $this->drupalCreateUser(array('administer languages', 'translate interface', 'access administration pages', 'access site reports'));
49
    $this->drupalLogin($this->adminUser);
50 51 52

    // Enable import of translations. By default this is disabled for automated
    // tests.
53
    $this->config('locale.settings')
54 55
      ->set('translation.import_enabled', TRUE)
      ->save();
56 57 58 59 60
  }

  /**
   * Test import of standalone .po files.
   */
61
  public function testStandalonePoFile() {
62 63 64 65
    // Try importing a .po file.
    $this->importPoFile($this->getPoFile(), array(
      'langcode' => 'fr',
    ));
66
    $this->config('locale.settings');
67
    // The import should automatically create the corresponding language.
68
    $this->assertRaw(t('The language %language has been created.', array('%language' => 'French')), 'The language has been automatically created.');
69 70

    // The import should have created 8 strings.
71
    $this->assertRaw(t('One translation file imported. %number translations were added, %update translations were updated and %delete translations were removed.', array('%number' => 8, '%update' => 0, '%delete' => 0)), 'The translation file was successfully imported.');
72 73

    // This import should have saved plural forms to have 2 variants.
74 75
    $locale_plurals = \Drupal::service('locale.plural.formula')->getNumberOfPlurals('fr');
    $this->assertEqual(2, $locale_plurals, 'Plural number initialized.');
76 77

    // Ensure we were redirected correctly.
78
    $this->assertUrl(\Drupal::url('locale.translate_page', [], ['absolute' => TRUE]), [], 'Correct page redirection.');
79 80 81 82 83 84 85

    // Try importing a .po file with invalid tags.
    $this->importPoFile($this->getBadPoFile(), array(
      'langcode' => 'fr',
    ));

    // The import should have created 1 string and rejected 2.
86
    $this->assertRaw(t('One translation file imported. %number translations were added, %update translations were updated and %delete translations were removed.', array('%number' => 1, '%update' => 0, '%delete' => 0)), 'The translation file was successfully imported.');
87

88
    $skip_message = \Drupal::translation()->formatPlural(2, 'One translation string was skipped because of disallowed or malformed HTML. <a href=":url">See the log</a> for details.', '@count translation strings were skipped because of disallowed or malformed HTML. See the log for details.', array(':url' => \Drupal::url('dblog.overview')));
89
    $this->assertRaw($skip_message, 'Unsafe strings were skipped.');
90

91 92 93 94 95 96 97 98 99
    // Repeat the process with a user that can access site reports, and this
    // time the different warnings must contain links to the log.
    $this->drupalLogin($this->adminUserAccessSiteReports);

    // Try importing a .po file with invalid tags.
    $this->importPoFile($this->getBadPoFile(), array(
      'langcode' => 'fr',
    ));

100
    $skip_message = \Drupal::translation()->formatPlural(2, 'One translation string was skipped because of disallowed or malformed HTML. <a href=":url">See the log</a> for details.', '@count translation strings were skipped because of disallowed or malformed HTML. <a href=":url">See the log</a> for details.', array(':url' => \Drupal::url('dblog.overview')));
101 102 103 104
    $this->assertRaw($skip_message, 'Unsafe strings were skipped.');

    // Check empty files import with a user that cannot access site reports..
    $this->drupalLogin($this->adminUser);
105 106 107 108
    // Try importing a zero byte sized .po file.
    $this->importPoFile($this->getEmptyPoFile(), array(
      'langcode' => 'fr',
    ));
109 110
    // The import should have created 0 string and rejected 0.
    $this->assertRaw(t('One translation file could not be imported. See the log for details.'), 'The empty translation file import reported no translations imported.');
111

112 113 114 115 116 117 118
    // Repeat the process with a user that can access site reports, and this
    // time the different warnings must contain links to the log.
    $this->drupalLogin($this->adminUserAccessSiteReports);
    // Try importing a zero byte sized .po file.
    $this->importPoFile($this->getEmptyPoFile(), array(
      'langcode' => 'fr',
    ));
119
    // The import should have created 0 string and rejected 0.
120
    $this->assertRaw(t('One translation file could not be imported. <a href=":url">See the log</a> for details.', array(':url' => \Drupal::url('dblog.overview'))), 'The empty translation file import reported no translations imported.');
121 122

    // Try importing a .po file which doesn't exist.
123
    $name = $this->randomMachineName(16);
124
    $this->drupalPostForm('admin/config/regional/translate/import', array(
125 126 127
      'langcode' => 'fr',
      'files[file]' => $name,
    ), t('Import'));
128
    $this->assertUrl(\Drupal::url('locale.translate_import', [], ['absolute' => TRUE]), [], 'Correct page redirection.');
129
    $this->assertText(t('File to import not found.'), 'File to import not found message.');
130 131 132 133 134 135 136 137

    // Try importing a .po file with overriding strings, and ensure existing
    // strings are kept.
    $this->importPoFile($this->getOverwritePoFile(), array(
      'langcode' => 'fr',
    ));

    // The import should have created 1 string.
138
    $this->assertRaw(t('One translation file imported. %number translations were added, %update translations were updated and %delete translations were removed.', array('%number' => 1, '%update' => 0, '%delete' => 0)), 'The translation file was successfully imported.');
139 140 141
    // Ensure string wasn't overwritten.
    $search = array(
      'string' => 'Montag',
142
      'langcode' => 'fr',
143 144
      'translation' => 'translated',
    );
145
    $this->drupalPostForm('admin/config/regional/translate', $search, t('Filter'));
146
    $this->assertText(t('No strings available.'), 'String not overwritten by imported string.');
147 148

    // This import should not have changed number of plural forms.
149 150
    $locale_plurals = \Drupal::service('locale.plural.formula')->getNumberOfPlurals('fr');
    $this->assertEqual(2, $locale_plurals, 'Plural numbers untouched.');
151 152 153 154 155 156 157 158 159

    // Try importing a .po file with overriding strings, and ensure existing
    // strings are overwritten.
    $this->importPoFile($this->getOverwritePoFile(), array(
      'langcode' => 'fr',
      'overwrite_options[not_customized]' => TRUE,
    ));

    // The import should have updated 2 strings.
160
    $this->assertRaw(t('One translation file imported. %number translations were added, %update translations were updated and %delete translations were removed.', array('%number' => 0, '%update' => 2, '%delete' => 0)), 'The translation file was successfully imported.');
161 162 163
    // Ensure string was overwritten.
    $search = array(
      'string' => 'Montag',
164
      'langcode' => 'fr',
165 166
      'translation' => 'translated',
    );
167
    $this->drupalPostForm('admin/config/regional/translate', $search, t('Filter'));
168
    $this->assertNoText(t('No strings available.'), 'String overwritten by imported string.');
169
    // This import should have changed number of plural forms.
170 171
    $locale_plurals = \Drupal::service('locale.plural.formula')->reset()->getNumberOfPlurals('fr');
    $this->assertEqual(3, $locale_plurals, 'Plural numbers changed.');
172 173 174 175 176 177 178 179

    // Importing a .po file and mark its strings as customized strings.
    $this->importPoFile($this->getCustomPoFile(), array(
      'langcode' => 'fr',
      'customized' => TRUE,
    ));

    // The import should have created 6 strings.
180
    $this->assertRaw(t('One translation file imported. %number translations were added, %update translations were updated and %delete translations were removed.', array('%number' => 6, '%update' => 0, '%delete' => 0)), 'The customized translation file was successfully imported.');
181 182 183

    // The database should now contain 6 customized strings (two imported
    // strings are not translated).
184
    $count = db_query('SELECT COUNT(*) FROM {locales_target} WHERE customized = :custom', array(':custom' => 1))->fetchField();
185
    $this->assertEqual($count, 6, 'Customized translations successfully imported.');
186 187 188 189 190 191 192 193 194 195

    // Try importing a .po file with overriding strings, and ensure existing
    // customized strings are kept.
    $this->importPoFile($this->getCustomOverwritePoFile(), array(
      'langcode' => 'fr',
      'overwrite_options[not_customized]' => TRUE,
      'overwrite_options[customized]' => FALSE,
    ));

    // The import should have created 1 string.
196
    $this->assertRaw(t('One translation file imported. %number translations were added, %update translations were updated and %delete translations were removed.', array('%number' => 1, '%update' => 0, '%delete' => 0)), 'The customized translation file was successfully imported.');
197 198 199
    // Ensure string wasn't overwritten.
    $search = array(
      'string' => 'januari',
200
      'langcode' => 'fr',
201 202
      'translation' => 'translated',
    );
203
    $this->drupalPostForm('admin/config/regional/translate', $search, t('Filter'));
204
    $this->assertText(t('No strings available.'), 'Customized string not overwritten by imported string.');
205 206 207 208 209 210 211 212 213 214

    // Try importing a .po file with overriding strings, and ensure existing
    // customized strings are overwritten.
    $this->importPoFile($this->getCustomOverwritePoFile(), array(
      'langcode' => 'fr',
      'overwrite_options[not_customized]' => FALSE,
      'overwrite_options[customized]' => TRUE,
    ));

    // The import should have updated 2 strings.
215
    $this->assertRaw(t('One translation file imported. %number translations were added, %update translations were updated and %delete translations were removed.', array('%number' => 0, '%update' => 2, '%delete' => 0)), 'The customized translation file was successfully imported.');
216 217 218
    // Ensure string was overwritten.
    $search = array(
      'string' => 'januari',
219
      'langcode' => 'fr',
220 221
      'translation' => 'translated',
    );
222
    $this->drupalPostForm('admin/config/regional/translate', $search, t('Filter'));
223
    $this->assertNoText(t('No strings available.'), 'Customized string overwritten by imported string.');
224 225 226 227 228 229

  }

  /**
   * Test msgctxt context support.
   */
230
  public function testLanguageContext() {
231 232 233 234 235
    // Try importing a .po file.
    $this->importPoFile($this->getPoFileWithContext(), array(
      'langcode' => 'hr',
    ));

236 237 238 239
    // We cast the return value of t() to string so as to retrieve the
    // translated value, rendered as a string.
    $this->assertIdentical((string) t('May', array(), array('langcode' => 'hr', 'context' => 'Long month name')), 'Svibanj', 'Long month name context is working.');
    $this->assertIdentical((string) t('May', array(), array('langcode' => 'hr')), 'Svi.', 'Default context is working.');
240 241 242 243 244
  }

  /**
   * Test empty msgstr at end of .po file see #611786.
   */
245
  public function testEmptyMsgstr() {
246 247 248 249 250 251 252
    $langcode = 'hu';

    // Try importing a .po file.
    $this->importPoFile($this->getPoFileWithMsgstr(), array(
      'langcode' => $langcode,
    ));

253
    $this->assertRaw(t('One translation file imported. %number translations were added, %update translations were updated and %delete translations were removed.', array('%number' => 1, '%update' => 0, '%delete' => 0)), 'The translation file was successfully imported.');
254
    $this->assertIdentical((string) t('Operations', array(), array('langcode' => $langcode)), 'Műveletek', 'String imported and translated.');
255 256 257 258 259 260

    // Try importing a .po file.
    $this->importPoFile($this->getPoFileWithEmptyMsgstr(), array(
      'langcode' => $langcode,
      'overwrite_options[not_customized]' => TRUE,
    ));
261
    $this->assertRaw(t('One translation file imported. %number translations were added, %update translations were updated and %delete translations were removed.', array('%number' => 0, '%update' => 0, '%delete' => 1)), 'The translation file was successfully imported.');
262

263 264 265
    $str = "Operations";
    $search = array(
      'string' => $str,
266 267
      'langcode' => $langcode,
      'translation' => 'untranslated',
268
    );
269
    $this->drupalPostForm('admin/config/regional/translate', $search, t('Filter'));
270
    $this->assertText($str, 'Search found the string as untranslated.');
271 272
  }

273 274 275
  /**
   * Tests .po file import with configuration translation.
   */
276
  public function testConfigPoFile() {
277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296
    // Values for translations to assert. Config key, original string,
    // translation and config property name.
    $config_strings = array(
      'system.maintenance' => array(
        '@site is currently under maintenance. We should be back shortly. Thank you for your patience.',
        '@site karbantartás alatt áll. Rövidesen visszatérünk. Köszönjük a türelmet.',
        'message',
      ),
      'user.role.anonymous' => array(
        'Anonymous user',
        'Névtelen felhasználó',
        'label',
      ),
    );

    // Add custom language for testing.
    $langcode = 'xx';
    $edit = array(
      'predefined_langcode' => 'custom',
      'langcode' => $langcode,
297
      'label' => $this->randomMachineName(16),
298
      'direction' => LanguageInterface::DIRECTION_LTR,
299
    );
300
    $this->drupalPostForm('admin/config/regional/language/add', $edit, t('Add custom language'));
301 302 303 304

    // Check for the source strings we are going to translate. Adding the
    // custom language should have made the process to export configuration
    // strings to interface translation executed.
305
    $locale_storage = $this->container->get('locale.storage');
306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322
    foreach ($config_strings as $config_string) {
      $string = $locale_storage->findString(array('source' => $config_string[0], 'context' => '', 'type' => 'configuration'));
      $this->assertTrue($string, 'Configuration strings have been created upon installation.');
    }

    // Import a .po file to translate.
    $this->importPoFile($this->getPoFileWithConfig(), array(
      'langcode' => $langcode,
    ));

    // Translations got recorded in the interface translation system.
    foreach ($config_strings as $config_string) {
      $search = array(
        'string' => $config_string[0],
        'langcode' => $langcode,
        'translation' => 'all',
      );
323
      $this->drupalPostForm('admin/config/regional/translate', $search, t('Filter'));
324 325 326
      $this->assertText($config_string[1], format_string('Translation of @string found.', array('@string' => $config_string[0])));
    }

327 328
    // Test that translations got recorded in the config system.
    $overrides = \Drupal::service('language.config_factory_override');
329
    foreach ($config_strings as $config_key => $config_string) {
330 331
      $override = $overrides->getOverride($langcode, $config_key);
      $this->assertEqual($override->get($config_string[2]), $config_string[1]);
332 333 334
    }
  }

335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350
  /**
   * Tests .po file import with user.settings configuration.
   */
  public function testConfigtranslationImportingPoFile() {
    // Set the language code.
    $langcode = 'de';

    // Import a .po file to translate.
    $this->importPoFile($this->getPoFileWithConfigDe(), array(
      'langcode' => $langcode));

    // Check that the 'Anonymous' string is translated.
    $config = \Drupal::languageManager()->getLanguageConfigOverride($langcode, 'user.settings');
    $this->assertEqual($config->get('anonymous'), 'Anonymous German');
  }

351 352 353 354 355 356 357 358 359 360 361 362
  /**
   * Test the translation are imported when a new language is created.
   */
  public function testCreatedLanguageTranslation() {
    // Import a .po file to add de language.
    $this->importPoFile($this->getPoFileWithConfigDe(), array('langcode' => 'de'));

    // Get the language.entity.de label and check it's been translated.
    $override = \Drupal::languageManager()->getLanguageConfigOverride('de', 'language.entity.de');
    $this->assertEqual($override->get('label'), 'Deutsch');
  }

363 364 365
  /**
   * Helper function: import a standalone .po file in a given language.
   *
366
   * @param string $contents
367
   *   Contents of the .po file to import.
368 369
   * @param array $options
   *   (optional) Additional options to pass to the translation import form.
370
   */
371
  public function importPoFile($contents, array $options = array()) {
372
    $name = \Drupal::service('file_system')->tempnam('temporary://', "po_") . '.po';
373 374
    file_put_contents($name, $contents);
    $options['files[file]'] = $name;
375
    $this->drupalPostForm('admin/config/regional/translate/import', $options, t('Import'));
376 377 378 379 380 381
    drupal_unlink($name);
  }

  /**
   * Helper function that returns a proper .po file.
   */
382
  public function getPoFile() {
383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419
    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 "One sheep"
msgid_plural "@count sheep"
msgstr[0] "un mouton"
msgstr[1] "@count moutons"

msgid "Monday"
msgstr "lundi"

msgid "Tuesday"
msgstr "mardi"

msgid "Wednesday"
msgstr "mercredi"

msgid "Thursday"
msgstr "jeudi"

msgid "Friday"
msgstr "vendredi"

msgid "Saturday"
msgstr "samedi"

msgid "Sunday"
msgstr "dimanche"
EOF;
  }

420 421 422
  /**
   * Helper function that returns a empty .po file.
   */
423
  public function getEmptyPoFile() {
424 425 426
    return '';
  }

427 428 429
  /**
   * Helper function that returns a bad .po file.
   */
430
  public function getBadPoFile() {
431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454
    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 "Save configuration"
msgstr "Enregistrer la configuration"

msgid "edit"
msgstr "modifier<img SRC="javascript:alert(\'xss\');">"

msgid "delete"
msgstr "supprimer<script>alert('xss');</script>"

EOF;
  }

  /**
   * Helper function that returns a proper .po file for testing.
   */
455
  public function getOverwritePoFile() {
456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476
    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 "Monday"
msgstr "Montag"

msgid "Day"
msgstr "Jour"
EOF;
  }

  /**
   * Helper function that returns a .po file which strings will be marked
   * as customized.
   */
477
  public function getCustomPoFile() {
478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511
    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 "One dog"
msgid_plural "@count dogs"
msgstr[0] "un chien"
msgstr[1] "@count chiens"

msgid "January"
msgstr "janvier"

msgid "February"
msgstr "février"

msgid "March"
msgstr "mars"

msgid "April"
msgstr "avril"

msgid "June"
msgstr "juin"
EOF;
  }

  /**
   * Helper function that returns a .po file for testing customized strings.
   */
512
  public function getCustomOverwritePoFile() {
513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535
    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 "January"
msgstr "januari"

msgid "February"
msgstr "februari"

msgid "July"
msgstr "juillet"
EOF;
  }

  /**
   * Helper function that returns a .po file with context.
   */
536
  public function getPoFileWithContext() {
537 538
    // Croatian (code hr) is one of the languages that have a different
    // form for the full name and the abbreviated name for the month of May.
539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559
    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"

msgctxt "Long month name"
msgid "May"
msgstr "Svibanj"

msgid "May"
msgstr "Svi."
EOF;
  }

  /**
   * Helper function that returns a .po file with an empty last item.
   */
560
  public function getPoFileWithEmptyMsgstr() {
561 562 563 564 565 566 567 568 569 570 571 572 573 574
    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 "Operations"
msgstr ""

EOF;
  }
575

576 577 578
  /**
   * Helper function that returns a .po file with an empty last item.
   */
579
  public function getPoFileWithMsgstr() {
580 581 582 583 584 585 586 587 588 589 590 591 592 593 594
    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 "Operations"
msgstr "Műveletek"

msgid "Will not appear in Drupal core, so we can ensure the test passes"
msgstr ""

595 596 597 598 599 600
EOF;
  }

  /**
   * Helper function that returns a .po file with configuration translations.
   */
601
  public function getPoFileWithConfig() {
602 603 604 605 606 607 608 609 610 611 612 613 614 615 616
    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 "@site is currently under maintenance. We should be back shortly. Thank you for your patience."
msgstr "@site karbantartás alatt áll. Rövidesen visszatérünk. Köszönjük a türelmet."

msgid "Anonymous user"
msgstr "Névtelen felhasználó"

617 618 619
EOF;
  }

620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635
  /**
   * Helper function that returns a .po file with configuration translations.
   */
  public function getPoFileWithConfigDe() {
    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 "Anonymous"
msgstr "Anonymous German"

636 637 638
msgid "German"
msgstr "Deutsch"

639 640
EOF;
  }
641

642
}