public function translateString($name,
$langcode,
$source,
$context) { if ($source) { // If translations for a language have not been loaded yet.
if (!
isset($this->translations
[$name][$langcode])) { // Preload all translations for this configuration name and language.
$this->translations
[$name][$langcode] =
[];
foreach ($this->localeStorage->
getTranslations(['language' =>
$langcode, 'type' => 'configuration', 'name' =>
$name]) as $string) { $this->translations
[$name][$langcode][$string->context
][$string->source
] =
$string;
} } if (!
isset($this->translations
[$name][$langcode][$context][$source])) { // There is no translation of the source string in this config location
// to this language for this context.
if ($translation =
$this->localeStorage->
findTranslation(['source' =>
$source, 'context' =>
$context, 'language' =>
$langcode])) { // Look for a translation of the string. It might have one, but not
// be saved in this configuration location yet.
// If the string has a translation for this context to this language,
// save it in the configuration location so it can be looked up faster