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


PHP Translate::get_translated_data_array方法代码示例

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


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

示例1: add_lang_all

 public function add_lang_all()
 {
     $lang_data_array = array('property_price' => 'Total Price', 'down_payment' => 'Down Payment', 'term_in_years' => 'No of Years', 'annual_interest' => 'Interest Per Year(%)', 'installments_per_year' => 'Installment Per Year', 'monthly_payment' => 'Monthly Payment');
     $this->load->model('admin/system_model');
     $query = $this->system_model->get_all_langs();
     $translator = new Translate();
     foreach ($query->result() as $lang) {
         $translate_array = $translator->get_translated_data_array('en', $lang->short_name, $lang_data_array);
         $prev_data = (array) json_decode($lang->values);
         $prev_data = array_merge($prev_data, $translate_array);
         $translated_data['unique_id'] = $lang->lang . '-' . $lang->short_name;
         $translated_data['lang'] = $lang->lang;
         $translated_data['short_name'] = $lang->short_name;
         $translated_data['values'] = json_encode($prev_data);
         $translated_data['status'] = 1;
         $this->system_model->add_or_update_lang($translated_data);
     }
 }
开发者ID:firastunsi,项目名称:oskon,代码行数:18,代码来源:system_core.php

示例2: translatelang

 public function translatelang()
 {
     ini_set('max_execution_time', 3600);
     $this->load->model('system_model');
     $this->form_validation->set_rules('base_lang', 'base lang', 'required');
     $this->form_validation->set_rules('target_lang_name', 'Taget lang short name', 'required');
     if ($this->form_validation->run() == FALSE) {
         $this->translate();
     } else {
         $base_lang = $this->input->post('base_lang');
         $target_lang_name = $this->input->post('target_lang_name');
         $translator = new Translate();
         $lang_data = $this->system_model->get_language_data($base_lang . '.yml');
         $lang_data_array = $lang_data;
         $translate_array = $translator->get_translated_data_array($base_lang, $target_lang_name, $lang_data_array);
         $this->load->library('yaml');
         $yaml = $this->yaml->dump($translate_array);
         $this->load->helper('file');
         $file_name = $target_lang_name . '.yml';
         if (!write_file('./dbc_config/locals/' . $file_name, $yaml)) {
             $this->session->set_flashdata('msg', '<div class="alert alert-danger">' . lang_key('unable_to_write_file') . '</div>');
         } else {
             $this->session->set_flashdata('msg', '<div class="alert alert-success">' . lang_key('language_translated') . '</div>');
         }
         redirect(site_url('admin/system/translate/'));
     }
 }
开发者ID:Ripudamangithub,项目名称:donopen,代码行数:27,代码来源:system_core.php

示例3: translatelang

 public function translatelang()
 {
     ini_set('max_execution_time', 600);
     $this->load->model('system_model');
     $this->form_validation->set_rules('base_lang', 'base lang', 'required');
     $this->form_validation->set_rules('target_lang_full_name', 'Taget lang full name', 'required');
     $this->form_validation->set_rules('target_lang_short_name', 'Taget lang short name', 'required');
     if ($this->form_validation->run() == FALSE) {
         $this->translate();
     } else {
         $base_lang = $this->input->post('base_lang');
         $target_lang_full_name = $this->input->post('target_lang_full_name');
         $target_lang_short_name = $this->input->post('target_lang_short_name');
         $target_lang = $this->input->post('target_lang');
         $base_seg = explode('-', $base_lang);
         $translator = new Translate();
         $lang_data = $this->system_model->get_language_data($base_lang);
         $lang_data_array = json_decode($lang_data->values);
         $translate_array = $translator->get_translated_data_array($base_seg[1], $target_lang_short_name, $lang_data_array);
         $translated_data['unique_id'] = $target_lang_full_name . '-' . $target_lang_short_name;
         $translated_data['lang'] = $target_lang_full_name;
         $translated_data['short_name'] = $target_lang_short_name;
         $translated_data['values'] = json_encode($translate_array);
         $translated_data['status'] = 1;
         $this->system_model->add_or_update_lang($translated_data);
         $this->session->set_flashdata('msg', '<div class="alert alert-success">Language transalted</div>');
         $this->load->library('yaml');
         $yaml = $this->yaml->dump($translate_array);
         $this->load->helper('file');
         $file_name = $target_lang_short_name . '.yml';
         if (!write_file('./dbc_config/locals/' . $file_name, $yaml)) {
             $this->session->set_flashdata('msg', '<div class="alert alert-danger">Unable to write file</div>');
         } else {
             $this->session->set_flashdata('msg', '<div class="alert alert-success">Language transalted</div>');
         }
         redirect(site_url('admin/system/translate/'));
     }
 }
开发者ID:ageo80,项目名称:test,代码行数:38,代码来源:system_core.php

示例4: test

 function test()
 {
     $translator = new Translate();
     $translator->setLangFrom('en')->setLangTo('es');
     echo $translator->translate('hello');
     $lang_data = array('sign_in' => 'Sign In', 'sign_up' => 'Sign Up');
     $lang_data_array = $lang_data;
     $translate_array = $translator->get_translated_data_array('en', 'ar', $lang_data_array);
     echo '<pre>';
     print_r($translate_array);
     die;
 }
开发者ID:GiovanniV,项目名称:Santa-Barbara-Business-Directory,代码行数:12,代码来源:system_core.php


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