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


PHP Translation类代码示例

本文整理汇总了PHP中Translation的典型用法代码示例。如果您正苦于以下问题:PHP Translation类的具体用法?PHP Translation怎么用?PHP Translation使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: run_create_translation

function run_create_translation($args, $opts)
{
    G::LoadSystem('inputfilter');
    $filter = new InputFilter();
    $opts = $filter->xssFilterHard($opts);
    $args = $filter->xssFilterHard($args);
    $rootDir = realpath(__DIR__."/../../../../");
    $app = new Maveriks\WebApplication();
    $app->setRootDir($rootDir);
    $loadConstants = false;

    $workspaces = get_workspaces_from_args($args);
    $lang = array_key_exists("lang", $opts) ? $opts['lang'] : 'en';

    $translation = new Translation();
    CLI::logging("Updating labels Mafe ...\n");
    foreach ($workspaces as $workspace) {
        try {
            echo "Updating labels for workspace " . pakeColor::colorize($workspace->name, "INFO") . "\n";
            $translation->generateTransaltionMafe($lang);
        } catch (Exception $e) {
            echo "Errors upgrading labels for workspace " . CLI::info($workspace->name) . ": " . CLI::error($e->getMessage()) . "\n";
        }
    }

    CLI::logging("Create successful\n");

}
开发者ID:hpx2206,项目名称:processmaker-1,代码行数:28,代码来源:cliMafe.php

示例2: storeTranslation

 public function storeTranslation($data, $locale = null, $options = [])
 {
     if (!$locale) {
         $locale = config('app.locale');
     }
     $translation = new Translation();
     return $translation->store($this, $locale, $data, $options);
 }
开发者ID:escapework,项目名称:laravel-translations,代码行数:8,代码来源:Translatable.php

示例3: translate

 public static function translate($key_phrase)
 {
     $tTable = new Translation();
     $select = $tTable->select()->where("key_phrase = '{$key_phrase}'");
     $db_phrase = $tTable->fetchRow($select)->phrase;
     if (ITechTranslate::getLocale() == 'en_EN.UTF-8') {
         return $db_phrase;
     } else {
         return t($db_phrase);
     }
 }
开发者ID:falafflepotatoe,项目名称:trainsmart-code,代码行数:11,代码来源:Translation.php

示例4: run

 public function run()
 {
     if (Yii::app()->request->getPost('translate')) {
         //переклади в таблиці translation
         $model = new Translation();
         $model->object = Yii::app()->request->getPost('table');
         $row = Yii::app()->request->getPost('translate');
         $subject = Yii::app()->request->getPost('column');
         $exist = $model->findByPk(Yii::app()->request->getPost('tr_id'));
         if ($exist) {
             $compare = $model->findByAttributes(array('translate' => $row));
             if ($compare) {
                 echo CJSON::encode(array('status' => 'error'));
                 Yii::app()->end();
             }
             $model = $exist;
         }
         $model->subject = $subject;
         $model->row_id = Yii::app()->request->getPost('row_id');
         $model->lan_id = Yii::app()->request->getPost('lan_id');
         $model->translate = Yii::app()->request->getPost('translate');
         if ($lastId = $model->Add()) {
             echo CJSON::encode(array('status' => 'success', 'tr_id' => $lastId));
             Yii::app()->end();
         }
     } else {
         //перекладаєм оригінальний текст
         $table = ucfirst(Yii::app()->request->getPost('table'));
         $object = new $table();
         $subject = Yii::app()->request->getPost('column');
         $row = Yii::app()->request->getPost('row');
         $row_id = Yii::app()->request->getPost('row_id');
         $object->setAttribute($subject, $row);
         $exist = $object->findByPk($row_id);
         if ($exist) {
             $compare = $object->findByAttributes(array($subject => $row));
             if ($compare) {
                 echo CJSON::encode(array('status' => 'error'));
                 Yii::app()->end();
             }
             $object = $exist;
         } else {
             echo CJSON::encode(array('status' => 'error'));
         }
         $object->{$subject} = Yii::app()->request->getPost('row');
         if ($object->Add()) {
             echo CJSON::encode(array('status' => 'success'));
             Yii::app()->end();
         }
     }
     echo CJSON::encode(array('status' => 'error'));
     Yii::app()->end();
 }
