Verified Commit d1859047 authored by Andrei Mateescu's avatar Andrei Mateescu
Browse files

task: #2831617 Deprecate global constants in locale module

By: nicxvan
By: claudiu.cristea
By: daffie
By: feuerwagen
By: mondrake
By: berdir
By: amateescu
parent d1c1a1bb
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -7,6 +7,7 @@
use Drupal\block_content\Entity\BlockContentType;
use Drupal\filter\Entity\FilterFormat;
use Drupal\language\Entity\ConfigurableLanguage;
use Drupal\locale\Model\TranslationUpdateMode;
use Drupal\taxonomy\Entity\Vocabulary;
use Drupal\Tests\block_content\Traits\BlockContentCreationTrait;
use Drupal\Tests\BrowserTestBase;
@@ -86,7 +87,7 @@ protected function setUp(): void {
    // tests.
    $this->config('locale.settings')
      ->set('translation.import_enabled', TRUE)
      ->set('translation.use_source', LOCALE_TRANSLATION_USE_SOURCE_LOCAL)
      ->set('translation.use_source', TranslationUpdateMode::Local->value)
      ->save();
    $this->drupalPlaceBlock('local_tasks_block');
  }
+2 −1
Original line number Diff line number Diff line
@@ -6,6 +6,7 @@

use Drupal\Core\Language\Language;
use Drupal\Core\Language\LanguageInterface;
use Drupal\locale\Model\TranslationUpdateMode;
use PHPUnit\Framework\Attributes\Group;
use PHPUnit\Framework\Attributes\RunTestsInSeparateProcesses;

@@ -110,7 +111,7 @@ public function testLocaleDBStorage(): void {
    // tests.
    $this->config('locale.settings')
      ->set('translation.import_enabled', TRUE)
      ->set('translation.use_source', LOCALE_TRANSLATION_USE_SOURCE_LOCAL)
      ->set('translation.use_source', TranslationUpdateMode::Local->value)
      ->save();

    $this->drupalLogin($this->adminUser);
+2 −1
Original line number Diff line number Diff line
@@ -5,6 +5,7 @@
namespace Drupal\Tests\contact\Functional;

use Drupal\contact\Entity\ContactForm;
use Drupal\locale\Model\TranslationUpdateMode;
use Drupal\Tests\BrowserTestBase;
use PHPUnit\Framework\Attributes\Group;
use PHPUnit\Framework\Attributes\IgnoreDeprecations;
@@ -62,7 +63,7 @@ protected function setUp(): void {
    // tests.
    $this->config('locale.settings')
      ->set('translation.import_enabled', TRUE)
      ->set('translation.use_source', LOCALE_TRANSLATION_USE_SOURCE_LOCAL)
      ->set('translation.use_source', TranslationUpdateMode::Local->value)
      ->save();
    $this->drupalPlaceBlock('local_tasks_block');
  }
+6 −4
Original line number Diff line number Diff line
@@ -50,8 +50,9 @@ function locale_translate_get_interface_translation_files(array $projects = [],
 *     Drupal\locale\PoDatabaseWriter. Optional, defaults to an empty array.
 *   - 'customized': Flag indicating whether the strings imported from $file
 *     are customized translations or come from a community source. Use
 *     LOCALE_CUSTOMIZED or LOCALE_NOT_CUSTOMIZED. Optional, defaults to
 *     LOCALE_NOT_CUSTOMIZED.
 *     LocaleDefaultOptions::CUSTOMIZED or
 *     LocaleDefaultOptions::NOT_CUSTOMIZED. Optional, defaults to
 *     LocaleDefaultOptions::NOT_CUSTOMIZED.
 *   - 'finish_feedback': Whether or not to give feedback to the user when the
 *     batch is finished. Optional, defaults to TRUE.
 *
@@ -86,8 +87,9 @@ function locale_translate_batch_build(array $files, array $options) {
 *     Drupal\locale\PoDatabaseWriter. Optional, defaults to an empty array.
 *   - 'customized': Flag indicating whether the strings imported from $file
 *     are customized translations or come from a community source. Use
 *     LOCALE_CUSTOMIZED or LOCALE_NOT_CUSTOMIZED. Optional, defaults to
 *     LOCALE_NOT_CUSTOMIZED.
 *     LocaleDefaultOptions::CUSTOMIZED or
 *     LocaleDefaultOptions::NOT_CUSTOMIZED. Optional, defaults to
 *     LocaleDefaultOptions::NOT_CUSTOMIZED.
 *   - 'message': Alternative message to display during import. Note, this must
 *     be sanitized text.
 * @param array|\ArrayAccess $context
+2 −2
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@
use Drupal\Core\Database\SchemaDefinition\Table;
use Drupal\Core\File\Exception\FileException;
use Drupal\Core\File\FileSystemInterface;
use Drupal\locale\LocaleDefaultOptions;
use Drupal\locale\StreamWrapper\TranslationsStream;

/**
@@ -141,8 +142,7 @@ function locale_schema(): Schema {
        name: 'customized',
        description: 'Boolean indicating whether the translation is custom to this site.',
        notNull: TRUE,
        // LOCALE_NOT_CUSTOMIZED.
        default: new IntValue(0),
        default: new IntValue(LocaleDefaultOptions::NOT_CUSTOMIZED),
      ),
    ],
    primaryKey: new PrimaryKey(['language', 'lid']),
Loading