WordPress.org

Make WordPress Core

Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#15985 closed defect (bug) (invalid)

_c (deprecated) by _x

Reported by: arena Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.1
Component: I18N Keywords:
Focuses: Cc:

Description

_x is declaring _c as deprecated, however _x and _c are not doing the same thing

reminder :

function _c( $text, $domain = 'default' ) {
    _deprecated_function( __FUNCTION__, '2.9', '_x()' );
    return before_last_bar( translate( $text, $domain ) );
}
function _x( $single, $context, $domain = 'default' ) {
    return translate_with_gettext_context( $single, $context, $domain );
}

_x should clean up the string calling : before_last_bar()

after analysing the code, i really do not understand how the $context variable is handled as it is not present in the po/mo files

thank you for your explanations

Change History (6)

comment:1 nacin3 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to invalid
  • Status changed from new to closed

The old way of adding context to strings was to use a bar. For example, _c('Post|noun'). The translators would keep the bar in and _c() would strip off everything after the last bar.

We now use gettext context, thus it is a separate argument. It's not a drop-in replacement, as what would go after a bar instead needs to be its own argument.

If you use makepot, the context will carry into the various files.

Tickets are not the correct place to ask these questions. It seems to be a pattern of some of your tickets. That's okay, but you'd be better off trying a mailing list or IRC.

comment:2 arena3 years ago

If you use makepot. Do you have any documentation of this. It seems to be a pattern of some of your tickets

Version 0, edited 3 years ago by arena (next)

comment:4 in reply to: ↑ 3 arena3 years ago

Replying to nacin:

http://codex.wordpress.org/I18n_for_WordPress_Developers#Generating_a_POT_file

unfortunately my plugin has some text in xml files so i am afraid this is not supported by makepot.php

comment:5 follow-up: dd323 years ago

unfortunately my plugin has some text in xml files so i am afraid this is not supported by makepot.php

And how is it supported by WordPress's translation functions then?

comment:6 in reply to: ↑ 5 arena3 years ago

Replying to dd32:

unfortunately my plugin has some text in xml files so i am afraid this is not supported by makepot.php

And how is it supported by WordPress's translation functions then?

@dd32 see http://wordpress.org/extend/plugins/mailpress

Note: See TracTickets for help on using tickets.