开发者ID:vasia-ostapchuk,项目名称:source,代码行数:53,代码来源:TranslateAction.php

示例5: testConstruct

 public function testConstruct()
 {
     try {
         $dataObject = new Translation(array('invalid' => 'foo'));
         $this->fail('Expected \\UnexpectedValueException exception not thrown.');
     } catch (\UnexpectedValueException $e) {
     }
     $dataObject = new Translation(array('translatedText' => 'foo'));
     $this->assertEquals($dataObject->getTranslatedText(), 'foo');
     $this->assertNull($dataObject->getDetectedSourceLanguage());
     $dataObject = new Translation(array('translatedText' => 'foo', 'detectedSourceLanguage' => 'bar'));
     $this->assertEquals($dataObject->getTranslatedText(), 'foo');
     $this->assertEquals($dataObject->getDetectedSourceLanguage(), 'bar');
 }
开发者ID:jiangxilong,项目名称:google-apis-php-clients,代码行数:14,代码来源:TranslationTest.php

示例6: get_Schedule

 function get_Schedule($id, $ident)
 {
     global $globalDebug;
     // Get schedule here, so it's done only one time
     $Connection = new Connection();
     $dbc = $Connection->db;
     $Spotter = new Spotter($dbc);
     $Schedule = new Schedule($dbc);
     $Translation = new Translation($dbc);
     $operator = $Spotter->getOperator($ident);
     if ($Schedule->checkSchedule($operator) == 0) {
         $operator = $Translation->checkTranslation($ident);
         if ($Schedule->checkSchedule($operator) == 0) {
             $schedule = $Schedule->fetchSchedule($operator);
             if (count($schedule) > 0) {
                 if ($globalDebug) {
                     echo "-> Schedule info for " . $operator . " (" . $ident . ")\n";
                 }
                 $this->all_flights[$id] = array_merge($this->all_flights[$id], array('departure_airport_time' => $schedule['DepartureTime']));
                 $this->all_flights[$id] = array_merge($this->all_flights[$id], array('arrival_airport_time' => $schedule['ArrivalTime']));
                 // FIXME : Check if route schedule = route from DB
                 if ($schedule['DepartureAirportIATA'] != '') {
                     if ($this->all_flights[$id]['departure_airport'] != $Spotter->getAirportIcao($schedule['DepartureAirportIATA'])) {
                         $airport_icao = $Spotter->getAirportIcao($schedule['DepartureAirportIATA']);
                         if ($airport_icao != '') {
                             $this->all_flights[$id]['departure_airport'] = $airport_icao;
                             if ($globalDebug) {
                                 echo "-> Change departure airport to " . $airport_icao . " for " . $ident . "\n";
                             }
                         }
                     }
                 }
                 if ($schedule['ArrivalAirportIATA'] != '') {
                     if ($this->all_flights[$id]['arrival_airport'] != $Spotter->getAirportIcao($schedule['ArrivalAirportIATA'])) {
                         $airport_icao = $Spotter->getAirportIcao($schedule['ArrivalAirportIATA']);
                         if ($airport_icao != '') {
                             $this->all_flights[$id]['arrival_airport'] = $airport_icao;
                             if ($globalDebug) {
                                 echo "-> Change arrival airport to " . $airport_icao . " for " . $ident . "\n";
                             }
                         }
                     }
                 }
                 $Schedule->addSchedule($operator, $this->all_flights[$id]['departure_airport'], $this->all_flights[$id]['departure_airport_time'], $this->all_flights[$id]['arrival_airport'], $this->all_flights[$id]['arrival_airport_time'], $schedule['Source']);
             }
         }
     }
     //$Connection->db = null;
 }
