Add syntactic sugar for translating non-english source strings

Created on 28 January 2023, almost 2 years ago
Updated 30 October 2023, about 1 year ago

Problem/Motivation

From #3336532-3: General feedback on MultiLangNG-Translations : https://www.drupal.org/sandbox/reyero/3337204

There is the wish to have syntactic sugar for non-english source languages in code.

Let's leave open how source language is stored (own field or in $context).
What about extending the translation service and doing a variant of the RIAA pattern:

$srcLangPreset = $this->languagePresetService->setSrcLangPreset('es');
// We're translating spanish sources.
print t('Chili habanero');
...
unset($srcLangPreset);
// When the preset is deleted or out of scope, we're back at english.
print t('Big mac');

Proposed resolution

Remaining tasks

📌 Task
Status

Closed: duplicate

Version

1.0

Component

Code

Created by

🇩🇪Germany geek-merlin Freiburg, Germany

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024