| 2 | /** |
| 3 | * WordPress Translation API |
| 4 | * |
| 5 | * @package WordPress |
| 6 | * @subpackage i18n |
| 7 | */ |
| 8 | |
| 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 |
| 29 | */ |
| 48 | /** |
| 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. |
| 55 | * |
| 56 | * If the domain is not set, the the $text is just returned. |
| 57 | * |
| 58 | * @since 2.2.0 |
| 59 | * @uses $l10n Gets list of domain translated string (gettext_reader) objects |
| 60 | * @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 |
| 65 | * @return string Translated text |
| 66 | */ |
| 110 | /** |
| 111 | * _c() - Retrieve context translated string |
| 112 | * |
| 113 | * Quite a few times, there will be collisions with similar |
| 114 | * translatable text found in more than two places but with |
| 115 | * different translated context. |
| 116 | * |
| 117 | * In order to use the separate contexts, the _c() function |
| 118 | * is used and the translatable string uses a pipe ('|') |
| 119 | * which has the context the string is in. |
| 120 | * |
| 121 | * When the translated string is returned, it is everything |
| 122 | * before the pipe, not including the pipe character. If |
| 123 | * there is no pipe in the translated text then everything |
| 124 | * is returned. |
| 125 | * |
| 126 | * @since 2.2.0 |
| 127 | * |
| 128 | * @param string $text Text to translate |
| 129 | * @param string $domain Optional. Domain to retrieve the translated text |
| 130 | * @return string Translated context string without pipe |
| 131 | */ |
49 | | // Return the plural form. |
| 142 | /** |
| 143 | * __ngettext() - Retrieve the plural or single form based on the amount |
| 144 | * |
| 145 | * If the domain is not set in the $l10n list, then a comparsion |
| 146 | * will be made and either $plural or $single parameters returned. |
| 147 | * |
| 148 | * If the domain does exist, then the parameters $single, $plural, |
| 149 | * and $number will first be passed to the domain's ngettext method. |
| 150 | * Then it will be passed to the 'ngettext' filter hook along with |
| 151 | * the same parameters. The expected type will be a string. |
| 152 | * |
| 153 | * @since 1.2.0 |
| 154 | * @uses $l10n Gets list of domain translated string (gettext_reader) objects |
| 155 | * @uses apply_filters() Calls 'ngettext' hook on domains text returned, |
| 156 | * along with $single, $plural, and $number parameters. Expected to return string. |
| 157 | * |
| 158 | * @param string $single The text that will be used if $number is 1 |
| 159 | * @param string $plural The text that will be used if $number is not 1 |
| 160 | * @param int $number The number to compare against to use either $single or $plural |
| 161 | * @param string $domain Optional. The domain identifier the text should be retrieved in |
| 162 | * @return string Either $single or $plural translated text |
| 163 | */ |
| 177 | /** |
| 178 | * load_textdomain() - Loads MO file into the list of domains |
| 179 | * |
| 180 | * If the domain already exists, the inclusion will fail. If the |
| 181 | * MO file is not readable, the inclusion will fail. |
| 182 | * |
| 183 | * On success, the mofile will be placed in the $l10n global by |
| 184 | * $domain and will be an gettext_reader object. |
| 185 | * |
| 186 | * @since 1.5.0 |
| 187 | * @uses $l10n Gets list of domain translated string (gettext_reader) objects |
| 188 | * @uses CacheFileReader Reads the MO file |
| 189 | * @uses gettext_reader Allows for retrieving translated strings |
| 190 | * |
| 191 | * @param string $domain Unique identifier for retrieving translated strings |
| 192 | * @param string $mofile Path to the .mo file |
| 193 | * @return null On failure returns null and also on success returns nothing. |
| 194 | */ |
| 227 | /** |
| 228 | * load_plugin_textdomain() - Loads the plugin's translated strings |
| 229 | * |
| 230 | * If the path is not given then it will be the root of the plugin |
| 231 | * directory. The .mo file should be named based on the domain with a |
| 232 | * dash followed by a dash, and then the locale exactly. |
| 233 | * |
| 234 | * The plugin may place all of the .mo files in another folder and set |
| 235 | * the $path based on the relative location from ABSPATH constant. The |
| 236 | * plugin may use the constant PLUGINDIR and/or plugin_basename() to |
| 237 | * get path of the plugin and then add the folder which holds the .mo |
| 238 | * files. |
| 239 | * |
| 240 | * @since 1.5.0 |
| 241 | * |
| 242 | * @param string $domain Unique identifier for retrieving translated strings |
| 243 | * @param string $path Optional. Path of the folder where the .mo files reside. |
| 244 | */ |