| 68 | | $translations = &get_translations_for_domain( $domain ); |
| 69 | | return apply_filters( 'gettext', $translations->translate( $text ), $text, $domain ); |
| | 71 | if (function_exists ('dgettext')) |
| | 72 | $translation = dgettext ($domain, $text); |
| | 73 | else { |
| | 74 | $translations = &get_translations_for_domain( $domain ); |
| | 75 | $translation = $translations->translate( $text ); |
| | 76 | } |
| | 77 | |
| | 78 | return apply_filters( 'gettext', $translation, $text, $domain ); |
| 81 | | $translations = &get_translations_for_domain( $domain ); |
| 82 | | return apply_filters( 'gettext_with_context', $translations->translate( $text, $context ), $text, $context, $domain ); |
| | 90 | if (function_exists ('dcgettext')) { |
| | 91 | $translation = dgettext ($domain, $context . "\x04" . $text); |
| | 92 | |
| | 93 | if ($translation == $context . "\x04" . $text) |
| | 94 | $translation = $text; |
| | 95 | } else { |
| | 96 | $translations = &get_translations_for_domain( $domain ); |
| | 97 | $translation = $translations->translate( $text, $context ); |
| | 98 | } |
| | 99 | |
| | 100 | return apply_filters( 'gettext_with_context', $translation, $text, $context, $domain ); |
| 239 | | $translations = &get_translations_for_domain( $domain ); |
| 240 | | $translation = $translations->translate_plural( $single, $plural, $number ); |
| | 257 | if (function_exists ('dngettext')) |
| | 258 | $translation = dngettext ($domain, $single, $plural, $number); |
| | 259 | else { |
| | 260 | $translations = &get_translations_for_domain( $domain ); |
| | 261 | $translation = $translations->translate_plural( $single, $plural, $number ); |
| | 262 | } |
| | 263 | |
| 252 | | $translations = &get_translations_for_domain( $domain ); |
| 253 | | $translation = $translations->translate_plural( $single, $plural, $number, $context ); |
| | 275 | if (function_exists ('dngettext')) { |
| | 276 | $translation = dngettext ($domain, $context . "\x04" . $single, $plural, $number); |
| | 277 | |
| | 278 | if (($translation == $context . "\x04" . $single) || ($translation == $plural)) |
| | 279 | $translation = ($number == 1 ? $single : $plural); |
| | 280 | |
| | 281 | } else { |
| | 282 | $translations = &get_translations_for_domain( $domain ); |
| | 283 | $translation = $translations->translate_plural( $single, $plural, $number, $context ); |
| | 284 | } |
| | 285 | |
| | 367 | |
| | 368 | // Try to use gettext whenever available |
| | 369 | if (function_exists ('bindtextdomain')) { |
| | 370 | // Do an automatic setup |
| | 371 | $Locale = basename ($mofile, '.mo'); |
| | 372 | |
| | 373 | if (($p = strrpos ($Locale, '-')) !== false) |
| | 374 | $Locale = substr ($Locale, $p + 1); |
| | 375 | |
| | 376 | if (!is_file ('./wp-lang/' . $Locale . '/LC_MESSAGES/' . $domain . '.mo') && |
| | 377 | (is_dir ('./wp-lang/' . $Locale . '/LC_MESSAGES') || mkdir ('./wp-lang/' . $Locale . '/LC_MESSAGES', 0775, true))) |
| | 378 | copy ($mofile, './wp-lang/' . $Locale . '/LC_MESSAGES/' . $domain . '.mo'); |
| | 379 | |
| | 380 | // Configure gettext |
| | 381 | bindtextdomain ($domain, './wp-lang/'); |
| | 382 | bind_textdomain_codeset ($domain, 'UTF-8'); |
| | 383 | |
| | 384 | // Register a NOOP-Hanlder for this domain - just to keep consistency |
| | 385 | $l10n[$domain] = new NOOP_Translations; |
| | 386 | |
| | 387 | return true; |
| | 388 | } |