Changeset 2279 in subversion for branches/devel-api/program/include/rcube_plugin.php
- Timestamp:
- Feb 6, 2009 11:33:46 AM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/devel-api/program/include/rcube_plugin.php
r2267 r2279 40 40 $this->api = $api; 41 41 $this->home = $api->dir . DIRECTORY_SEPARATOR . $this->ID; 42 43 $this->init();44 42 } 45 43 … … 59 57 $this->api->register_hook($hook, $callback); 60 58 } 59 60 /** 61 * Load localized texts from the plugins dir 62 * 63 * @param string Directory to search in 64 * @param string Domain to save texts 65 */ 66 public function add_texts($dir) 67 { 68 if (empty($domain)) 69 $domain = $this->ID; 70 71 $lang = $_SESSION['language']; 72 $locdir = slashify(realpath(slashify($this->home) . $dir)); 73 $texts = array(); 74 75 foreach (array('en_US', $lang) as $lng) { 76 @include($locdir . $lng . '.inc'); 77 $texts = (array)$labels + (array)$messages + (array)$texts; 78 } 61 79 80 // prepend domain to text keys and add to the application texts repository 81 if (!empty($texts)) { 82 $add = array(); 83 foreach ($texts as $key => $value) 84 $add[$domain.'.'.$key] = $value; 85 86 $rcmail = rcmail::get_instance(); 87 $rcmail->load_language($lang, $add); 88 } 89 } 90 91 /** 92 * Wrapper for rcmail::gettext() adding the plugin ID as domain 93 */ 94 function gettext($p) 95 { 96 return rcmail::get_instance()->gettext($p, $this->ID); 97 } 98 62 99 /** 63 100 * Register a handler for a specific client-request action
Note: See TracChangeset
for help on using the changeset viewer.
