[ Index ] |
|
Code source de PRADO 3.0.6 |
1 <?php 2 3 /** 4 * IMessageSource interface file. 5 * 6 * This program is free software; you can redistribute it and/or modify 7 * it under the terms of the BSD License. 8 * 9 * Copyright(c) 2004 by Qiang Xue. All rights reserved. 10 * 11 * To contact the author write to {@link mailto:qiang.xue@gmail.com Qiang Xue} 12 * The latest version of PRADO can be obtained from: 13 * {@link http://prado.sourceforge.net/} 14 * 15 * @author Wei Zhuo <weizhuo[at]gmail[dot]com> 16 * @version $Revision: 1.3 $ $Date: 2005/01/09 22:15:32 $ 17 * @package System.I18N.core 18 */ 19 20 /** 21 * IMessageSource interface. 22 * 23 * All messages source used by MessageFormat must be of IMessageSource. 24 * It defines a set of operations to add and retrive messages from the 25 * message source. In addition, message source can load a particular 26 * catalogue. 27 * 28 * @author Xiang Wei Zhuo <weizhuo[at]gmail[dot]com> 29 * @version v1.0, last update on Fri Dec 24 17:40:19 EST 2004 30 * @package System.I18N.core 31 */ 32 interface IMessageSource 33 { 34 /** 35 * Load the translation table for this particular catalogue. 36 * The translation should be loaded in the following order. 37 * # [1] call getCatalogeList($catalogue) to get a list of 38 * variants for for the specified $catalogue. 39 * # [2] for each of the variants, call getSource($variant) 40 * to get the resource, could be a file or catalogue ID. 41 * # [3] verify that this resource is valid by calling isValidSource($source) 42 * # [4] try to get the messages from the cache 43 * # [5] if a cache miss, call load($source) to load the message array 44 * # [6] store the messages to cache. 45 * # [7] continue with the foreach loop, e.g. goto [2]. 46 * 47 * @param string a catalogue to load 48 * @return boolean true if loaded, false otherwise. 49 */ 50 function load($catalogue = 'messages'); 51 52 /** 53 * Get the translation table. This includes all the loaded sections. 54 * It must return a 2 level array of translation strings. 55 * # "catalogue+variant" the catalogue and its variants. 56 * # "source string" translation keys, and its translations. 57 * <code> 58 * array('catalogue+variant' => 59 * array('source string' => 'target string', ...) 60 * ...), 61 * ...); 62 * </code> 63 * 64 * @return array 2 level array translation table. 65 */ 66 function read(); 67 68 /** 69 * Save the list of untranslated blocks to the translation source. 70 * If the translation was not found, you should add those 71 * strings to the translation source via the <b>append()</b> method. 72 * @param string the catalogue to add to 73 * @return boolean true if saved successfuly, false otherwise. 74 */ 75 function save($catalogue='messages'); 76 77 /** 78 * Add a untranslated message to the source. Need to call save() 79 * to save the messages to source. 80 * @param string message to add 81 * @return void 82 */ 83 function append($message); 84 85 /** 86 * Delete a particular message from the specified catalogue. 87 * @param string the source message to delete. 88 * @param string the catalogue to delete from. 89 * @return boolean true if deleted, false otherwise. 90 */ 91 function delete($message, $catalogue='messages'); 92 93 /** 94 * Update the translation. 95 * @param string the source string. 96 * @param string the new translation string. 97 * @param string comments 98 * @param string the catalogue of the translation. 99 * @return boolean true if translation was updated, false otherwise. 100 */ 101 function update($text, $target, $comments, $catalogue='messages'); 102 103 /** 104 * Returns a list of catalogue as key and all it variants as value. 105 * @return array list of catalogues 106 */ 107 function catalogues(); 108 109 /** 110 * Set the culture for this particular message source. 111 * @param string the Culture name. 112 */ 113 function setCulture($culture); 114 115 /** 116 * Get the culture identifier for the source. 117 * @return string culture identifier. 118 */ 119 function getCulture(); 120 121 } 122 123 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Sun Feb 25 21:07:04 2007 | par Balluche grâce à PHPXref 0.7 |