Ticket #635 (new enhancement)

Opened 3 months ago

Last modified 2 months ago

Use replacement parameters in Locale functions

Reported by: msi Owned by:
Priority: minor Milestone: Undetermined
Component: -none- Version: SVN
Keywords: locale Cc:

Description

I am not very happy with the changeset 2427. Would it not be better to use a simplified version? The user can have a text and (optional) the domain for backward compatibility

_e( 'A test' );
_e( 'A test', 'mydomain');

If he/she wants to use additional replacement parameters, he/she must use the domain and the parameters go to the end, for example

_e( 'A %s test', 'habari', 'simple' );

I copied my "locale.php" and changed it to use this behaviour. I attach it because I would like to hear your opinion. Maybe one of you guys can take a look and test it.

Attachments

locale.patch (4.5 kB) - added by msi 2 months ago.

Change History

Changed 2 months ago by msi

Changed 2 months ago by msi

I updated my Locale class to reflect your array() stuff. Now it is possible to use your way

_e( 'Hello %s', array( 'world' ) );

and of course the way, I prefer

_e( 'Hello %s', 'habari', 'world' );
Note: See TracTickets for help on using tickets.