designs2/translator

Multipurpose translation manager and interface

Installs: 55

Dependents: 1

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 2

Type:contao-module

2.0.0 2015-07-01 15:29 UTC

This package is not auto-updated.

Last update: 2024-11-13 17:53:44 UTC


README

Build Status

The Contao Community Alliance translation library allows easy use of various translation string sources.

It ships with a collection of various translation string providers:

  • Static values that get populated during runtime by code (StaticTranslator).
  • Adapter for Contao CMS language string arrays (LangArrayTranslator).

In addition it also provides a translator chain using which various translators can be stacked.

Usage:

It integrates into the Contao CMS providing a translator service. To use it, just get the service from the dependency container:

<?php

/** @var ContaoCommunityAlliance\Translator\TranslatorInterface */
$translator = $GLOBALS['container']['translator'];

// Get the translation of yes from the MSC domain.
$translated = $translator->translate('yes', 'MSC');

// Sub arrays known in Contao can be accessed usng the dot as separator.
$translated = $translator->translate('title.0', 'tl_content');  

Known limitations:

  • We have no manual so far. Bummer! :/
  • We have not tested it all yet, so please give it a try yourself.