开发者ID:sysrun,项目名称:FlightAirMap,代码行数:49,代码来源:class.SpotterImport.php

示例7: __construct

 public function __construct($door = "")
 {
     //iniciando a config básico, a menos que exita outro config, este vai ser o que vai ficar valendo
     $domain = Navigation::getURIDomain();
     if ($door) {
         //use em $door ":8080" por exemplo
         $domain = str_replace($door, "", $domain);
     }
     include "configs/" . $domain . "/config.php";
     //se não foi passado algum locale na url apos o nome do site faz um redirect passando o locale padrão
     $folders_array = Navigation::getURI(Config::getAliasFolder(), Navigation::URI_RETURN_TYPE_ARRAY);
     $locale = Config::getLocale();
     Translation::setLocale($locale);
     //inicia e pega resultado da controller
     $this->HttpResult = $this->getControllerResult();
     //agora verifica que tipo de retorno esperado e chama a view, se for o caso
     $ignore_name = Config::getAliasFolder();
     if (Config::getLocale()) {
         $ignore_name .= "/" . Config::getLocale();
     }
     //url com trata com regras de rota
     $url = explode("/", Config::rewriteUrl(Navigation::getURI($ignore_name, Navigation::URI_RETURN_TYPE_STRING)));
     $retornoDaView = self::searchFile($url, Config::getFolderView());
     if ($retornoDaView->success) {
         //echo Debug::li("retornoDaView:".$retornoDaView->urlToInclude);
         $this->view = $retornoDaView->urlToInclude;
     } else {
         $this->view = Config::getFolderView() . "/index.php";
     }
 }
开发者ID:reytuty,项目名称:facil,代码行数:30,代码来源:HttpRequestController.php

示例8: initialize

 public function initialize($session, $force = false)
 {
     if (!$session->has('translateEngine') || $session->get('translateEngine') == null || $force) {
         $this->translations = \Translation::find("INSTR(lang,'" . $this->language . "')>0");
         $session->set('translateEngine', $this);
     }
 }
开发者ID:jcheron,项目名称:phalcon-jquery-website,代码行数:7,代码来源:TranslateEngine.php

示例9: smarty_block_translation

/**
 * Translate a string
 */
function smarty_block_translation($params, $content, $smarty, &$repeat)
{
    return $content;
    if ($content !== null) {
        return Translation::translate($content, $smarty->tpl_vars['env']->value['translation']);
    }
}
开发者ID:tigron,项目名称:skeleton-template-smarty,代码行数:10,代码来源:smarty_extensions.php

示例10: __construct

 public function __construct()
 {
     //iniciando a config básico, a menos que exita outro config, este vai ser o que vai ficar valendo
     include "configs/" . str_replace(":8888", "", Navigation::getURIDomain()) . "/config.php";
     //se não foi passado algum locale na url apos o nome do site faz um redirect passando o locale padrão
     //echo Debug::li(Config::getAliasFolder());
     $folders_array = Navigation::getURI(Config::getAliasFolder(), Navigation::URI_RETURN_TYPE_ARRAY);
     //echo Debug::li(Config::getRootApplication());
     //$folders_array = Navigation::getURI(Config::getAliasFolder(), Navigation::URI_RETURN_TYPE_ARRAY);
     $locale = Config::getLocale();
     Translation::setLocale($locale);
     //inicia e pega resultado da controller
     $this->HttpResult = $this->getControllerResult();
     //agora verifica que tipo de retorno esperado e chama a view, se for o caso
     $ignore_name = Config::getAliasFolder();
     if (Config::getLocale()) {
         $ignore_name .= "/" . Config::getLocale();
     }
     //url com trata com regras de rota
     $url = explode("/", Config::rewriteUrl(Navigation::getURI($ignore_name, Navigation::URI_RETURN_TYPE_STRING)));
     $retornoDaView = self::searchFile($url, Config::getFolderView());
     //Navigation::searchFileOrFolder(Config::getRootApplication()."/".Config::getLocale(), Config::getFolderView(), Navigation::SEARCH_FILE_MODE_FILE);
     //echo Debug::li("retornoDaView");
     //Debug::print_r($retornoDaView);
     if ($retornoDaView->success) {
         //echo Debug::li("retornoDaView:".$retornoDaView->urlToInclude);
         $this->view = $retornoDaView->urlToInclude;
     } else {
         $this->view = Config::getFolderView() . "/index.php";
     }
     //exit();
     //Debug::print_r("[SEARCH_FILE_MODE_CLASS_AND_METHOD]:".Navigation::searchFileOrFolder(Config::FOLDER_ROOT_APPLICATION, "view/democrart/", Navigation::SEARCH_FILE_MODE_CLASS_AND_METHOD, "", TRUE));
 }
