當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。