Changeset 8782 for trunk/wp-includes/l10n.php
- Timestamp:
- 08/30/2008 09:23:43 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/l10n.php
r8600 r8782 8 8 9 9 /** 10 * get_locale() - Gets the current locale 11 * 12 * If the locale is set, then it will filter the locale 13 * in the 'locale' filter hook and return the value. 14 * 15 * If the locale is not set already, then the WPLANG 16 * constant is used if it is defined. Then it is filtered 17 * through the 'locale' filter hook and the value for the 18 * locale global set and the locale is returned. 19 * 20 * The process to get the locale should only be done once 21 * but the locale will always be filtered using the 22 * 'locale' hook. 23 * 24 * @since 1.5.0 25 * @uses apply_filters() Calls 'locale' hook on locale value 26 * @uses $locale Gets the locale stored in the global 27 * 28 * @return string The locale of the blog or from the 'locale' hook 10 * Gets the current locale. 11 * 12 * If the locale is set, then it will filter the locale in the 'locale' filter 13 * hook and return the value. 14 * 15 * If the locale is not set already, then the WPLANG constant is used if it is 16 * defined. Then it is filtered through the 'locale' filter hook and the value 17 * for the locale global set and the locale is returned. 18 * 19 * The process to get the locale should only be done once but the locale will 20 * always be filtered using the 'locale' hook. 21 * 22 * @since 1.5.0 23 * @uses apply_filters() Calls 'locale' hook on locale value. 24 * @uses $locale Gets the locale stored in the global. 25 * 26 * @return string The locale of the blog or from the 'locale' hook. 29 27 */ 30 28 function get_locale() { … … 47 45 48 46 /** 49 * translate() - Retrieve the translated text 50 * 51 * If the domain is set in the $l10n global, then the text is run 52 * through the domain's translate method. After it is passed to 53 * the 'gettext' filter hook, along with the untranslated text as 54 * the second parameter. 47 * Retrieve the translated text. 48 * 49 * If the domain is set in the $l10n global, then the text is run through the 50 * domain's translate method. After it is passed to the 'gettext' filter hook, 51 * along with the untranslated text as the second parameter. 55 52 * 56 53 * If the domain is not set, the $text is just returned. 57 54 * 58 55 * @since 2.2.0 59 * @uses $l10n Gets list of domain translated string (gettext_reader) objects 56 * @uses $l10n Gets list of domain translated string (gettext_reader) objects. 60 57 * @uses apply_filters() Calls 'gettext' on domain translated text 61 * with the untranslated text as second parameter 62 * 63 * @param string $text Text to translate 64 * @param string $domain Domain to retrieve the translated text 58 * with the untranslated text as second parameter. 59 * 60 * @param string $text Text to translate. 61 * @param string $domain Domain to retrieve the translated text. 65 62 * @return string Translated text 66 63 */ … … 75 72 76 73 /** 77 * translate_with_context() - Retrieve the translated text and strip context 78 * 79 * If the domain is set in the $l10n global, then the text is run 80 * through the domain's translate method. After it is passed to 81 * the 'gettext' filter hook, along with the untranslated text as 82 * the second parameter. 74 * Retrieve the translated text and strip context. 75 * 76 * If the domain is set in the $l10n global, then the text is run through the 77 * domain's translate method. After it is passed to the 'gettext' filter hook, 78 * along with the untranslated text as the second parameter. 83 79 * 84 80 * If the domain is not set, the $text is just returned. … … 102 98 103 99 /** 104 * __() - Retrieve a translated string 105 * 106 * __() is a convenience function which retrieves the translated 107 * string from the translate(). 100 * Retrieves the translated string from the translate(). 108 101 * 109 102 * @see translate() An alias of translate() … … 118 111 } 119 112 120 // . 121 /** 122 * _e() - Display a translated string 123 * 124 * _e() is a convenience function which displays the returned 125 * translated text from translate(). 113 /** 114 * Displays the returned translated text from translate(). 126 115 * 127 116 * @see translate() Echos returned translate() string … … 136 125 137 126 /** 138 * _c() - Retrieve context translated string 139 * 140 * Quite a few times, there will be collisions with similar 141 * translatable text found in more than two places but with 142 * different translated context. 143 * 144 * In order to use the separate contexts, the _c() function 145 * is used and the translatable string uses a pipe ('|') 146 * which has the context the string is in. 147 * 148 * When the translated string is returned, it is everything 149 * before the pipe, not including the pipe character. If 150 * there is no pipe in the translated text then everything 151 * is returned. 127 * Retrieve context translated string. 128 * 129 * Quite a few times, there will be collisions with similar translatable text 130 * found in more than two places but with different translated context. 131 * 132 * In order to use the separate contexts, the _c() function is used and the 133 * translatable string uses a pipe ('|') which has the context the string is in. 134 * 135 * When the translated string is returned, it is everything before the pipe, not 136 * including the pipe character. If there is no pipe in the translated text then 137 * everything is returned. 152 138 * 153 139 * @since 2.2.0 … … 162 148 163 149 /** 164 * __ngettext() - Retrieve the plural or single form based on the amount165 * 166 * If the domain is not set in the $l10n list, then a comparsion 167 * will be madeand either $plural or $single parameters returned.168 * 169 * If the domain does exist, then the parameters $single, $plural, 170 * and $number will first be passed to the domain's ngettext method.171 * Then it will be passed to the 'ngettext' filter hook along with172 * t he same parameters. The expected type will be a string.150 * Retrieve the plural or single form based on the amount. 151 * 152 * If the domain is not set in the $l10n list, then a comparsion will be made 153 * and either $plural or $single parameters returned. 154 * 155 * If the domain does exist, then the parameters $single, $plural, and $number 156 * will first be passed to the domain's ngettext method. Then it will be passed 157 * to the 'ngettext' filter hook along with the same parameters. The expected 158 * type will be a string. 173 159 * 174 160 * @since 1.2.0 … … 197 183 198 184 /** 199 * __ngettext_noop() - register plural strings in POT file, but don't translate them185 * Register plural strings in POT file, but don't translate them. 200 186 * 201 187 * Used when you want do keep structures with translatable plural strings and … … 223 209 224 210 /** 225 * load_textdomain() - Loads MO file into the list of domains226 * 227 * If the domain already exists, the inclusion will fail. If the 228 * MO file is notreadable, the inclusion will fail.229 * 230 * On success, the mofile will be placed in the $l10n global by 231 * $domain and willbe an gettext_reader object.211 * Loads MO file into the list of domains. 212 * 213 * If the domain already exists, the inclusion will fail. If the MO file is not 214 * readable, the inclusion will fail. 215 * 216 * On success, the mofile will be placed in the $l10n global by $domain and will 217 * be an gettext_reader object. 232 218 * 233 219 * @since 1.5.0 … … 261 247 262 248 /** 263 * load_default_textdomain() - Loads default translated strings based on locale264 * 265 * Loads the .mo file in WP_LANG_DIR constant path from WordPress root. 266 * Thetranslated (.mo) file is named based off of the locale.249 * Loads default translated strings based on locale. 250 * 251 * Loads the .mo file in WP_LANG_DIR constant path from WordPress root. The 252 * translated (.mo) file is named based off of the locale. 267 253 * 268 254 * @since 1.5.0 … … 277 263 278 264 /** 279 * load_plugin_textdomain() - Loads the plugin's translated strings280 * 281 * If the path is not given then it will be the root of the plugin 282 * directory. The .mo file should be named based on the domain witha283 * dash followed by a dash, and then the locale exactly.265 * Loads the plugin's translated strings. 266 * 267 * If the path is not given then it will be the root of the plugin directory. 268 * The .mo file should be named based on the domain with a dash followed by a 269 * dash, and then the locale exactly. 284 270 * 285 271 * @since 1.5.0 … … 305 291 306 292 /** 307 * load_theme_textdomain() - Includes theme's translated strings for the theme293 * Loads the theme's translated strings. 308 294 * 309 295 * If the current locale exists as a .mo file in the theme's root directory, it
Note: See TracChangeset
for help on using the changeset viewer.