Translations
Info
All page names need to be in English.
en da  de  fr  it  ja  km  nl  ru  zh

Blueprints/TranslationSystem

From TYPO3Wiki
Jump to: navigation, search

<- Back to blueprints overview

Blueprint: Translation System

Proposal Add a unified multi-purpose translation system
Owner/Starter Mathias Brodala
Participants/Members -
Status Draft, Discussion, Voting Phase, Accepted, Declined, Withdrawn
Current Progress Unknown, Started, Good Progress, Bad Progress, Stalled, Review Needed
Topic for Gerrit ###gerrit_topic###

Target Versions/Milestones

  • Started during TYPO3 CMS 7 development

Goals / Motivation

Currently translation handling is spread over multiple locations in the core depending on context (backend/frontend) and even runtime environment (Extbase). There is also no general handling for translation placeholders. Support for plural forms is missing completely which makes translation handling e.g. for Russian or Arabic basically impossible. Switching a language at runtime is also not possible without hacks.

Concept

The goal is to have a central location which the TYPO3 core and extensions can use to handle all translation needs.

It must allow for a very easy translation without configuration overhead in extensions which stick to the already established Resources/Private/Language/$language.$file.xlf convention but also allow for a custom setup by allowing to override all default options.

The separate translation handling in backend (locallang_db.xlf) and frontend (locallang.xlf) should unified to avoid duplication of logic and simplify tests.

There should also be a way to access arbitrary translations via JavaScript in the TYPO3 backend and frontend to allow for translations at runtime.

Implementation Details

A TranslatorInterface is added to the core extension which provides all necessary methods:

  1. Customize setup/configuration (locale, translation file path)
  2. Translate by translation ID or source message with optional arguments and switches for variants like: counter for plural forms, gender specific, formal/informal salutation.

A l10n extension is added to TYPO3 which does the following:

  1. Pull in a PHP translation library as dependency to let it take care of the heavy lifting.
  2. Provide a Translator implementing the TranslatorInterface and wrap the translation library API with as little overhead as possible.
  3. Optionally add a LegacyTranslator extending Translator to do some additional processing before/after translation to support existing translations, e.g. by replacing %s placeholders with {0} (depending on translation library)
  4. Add a guide to document moving from existing APIs,

Depending on whether 3. is implemented the existing translation APIs can be deprecated.

Risks

Since this is a new API no breakage is to be expected. If a wrapper for legacy translations with custom processing is added quite some edge cases need to be handled though and should be limited to the TYPO3 core first.

Issues and reviews

none

Dependencies upon other Blueprints

none

External links for clarification of technologies