开发者ID:reytuty,项目名称:facil,代码行数:33,代码来源:HttpRequestController.php

示例11: showLangModal

 public function showLangModal()
 {
     $language = Yii::app()->params['language'];
     $this->beginWidget('bootstrap.widgets.TbModal', array('id' => $this->modalId, 'htmlOptions' => array('style' => 'margin-top:-200px;', 'backdrop' => 'static')));
     echo "<div class=\"modal-header\">\n                <h4 style=\"width:30%;display: inline-block;\">翻译</h4> \n                <span id='" . $this->modalId . "message' style=\"margin-left:30px;color:red;\"></span>\n            </div>";
     echo "<div id='" . $this->modalId . "ModalBody' class=\"modal-body\" style=\"text-align:center\">";
     $tableName = $this->model->tableName();
     $attribute = $this->attribute;
     echo CHtml::hiddenField('tableName', $tableName);
     echo CHtml::hiddenField('attribute', $attribute);
     $pk = $this->model->primaryKey;
     echo CHtml::activeHiddenField($this->model, $this->model->pk, array('name' => 'pk'));
     $result = Translation::model()->find('model=:tableName and pk=:pk and attribute=:attribute', array(':tableName' => $tableName, ':pk' => $pk, ':attribute' => $attribute));
     $data = json_decode($result->data);
     foreach ($language as $key => $value) {
         if (strtolower($key) == 'zh_cn') {
             continue;
         }
         echo "<div><span style='width:80px !important;display: inline-block;'>" . $value . '</span>' . CHtml::textField($key, $data->{$key}) . "</div>";
     }
     echo "</div>";
     echo "<div class=\"modal-footer\" style=\"text-align: center;\">";
     $this->widget('bootstrap.widgets.TbButton', array('buttonType' => 'button', 'type' => 'info', 'label' => '保存', 'htmlOptions' => array('id' => $this->modalId . 'save')));
     echo "&nbsp;";
     $this->widget('bootstrap.widgets.TbButton', array('buttonType' => 'button', 'label' => '取消', 'htmlOptions' => array("data-dismiss" => "modal", 'id' => $this->modalId . 'back')));
     echo "</div>";
     $this->endWidget();
 }
开发者ID:GsHatRed,项目名称:Yiitest,代码行数:28,代码来源:TTranslate.php

示例12: __construct

 public function __construct()
 {
     if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
         $lang = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2);
     } else {
         $lang = "en";
     }
     switch ($lang) {
         case "de":
             include PATH . "inc/language_de.php";
             Translation::$languageDict = $_;
             unset($_);
             break;
         case "en":
             include PATH . "inc/language_en.php";
             Translation::$languageDict = $_;
             unset($_);
             break;
         default:
             include PATH . "inc/language_en.php";
             Translation::$languageDict = $_;
             unset($_);
             break;
     }
 }
开发者ID:iekadou,项目名称:lightpainting,代码行数:25,代码来源:Translation.php

示例13: _n

/**
 * Retrieve the singular or plural translation of the string.
 *
 * @since 2.2
 *
 * @param string $single_key
 * @param string $plural_key
 * @param int $count
 * @param string $domain
 * @return string
 */
