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