designs2/translator

多用途翻译管理器和界面

安装: 54

依赖者: 1

建议者: 0

安全: 0

星标: 0

关注者: 1

分支: 2

类型:contao-module

2.0.0 2015-07-01 15:29 UTC

This package is not auto-updated.

Last update: 2024-10-02 17:19:34 UTC


README

Build Status

Contao社区联盟翻译库允许轻松使用各种翻译字符串源。

它包含一系列各种翻译字符串提供者

  • 在运行时由代码填充的静态值(StaticTranslator)。
  • Contao CMS语言字符串数组适配器(LangArrayTranslator)。

此外,它还提供了一种使用翻译链的机制,可以通过它堆叠各种翻译器。

使用方法

它集成到Contao CMS中,提供翻译服务。要使用它,只需从依赖容器获取服务。

<?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');  

已知限制

  • 我们目前还没有手册。太遗憾了! :/
  • 我们还没有对所有内容进行测试,所以请亲自尝试一下。