function _n($single_key, $plural_key, $count, $domain = 'core')
{
    $gt = Translation::newInstance()->_get($domain);
    if (!$gt) {
        return $key;
    }
    return $gt->ngettext($single_key, $plural_key, $count);
}
开发者ID:acharei,项目名称:OSClass,代码行数:19,代码来源:hTranslations.php

示例14: __construct

 public function __construct()
 {
     parent::__construct();
     $this->http_header->setTitle(Translation::text("A maior galeria de arte do Brasil em edição limitada, numerada e assinada de quadros, gravuras e fotografias. Decore com arte."));
     $this->http_header->setDescription(Translation::text("A maior galeria de arte do Brasil em edição limitada, numerada e assinada de quadros, gravuras e fotografias. Decore com arte."));
     $this->http_header->getKeywords(Translation::text("quadros gravuras,quadros online,venda quadros,desenhos,venda de quadros,reproduções,artes,comprar gravuras,comprar quadros,gravura,gravuras,loja quadros,quadros,decoração de interiores quartos,decoração de ambientes interiores,decoração de interiores salas,arte moderna,quadros decorativos,papel de parede decoração de interiores,dicas de decoração para quartos,papel de parede para quarto de bebe,papel de parede decoração quarto,lojas decoração interiores,decoração de paredes interiores,revista de decoração de interiores,fotos decoração de sala,dicas de decoração de interiores,decoração design de interiores,pintura em tela a oleo,pintura em tela,objetos de decoração para sala,quadros de parede,quarto de bebe,gravuras para quadros,adesivos decorativos de parede,papel de parede,papel de parede para quarto,quartos de bebe decorados,galerias de arte sp,molduras para quadros,sites de decoração de interiores,galeria de arte virtual,galerias de arte rio de janeiro,ideias decoração interiores,site de decoração de casas,adesivos de parede,decoração de interiores cozinha,decoração de quarto infantil menina,quadros em mdf,adesivos decoração interiores,quadros abstratos modernos,quadros pintura abstrata,decoração parede quarto,quadros para quarto de bebe,decoração interiores sala estar,decoração pintura parede,quadros pintura em tela,decoração festa junina infantil,adesivos de parede infantil,papel de parede para quarto infantil,quadros para quarto de casal,quarto de menina,galeria arte quadros,pintura quarto de bebe,quadro de fotos,papel de parede infantil,moveis para quarto de bebe,decoração de interiores banheiros,objetos de decoração de interiores,decoração de quarto de bebe com papel de parede,fotos de decoração de cozinha,adesivos de parede para quarto de bebe,\r\ndecoração de ambientes casa,cortinas para quarto de bebe,quadro de avisos,loja de quadros,decoração cozinhas planejadas,dicas de decoração de sala,decoração textura parede,decoração parede sala,quartos decorados,site de decoração de quartos,objetos de decoração para quarto,decoração de interiores de apartamentos,pintura em tela abstrato,quadros pintados,cozinha americana decoração,rei dos quadros,adesivos de parede tok stok,quarto de bebe menina,moveis e decoração de casas,adesivos decorativos,pintura de parede,quarto infantil,festa infantil,fotos de decoração de banheiros,papel de parede decorativo,quadros para decoração de sala,quadros decorativos para sala"));
     $this->arrayProducts = array();
 }
开发者ID:reytuty,项目名称:facil,代码行数:8,代码来源:HttpClientRegister.class.php

示例15: _n

/**
 * Retrieve the singular or plural translation of the string.
 *
 * @since 2.2
 *
 * @param string $single_key
 * @param string $plural_key
 * @param int $count
 * @param string $domain
 * @return string
 */
function _n($single_key, $plural_key, $count, $domain = 'core')
{
    $gt = Translation::newInstance()->_get($domain);
    if (!$gt) {
        return $key;
    }
    $string = $gt->ngettext($single_key, $plural_key, $count);
    return osc_apply_filter('ngettext', $string);
}
开发者ID:semul,项目名称:Osclass,代码行数:20,代码来源:hTranslations.php


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