Feature: #108799 - LocalizationRepository methods for fetching record translations
See forge#108799
Description
TYPO3 has historically provided helper methods for localization in various
places in the TYPO3 code. This patch centralizes localization-related functionality by marking
\TYPO3\
as public (non-internal) and adding new methods as modern, DI-friendly
alternatives to the static
Backend methods.
getRecordTranslation()
Fetches a single translated version of a record for a specific language.
public function getRecordTranslation(
string|TcaSchema $tableOrSchema,
int|array|RecordInterface $recordOrUid,
int|LanguageAspect $language,
int $workspaceId = 0,
bool $includeDeletedRecords = false,
): ?RawRecord
getRecordTranslations()
Fetches all translations of a record. This method can also be used to count
translations by using
count on the result, replacing the need for
Backend.
public function getRecordTranslations(
string|TcaSchema $tableOrSchema,
int|array|RecordInterface $recordOrUid,
array $limitToLanguageIds = [],
int $workspaceId = 0,
bool $includeDeletedRecords = false,
): array
Returns an array of translated
Raw
objects indexed by language ID.
getPageTranslations()
Fetches all page translations for a page.
public function getPageTranslations(
int $pageUid,
array $limitToLanguageIds = [],
int $workspaceId = 0,
bool $includeDeletedRecords = false,
): array
Returns an array of page translation records as
Raw objects indexed by language ID.
Impact
Extension developers working with record translations in the TYPO3 backend now have access to modern, injectable repository methods that follow current TYPO3 coding practices.
The legacy static methods
Backend,
Backend, and
Backend remain available for backward
compatibility until they are migrated completely.