From aa306d7cbf20a80001273cd6e16516130ab774e5 Mon Sep 17 00:00:00 2001 From: catch Date: Mon, 17 Apr 2023 09:24:00 +0100 Subject: [PATCH] Issue #2188715 by penyaskito, amanshukla6158, mrinalini9, smustgrave, YesCT, quietone: Document return value in \Drupal\locale\LocaleTranslation::getStringTranslation --- core/modules/locale/src/LocaleTranslation.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/core/modules/locale/src/LocaleTranslation.php b/core/modules/locale/src/LocaleTranslation.php index e9b693894e5..a9ccc93626f 100644 --- a/core/modules/locale/src/LocaleTranslation.php +++ b/core/modules/locale/src/LocaleTranslation.php @@ -119,6 +119,11 @@ class LocaleTranslation implements TranslatorInterface, DestructableInterface { $this->translations[$langcode][$context] = new LocaleLookup($langcode, $context, $this->storage, $this->cache, $this->lock, $this->configFactory, $this->languageManager, $this->requestStack); } $translation = $this->translations[$langcode][$context]->get($string); + // If the translation is TRUE, no translation exists, but that string needs + // to be stored in the persistent cache for performance reasons (so for + // example, we don't have hundreds of queries to locale tables on each + // request). That cache is persisted when the request ends, and the lookup + // service is destroyed. return $translation === TRUE ? FALSE : $translation; }