PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » File Formats » File_Gettext » Bug #4989

Problem dealing with plural

Details

Request #4989Problem dealing with plural
Submitted2005-08-03 17:32 UTC
Fromtfpsky at yahoo dot com dot br
StatusSuspended
PackageFile_Gettext
PHP Version4.3.4
OSSuSE Linux 9.1
Roadmaps(Not assigned)

Comments

[2005-08-03 17:32 UTC] tfpsky at yahoo dot com dot br

Description:
------------
When trying to get plurals from a PO or MO file, they are not being handled properly.

An example of plural entry in PO file would be like the fallow:

msgid "House"
msgid_plural "Houses"
msgstr[0] "Casa"
msgstr[1] "Casas"

The result of a $FILE_Gettext->load($file) and $FILE_Gettext->toArray() is not what expected.

Test script:
---------------
$FILE_Gettext->load($file);
print_r( $FILE_Gettext->toArray() );

Expected result:
----------------
<!-- Something like this -->
array (
[House] => Casa,
[Houses] => Casas
);

Actual result:
--------------
array (
[HouseHouses] => CasaCasas
);

[2005-12-28 21:07 UTC] piotr at szczepanski dot name

It would be nice if it dealt, though...

For PO files, there is an implementation of this in Drupal's _local_import_read_po():

http://cvs.drupal.org/viewcvs/*checkout*/drupal/drupal/includes/locale.inc

But yours PCRE-based would be a lot better.