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 ('dgettext')) |
| 91 | $translation = dgettext ($domain, $text); # TODO |
| 92 | else { |
| 93 | $translations = &get_translations_for_domain( $domain ); |
| 94 | $translation = $translations->translate( $text, $context ); |
| 95 | } |
| 96 | |
| 97 | 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 ); |
| 254 | if (function_exists ('dngettext')) |
| 255 | $translation = dngettext ($domain, $single, $plural, $number); |
| 256 | else { |
| 257 | $translations = &get_translations_for_domain( $domain ); |
| 258 | $translation = $translations->translate_plural( $single, $plural, $number ); |
| 259 | } |
| 260 | |
252 | | $translations = &get_translations_for_domain( $domain ); |
253 | | $translation = $translations->translate_plural( $single, $plural, $number, $context ); |
| 272 | if (function_exists ('dngettext')) |
| 273 | $translation = dngettext ($domain, $single, $plural, $number); # TODO |
| 274 | else { |
| 275 | $translations = &get_translations_for_domain( $domain ); |
| 276 | $translation = $translations->translate_plural( $single, $plural, $number, $context ); |
| 277 | } |
| 278 | |
| 345 | |
| 346 | // Try to use gettext whenever available |
| 347 | if (function_exists ('bindtextdomain')) { |
| 348 | // Do an automatic setup |
| 349 | $Locale = basename ($mofile, '.mo'); |
| 350 | |
| 351 | if (($p = strrpos ($Locale, '-')) !== false) |
| 352 | $Locale = substr ($Locale, $p + 1); |
| 353 | |
| 354 | if (!is_file ('./wp-lang/' . $Locale . '/LC_MESSAGES/' . $domain . '.mo') && |
| 355 | (is_dir ('./wp-lang/' . $Locale . '/LC_MESSAGES') || mkdir ('./wp-lang/' . $Locale . '/LC_MESSAGES', 0775, true))) |
| 356 | copy ($mofile, './wp-lang/' . $Locale . '/LC_MESSAGES/' . $domain . '.mo'); |
| 357 | |
| 358 | // Configure gettext |
| 359 | bindtextdomain ($domain, './wp-lang/'); |
| 360 | bind_textdomain_codeset ($domain, 'UTF-8'); |
| 361 | |
| 362 | // Register a NOOP-Hanlder for this domain - just to keep consistency |
| 363 | $l10n[$domain] = new NOOP_Translations; |
| 364 | |
| 365 | return true; |
| 366 | } |