Make WordPress Core

Opened 16 years ago

Closed 16 years ago

Last modified 16 years ago

#15985 closed defect (bug) (invalid)

_c (deprecated) by _x

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

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)

#1 @nacin
16 years ago

  • Milestone Awaiting Review
  • Resolution → invalid
  • Status new → 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.

#2 @arena
16 years ago

If you use makepot. Do you have any documentation on this (​http://www.google.fr/search?q=makepot). It seems to be a pattern of some of your tickets

Last edited 16 years ago by arena (previous) (diff)

#4 in reply to: ↑ 3 @arena
16 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

#5 follow-up: @dd32
16 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?

#6 in reply to: ↑ 5 @arena
16 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.