Ticket #6938: load_plugin_textdomain-backward-compat.diff
File load_plugin_textdomain-backward-compat.diff, 1.7 KB (added by , 17 years ago) |
---|
-
wp-includes/l10n.php
276 276 * directory. The .mo file should be named based on the domain with a 277 277 * dash followed by a dash, and then the locale exactly. 278 278 * 279 * The plugin may place all of the .mo files in another folder and set280 * the $path based on the relative location from ABSPATH constant. The281 * plugin may use the constant WP_PLUGIN_DIR and/or plugin_basename() to282 * get path of the plugin and then add the folder which holds the .mo283 * files.284 *285 279 * @since 1.5.0 286 280 * 287 281 * @param string $domain Unique identifier for retrieving translated strings 288 * @param string $path Optional. Path of the folder where the .mo files reside. 282 * @param string $abs_rel_path Optional. Relative path to ABSPATH of a folder, 283 * where the .mo file resides. Deprecated, but still functional until 2.7 284 * @param string $plugin_rel_path Optional. Relative path to WP_PLUGIN_DIR. This is the preferred argument to use. It takes precendence over $abs_rel_path 289 285 */ 290 function load_plugin_textdomain($domain, $ path = false) {286 function load_plugin_textdomain($domain, $abs_rel_path = false, $plugin_rel_path = false) { 291 287 $locale = get_locale(); 292 293 if ( false === $path ) 294 $path = ''; 288 289 if ( false !== $plugin_rel_path ) 290 $path = WP_PLUGIN_DIR . '/' . trim( $plugin_rel_path, '/'); 291 else if ( false !== $abs_rel_path) 292 $path = ABSPATH . trim( $abs_rel_path, '/'); 295 293 else 296 $path = '/' . trim(trim($path), '/');294 $path = WP_PLUGIN_DIR; 297 295 298 $mofile = WP_PLUGIN_DIR .$path . '/'. $domain . '-' . $locale . '.mo';296 $mofile = $path . '/'. $domain . '-' . $locale . '.mo'; 299 297 load_textdomain($domain, $mofile); 300 298 } 301 299