当前位置: 首页>>代码示例>>PHP>>正文


PHP Tinebase_Translation::getAvailableTranslations方法代码示例

本文整理汇总了PHP中Tinebase_Translation::getAvailableTranslations方法的典型用法代码示例。如果您正苦于以下问题:PHP Tinebase_Translation::getAvailableTranslations方法的具体用法?PHP Tinebase_Translation::getAvailableTranslations怎么用?PHP Tinebase_Translation::getAvailableTranslations使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Tinebase_Translation的用法示例。


在下文中一共展示了Tinebase_Translation::getAvailableTranslations方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testCustomTranslations

    public function testCustomTranslations()
    {
        $lang = 'en_GB';
        $translationPath = Tinebase_Core::getTempDir() . "/tine20/translations";
        Tinebase_Config::getInstance()->translations = $translationPath;
        $translationDir = "{$translationPath}/{$lang}/Tinebase/translations";
        @mkdir($translationDir, 0777, TRUE);
        $poFile = "{$translationDir}/{$lang}.po";
        $poData = 'msgid ""
msgstr ""
"Project-Id-Version: Tine 2.0 - Tinebase\\n"
"POT-Creation-Date: 2008-05-17 22:12+0100\\n"
"PO-Revision-Date: 2008-07-29 21:14+0100\\n"
"Last-Translator: Cornelius Weiss <c.weiss@metaways.de>\\n"
"Language-Team: Tine 2.0 Translators\\n"
"MIME-Version: 1.0\\n"
"Content-Type: text/plain; charset=UTF-8\\n"
"Content-Transfer-Encoding: 8bit\\n"
"X-Poedit-Language: en\\n"
"X-Poedit-Country: US\\n"
"X-Poedit-SourceCharset: utf-8\\n"
"Plural-Forms: nplurals=2; plural=n != 1;\\n"
"X-Tine20-Language: My Language\\n"
"X-Tine20-Country: MY REGION\\n"

#: Acl/Rights/Abstract.php:75
msgid "run"
msgstr "изпълни"
';
        file_put_contents($poFile, $poData);
        $availableTranslations = Tinebase_Translation::getAvailableTranslations();
        foreach ($availableTranslations as $langInfo) {
            if ($langInfo['locale'] == $lang) {
                $customInfo = $langInfo;
            }
        }
        // assert cutom lang is available
        $this->assertTrue(isset($customInfo), 'custom translation not in list of available translations');
        $this->assertEquals('My Language', $customInfo['language'], 'custom language param missing');
        $this->assertEquals('MY REGION', $customInfo['region'], 'custom region param missing');
        // test the translation
        $translation = Tinebase_Translation::getTranslation('Tinebase', new Zend_Locale($lang));
        // NOTE: Zent_Translate does not work with .po files
        //$this->assertEquals("изпълни", $translation->_('run'));
        $jsTranslations = Tinebase_Translation::getJsTranslations($lang, 'Tinebase');
        $this->assertEquals(1, preg_match('/изпълни/', $jsTranslations));
        Tinebase_Core::setupUserLocale();
    }
开发者ID:hernot,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:48,代码来源:TranslationTest.php

示例2: _getSpecialOptions

 /**
  * overwrite this to add more special options for other apps
  *
  * - result array has to have the following format:
  *  array(
  *      array('value1', 'label1'),
  *      array('value2', 'label2'),
  *      ...
  *  )
  *
  * @param string $_value
  * @return array
  *
  * @todo add application title translations?
  */
 protected function _getSpecialOptions($_value)
 {
     $result = array();
     switch ($_value) {
         case Tinebase_Preference::TIMEZONE:
             $locale = Tinebase_Core::get(Tinebase_Core::LOCALE);
             $availableTimezonesTranslations = Zend_Locale::getTranslationList('citytotimezone', $locale);
             $availableTimezones = DateTimeZone::listIdentifiers();
             foreach ($availableTimezones as $timezone) {
                 $result[] = array($timezone, $timezone);
             }
             break;
         case Tinebase_Preference::LOCALE:
             $availableTranslations = Tinebase_Translation::getAvailableTranslations();
             foreach ($availableTranslations as $lang) {
                 $region = !empty($lang['region']) ? ' / ' . $lang['region'] : '';
                 $result[] = array($lang['locale'], $lang['language'] . $region);
             }
             break;
         case Tinebase_Preference::DEFAULT_APP:
             $applications = Tinebase_Application::getInstance()->getApplications();
             foreach ($applications as $app) {
                 if ($app->status == 'enabled' && $app->name != 'Tinebase' && Tinebase_Core::getUser()->hasRight($app->name, Tinebase_Acl_Rights_Abstract::RUN)) {
                     $result[] = array($app->name, $app->name);
                 }
             }
             break;
         default:
             $result = parent::_getSpecialOptions($_value);
             break;
     }
     return $result;
 }
开发者ID:ingoratsdorf,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:48,代码来源:Preference.php


注:本文中的Tinebase_Translation::getAvailableTranslations方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。