<?xml version="1.0"?>
<?xml-stylesheet
href="http://www.w3.org/2000/08/w3c-synd/style.css" type="text/css"
?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://purl.org/rss/1.0/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:admin="http://webns.net/mvcb/" xmlns:content="http://purl.org/rss/1.0/modules/content/">
    <channel rdf:about="http://pear.php.net/bugs/search.php">
    <title>PEAR Bug Search Results</title>
    <link>http://pear.php.net/bugs/search.php?cmd=display&amp;package_name%5B0%5D=I18Nv2</link>
    <description>Search Results</description>
    <dc:language>en-us</dc:language>
    <dc:creator>pear-webmaster@lists.php.net</dc:creator>
    <dc:publisher>pear-webmaster@lists.php.net</dc:publisher>
    <admin:generatorAgent rdf:resource="http://pear.php.net/bugs"/>
    <sy:updatePeriod>hourly</sy:updatePeriod>
    <sy:updateFrequency>1</sy:updateFrequency>
    <sy:updateBase>2000-01-01T12:00+00:00</sy:updateBase>
    <items>
     <rdf:Seq>
      <rdf:li rdf:resource="http://pear.php.net/bug/15005" />
      <rdf:li rdf:resource="http://pear.php.net/bug/11690" />
      <rdf:li rdf:resource="http://pear.php.net/bug/10371" />
      <rdf:li rdf:resource="http://pear.php.net/bug/10369" />
      <rdf:li rdf:resource="http://pear.php.net/bug/7885" />
      <rdf:li rdf:resource="http://pear.php.net/bug/5256" />
      <rdf:li rdf:resource="http://pear.php.net/bug/4271" />
      <rdf:li rdf:resource="http://pear.php.net/bug/4269" />

     </rdf:Seq>
    </items>
  </channel>

  <image rdf:about="http://pear.php.net/gifs/pearsmall.gif">
    <title>PEAR Bugs</title>
    <url>http://pear.php.net/gifs/pearsmall.gif</url>
    <link>http://pear.php.net/bugs</link>
  </image>

    <item rdf:about="http://pear.php.net/bug/15005">
      <title>I18Nv2: Bug 15005 [Verified] No output for date/time-formats (broken unit tests)</title>
      <link>http://pear.php.net/bugs/15005</link>
      <content:encoded><![CDATA[<pre>I18Nv2 Bug
Reported by petermueller
2008-11-12T10:26:40+00:00
PHP: 5.2.3 OS: Linux Package Version: 

Description:
------------
The date and time-methods don't produce any output.

Notices: dateFormats[], timeFormats[]-Arrays are not initialized.

Test script:
---------------
$locale = I18Nv2::createLocale('de_DE'); 
echo $locale-&gt;formatDate(time());

Expected result:
----------------
(Date formated with German locale.)

Actual result:
--------------
(nothing)</pre>]]></content:encoded>
      <description><![CDATA[<pre>I18Nv2 Bug
Reported by petermueller
2008-11-12T10:26:40+00:00
PHP: 5.2.3 OS: Linux Package Version: 

Description:
------------
The date and time-methods don't produce any output.

Notices: dateFormats[], timeFormats[]-Arrays are not initialized.

Test script:
---------------
$locale = I18Nv2::createLocale('de_DE'); 
echo $locale-&gt;formatDate(time());

Expected result:
----------------
(Date formated with German locale.)

Actual result:
--------------
(nothing)</pre>]]></description>
      <dc:date>2009-02-07T14:47:37+00:00</dc:date>
      <dc:creator>lyric680-web &amp;#x61;&amp;#116; yahoo &amp;#x64;&amp;#111;&amp;#x74; de</dc:creator>
      <dc:subject>I18Nv2 Bug</dc:subject>
    </item>
    <item rdf:about="http://pear.php.net/bug/11690">
      <title>I18Nv2: Feature/Change Request 11690 [Open] US/UK AreaCode</title>
      <link>http://pear.php.net/bugs/11690</link>
      <content:encoded><![CDATA[<pre>I18Nv2 Feature/Change Request
Reported by jausions
2007-07-25T11:32:10+00:00
PHP: Irrelevant OS: Irrelevant Package Version: 0.11.4

Description:
------------
Please add &quot;US&quot; country phone code 1
and a &quot;UK&quot; alias for &quot;GB&quot;'s 44 country code.

Thanks,

 -Philippe</pre>]]></content:encoded>
      <description><![CDATA[<pre>I18Nv2 Feature/Change Request
Reported by jausions
2007-07-25T11:32:10+00:00
PHP: Irrelevant OS: Irrelevant Package Version: 0.11.4

Description:
------------
Please add &quot;US&quot; country phone code 1
and a &quot;UK&quot; alias for &quot;GB&quot;'s 44 country code.

Thanks,

 -Philippe</pre>]]></description>
      <dc:date>2007-08-10T16:43:50+00:00</dc:date>
      <dc:creator>pear &amp;#x61;&amp;#116; 11abacus &amp;#x64;&amp;#111;&amp;#x74; com</dc:creator>
      <dc:subject>I18Nv2 Feature/Change Request</dc:subject>
    </item>
    <item rdf:about="http://pear.php.net/bug/10371">
      <title>I18Nv2: Feature/Change Request 10371 [Open] Enhance fallback for I18Nv2::setLocale()</title>
      <link>http://pear.php.net/bugs/10371</link>
      <content:encoded><![CDATA[<pre>I18Nv2 Feature/Change Request
Reported by derernst
2007-03-14T10:11:37+00:00
PHP: 5.1.6 OS:  Package Version: 0.11.4

Description:
------------
I encountered that on a system locale strings 'en_GB' and 'en_GB.utf-8' can fail, while 'en_GB.UTF-8' works. This made me think of adding some fallback functionality to I18Nv2::setLocale() that checks alternative locale strings with encoding in uppercase and lowercase, with and without country code. I added the below code after line 72 of I18Nv2.php.

I think that enhancing locale handling towards auto-detection and better fallback can help make I18Nv2 a very powerful tool for applications that are intended to work cross-platform and in shared hosting environments - in all cases where the system configuration and application languages are not known at coding time. (See also requests #10369 and #7885.)

Test script:
---------------
if (!$syslocale) {
    // extract locale and encoding info
    $split = explode('.', $setlocale, 2);
    $loc = $split[0];
    $enc = isset($split[1]) ? '.'.$split[1] : '';
    // extract language info without country
    $split = explode('_', $loc, 2);
    $lng = $split[0];
    // compose possible alternative locales
    $alternatives = array(
        $loc.strtoupper($enc),
        $loc.strtolower($enc),
        $lng.strtoupper($enc),
        $lng.strtoupper($enc),
        $loc,
        $lng
    );
    // try to set locales
    if (version_compare(phpversion(), '4.3.0', '&gt;=')) {
        $syslocale = setlocale($cat, $alternatives);
    } 
    else {
        foreach ($alternatives as $alternative) {
            if ($syslocale = setlocale($cat, $alternative)) {
                break;
            }
        }
    }
}</pre>]]></content:encoded>
      <description><![CDATA[<pre>I18Nv2 Feature/Change Request
Reported by derernst
2007-03-14T10:11:37+00:00
PHP: 5.1.6 OS:  Package Version: 0.11.4

Description:
------------
I encountered that on a system locale strings 'en_GB' and 'en_GB.utf-8' can fail, while 'en_GB.UTF-8' works. This made me think of adding some fallback functionality to I18Nv2::setLocale() that checks alternative locale strings with encoding in uppercase and lowercase, with and without country code. I added the below code after line 72 of I18Nv2.php.

I think that enhancing locale handling towards auto-detection and better fallback can help make I18Nv2 a very powerful tool for applications that are intended to work cross-platform and in shared hosting environments - in all cases where the system configuration and application languages are not known at coding time. (See also requests #10369 and #7885.)

Test script:
---------------
if (!$syslocale) {
    // extract locale and encoding info
    $split = explode('.', $setlocale, 2);
    $loc = $split[0];
    $enc = isset($split[1]) ? '.'.$split[1] : '';
    // extract language info without country
    $split = explode('_', $loc, 2);
    $lng = $split[0];
    // compose possible alternative locales
    $alternatives = array(
        $loc.strtoupper($enc),
        $loc.strtolower($enc),
        $lng.strtoupper($enc),
        $lng.strtoupper($enc),
        $loc,
        $lng
    );
    // try to set locales
    if (version_compare(phpversion(), '4.3.0', '&gt;=')) {
        $syslocale = setlocale($cat, $alternatives);
    } 
    else {
        foreach ($alternatives as $alternative) {
            if ($syslocale = setlocale($cat, $alternative)) {
                break;
            }
        }
    }
}</pre>]]></description>
      <dc:date>2007-07-20T06:28:52+00:00</dc:date>
      <dc:creator>derernst &amp;#x61;&amp;#116; gmx &amp;#x64;&amp;#111;&amp;#x74; ch</dc:creator>
      <dc:subject>I18Nv2 Feature/Change Request</dc:subject>
    </item>
    <item rdf:about="http://pear.php.net/bug/10369">
      <title>I18Nv2: Feature/Change Request 10369 [Open] Add support for multiple locales</title>
      <link>http://pear.php.net/bugs/10369</link>
      <content:encoded><![CDATA[<pre>I18Nv2 Feature/Change Request
Reported by derernst
2007-03-14T09:24:51+00:00
PHP: 5.1.6 OS:  Package Version: 0.11.4

Description:
------------
It would IMO be a huge enhancement to add support for multiple locales as in the PHP function setlocale() (since PHP 4.3.0) to I18Nv2. Additionnally a getLocale() method for both I18Nv2 and I18Nv2_Locale would be helpful to check if the locale initialisation was successful. Some example calls for the requested functionalities:

$locales = array('de_CH.UTF-8', 'de_DE.UTF-8', 'de.UTF-8');
$loc =&amp; I18Nv2::createLocale($locales);
if (!$curloc = $loc-&gt;getLocale()) {
  $curloc = $loc-&gt;setLocale('de_CH', 'de_DE', 'de');
}</pre>]]></content:encoded>
      <description><![CDATA[<pre>I18Nv2 Feature/Change Request
Reported by derernst
2007-03-14T09:24:51+00:00
PHP: 5.1.6 OS:  Package Version: 0.11.4

Description:
------------
It would IMO be a huge enhancement to add support for multiple locales as in the PHP function setlocale() (since PHP 4.3.0) to I18Nv2. Additionnally a getLocale() method for both I18Nv2 and I18Nv2_Locale would be helpful to check if the locale initialisation was successful. Some example calls for the requested functionalities:

$locales = array('de_CH.UTF-8', 'de_DE.UTF-8', 'de.UTF-8');
$loc =&amp; I18Nv2::createLocale($locales);
if (!$curloc = $loc-&gt;getLocale()) {
  $curloc = $loc-&gt;setLocale('de_CH', 'de_DE', 'de');
}</pre>]]></description>
      <dc:date>2007-03-14T09:24:51+00:00</dc:date>
      <dc:creator>derernst &amp;#x61;&amp;#116; gmx &amp;#x64;&amp;#111;&amp;#x74; ch</dc:creator>
      <dc:subject>I18Nv2 Feature/Change Request</dc:subject>
    </item>
    <item rdf:about="http://pear.php.net/bug/7885">
      <title>I18Nv2: Feature/Change Request 7885 [Open] Get / handle language info</title>
      <link>http://pear.php.net/bugs/7885</link>
      <content:encoded><![CDATA[<pre>I18Nv2 Feature/Change Request
Reported by derernst
2006-06-13T05:04:38+00:00
PHP: Irrelevant OS:  Package Version: 0.11.4

Description:
------------
A very useful feature for I18Nv2 would be a method to retrieve various informations on a languages, such as:
- direction (rtl/ltr)
- character set(s)
- locales available on the system (ordered by relevancy, most common one first)
- countries/languages mapping

Also it would be very handy to get setLocale() choose the most common locale available, if the language is handed over instead of the locale string: setLocale('de')

These would make it easier to develop applications working also in languages I don't know anything about.</pre>]]></content:encoded>
      <description><![CDATA[<pre>I18Nv2 Feature/Change Request
Reported by derernst
2006-06-13T05:04:38+00:00
PHP: Irrelevant OS:  Package Version: 0.11.4

Description:
------------
A very useful feature for I18Nv2 would be a method to retrieve various informations on a languages, such as:
- direction (rtl/ltr)
- character set(s)
- locales available on the system (ordered by relevancy, most common one first)
- countries/languages mapping

Also it would be very handy to get setLocale() choose the most common locale available, if the language is handed over instead of the locale string: setLocale('de')

These would make it easier to develop applications working also in languages I don't know anything about.</pre>]]></description>
      <dc:date>2006-06-13T05:04:38+00:00</dc:date>
      <dc:creator>derernst &amp;#x61;&amp;#116; gmx &amp;#x64;&amp;#111;&amp;#x74; ch</dc:creator>
      <dc:subject>I18Nv2 Feature/Change Request</dc:subject>
    </item>
    <item rdf:about="http://pear.php.net/bug/5256">
      <title>I18Nv2: Feature/Change Request 5256 [Assigned] No way to fetch all matching languages</title>
      <link>http://pear.php.net/bugs/5256</link>
      <content:encoded><![CDATA[<pre>I18Nv2 Feature/Change Request
Reported by o.persson@...
2005-08-31T07:57:08+00:00
PHP: 5.0.5 OS: Debian GNU/Linux Package Version: 

Description:
------------
Today you can fetch the best matched language. But there's no way to fetch the rest of the languages. This would be very interesting in some cases -- eg. when there's no translation available for the best matched language one can fall back to the second best.

Attached is a small patch (against the current CVS version). Feel free to do whatever you like. I think it would be a great feature. ;)

Test script:
---------------
Index: ../components/PEAR/I18Nv2/Negotiator.php
===================================================================
--- ../components/PEAR/I18Nv2/Negotiator.php    (revision 59)
+++ ../components/PEAR/I18Nv2/Negotiator.php    (working copy)
@@ -274,6 +274,20 @@
     }

     /**
+     * Find Language matches
+     *
+     * @access  public
+     * @return  string
+     * @param   array   $langs
+     */
+    function getLanguageMatches($langs = null)
+    {
+        $languages = $this-&gt;_getMatches($langs, $this-&gt;_acceptLanguage,
+                                        $this-&gt;_defaultLanguage);
+        return array_unique($languages);
+    }
+
+    /**
      * Find locale match
      *
      * @access  public
@@ -303,13 +317,24 @@
         if (!$haystack) {
             return $default;
         }
+        $matches = $this-&gt;_getMatches($needle, $haystack);
+        return (count($matches) &gt; 0) ? array_shift($matches) : $default;
+    }
+
+    /**
+     * Return an array of matched values from first and second parameter.
+     *
+     * @access  private
+     * @return  string
+     * @param   array   $needle
+     * @param   array   $haystack
+     */
+    function _getMatches($needle, $haystack)
+    {
         if (!$needle) {
-            return array_shift($haystack);
+            return $haystack;
         }
-        if ($result = array_shift($a = array_intersect($haystack, $needle))) {
-            return $result;
-        }
-        return $default;
+        return array_intersect($haystack, $needle);
     }

     /**</pre>]]></content:encoded>
      <description><![CDATA[<pre>I18Nv2 Feature/Change Request
Reported by o.persson@...
2005-08-31T07:57:08+00:00
PHP: 5.0.5 OS: Debian GNU/Linux Package Version: 

Description:
------------
Today you can fetch the best matched language. But there's no way to fetch the rest of the languages. This would be very interesting in some cases -- eg. when there's no translation available for the best matched language one can fall back to the second best.

Attached is a small patch (against the current CVS version). Feel free to do whatever you like. I think it would be a great feature. ;)

Test script:
---------------
Index: ../components/PEAR/I18Nv2/Negotiator.php
===================================================================
--- ../components/PEAR/I18Nv2/Negotiator.php    (revision 59)
+++ ../components/PEAR/I18Nv2/Negotiator.php    (working copy)
@@ -274,6 +274,20 @@
     }

     /**
+     * Find Language matches
+     *
+     * @access  public
+     * @return  string
+     * @param   array   $langs
+     */
+    function getLanguageMatches($langs = null)
+    {
+        $languages = $this-&gt;_getMatches($langs, $this-&gt;_acceptLanguage,
+                                        $this-&gt;_defaultLanguage);
+        return array_unique($languages);
+    }
+
+    /**
      * Find locale match
      *
      * @access  public
@@ -303,13 +317,24 @@
         if (!$haystack) {
             return $default;
         }
+        $matches = $this-&gt;_getMatches($needle, $haystack);
+        return (count($matches) &gt; 0) ? array_shift($matches) : $default;
+    }
+
+    /**
+     * Return an array of matched values from first and second parameter.
+     *
+     * @access  private
+     * @return  string
+     * @param   array   $needle
+     * @param   array   $haystack
+     */
+    function _getMatches($needle, $haystack)
+    {
         if (!$needle) {
-            return array_shift($haystack);
+            return $haystack;
         }
-        if ($result = array_shift($a = array_intersect($haystack, $needle))) {
-            return $result;
-        }
-        return $default;
+        return array_intersect($haystack, $needle);
     }

     /**</pre>]]></description>
      <dc:date>2005-10-03T05:54:11+00:00</dc:date>
      <dc:creator>o &amp;#x64;&amp;#111;&amp;#x74; persson &amp;#x61;&amp;#116; gmail &amp;#x64;&amp;#111;&amp;#x74; com</dc:creator>
      <dc:subject>I18Nv2 Feature/Change Request</dc:subject>
    </item>
    <item rdf:about="http://pear.php.net/bug/4271">
      <title>I18Nv2: Feature/Change Request 4271 [Open] 2-Level lists and Regions</title>
      <link>http://pear.php.net/bugs/4271</link>
      <content:encoded><![CDATA[<pre>I18Nv2 Feature/Change Request
Reported by jausions
2005-05-03T12:01:18+00:00
PHP: Irrelevant OS: Irrelevant Package Version: 

Description:
------------
Here are additional files that allow to do 2-level code support. i.e. sub-codes of a main code. I needed to do that to support regions for a country.

See http://www.11abacus.com/dev/pear/I18Nv2.zip

I've provided the region list for US, Canada and France in English and French.

Reproduce code:
---------------
// Pseudo-code

$US = new I18Nv2_Country_Region('US', 'en');
$statesEN = $US-&gt;getAllCodes();

$US-&gt;setLanguage('fr');
$statesFR = $US-&gt;getAllCodes();</pre>]]></content:encoded>
      <description><![CDATA[<pre>I18Nv2 Feature/Change Request
Reported by jausions
2005-05-03T12:01:18+00:00
PHP: Irrelevant OS: Irrelevant Package Version: 

Description:
------------
Here are additional files that allow to do 2-level code support. i.e. sub-codes of a main code. I needed to do that to support regions for a country.

See http://www.11abacus.com/dev/pear/I18Nv2.zip

I've provided the region list for US, Canada and France in English and French.

Reproduce code:
---------------
// Pseudo-code

$US = new I18Nv2_Country_Region('US', 'en');
$statesEN = $US-&gt;getAllCodes();

$US-&gt;setLanguage('fr');
$statesFR = $US-&gt;getAllCodes();</pre>]]></description>
      <dc:date>2007-04-18T19:30:57+00:00</dc:date>
      <dc:creator>Philippe &amp;#x64;&amp;#111;&amp;#x74; Jausions &amp;#x61;&amp;#116; 11abacus &amp;#x64;&amp;#111;&amp;#x74; com</dc:creator>
      <dc:subject>I18Nv2 Feature/Change Request</dc:subject>
    </item>
    <item rdf:about="http://pear.php.net/bug/4269">
      <title>I18Nv2: Feature/Change Request 4269 [Open] Retrieving predefined groups</title>
      <link>http://pear.php.net/bugs/4269</link>
      <content:encoded><![CDATA[<pre>I18Nv2 Feature/Change Request
Reported by jausions
2005-05-03T09:58:21+00:00
PHP: Irrelevant OS: Irrelevant Package Version: 

Description:
------------
Hi.

I was wondering how to retrieve predifined groups with this package, but apparently, there is no easy way to do that.

I'm writing a couple of new files for regions (state, province, etc...) and sometimes it is useful to return a list of available groups of regions. For instance, the country's main regions and its dependent territories. I saw the Filter and decorator classes, but they don't seem to provide generic access.

For instance something like: I18Nv2_Country::getRegionGroups() could return a list of identifiers, which in turn could be used to drill down to get a list of regions.

With the current version of package, you could for instance do: I18Nv2::Country-&gt;getGroups() which could return something like 'Asian', 'NorthAmerican', 'WesternEuropean'... and so forth, and then you could use that to somewhat access the decorated lists with a factory method.

Let me know what you think.

 -Philippe
PS: I'll be posting a separated &quot;bug&quot; with a link to couples of new files for regions (for at least US, Canada and France.)</pre>]]></content:encoded>
      <description><![CDATA[<pre>I18Nv2 Feature/Change Request
Reported by jausions
2005-05-03T09:58:21+00:00
PHP: Irrelevant OS: Irrelevant Package Version: 

Description:
------------
Hi.

I was wondering how to retrieve predifined groups with this package, but apparently, there is no easy way to do that.

I'm writing a couple of new files for regions (state, province, etc...) and sometimes it is useful to return a list of available groups of regions. For instance, the country's main regions and its dependent territories. I saw the Filter and decorator classes, but they don't seem to provide generic access.

For instance something like: I18Nv2_Country::getRegionGroups() could return a list of identifiers, which in turn could be used to drill down to get a list of regions.

With the current version of package, you could for instance do: I18Nv2::Country-&gt;getGroups() which could return something like 'Asian', 'NorthAmerican', 'WesternEuropean'... and so forth, and then you could use that to somewhat access the decorated lists with a factory method.

Let me know what you think.

 -Philippe
PS: I'll be posting a separated &quot;bug&quot; with a link to couples of new files for regions (for at least US, Canada and France.)</pre>]]></description>
      <dc:date>2005-05-03T09:58:21+00:00</dc:date>
      <dc:creator>Philippe &amp;#x64;&amp;#111;&amp;#x74; Jausions &amp;#x61;&amp;#116; 11abacus &amp;#x64;&amp;#111;&amp;#x74; com</dc:creator>
      <dc:subject>I18Nv2 Feature/Change Request</dc:subject>
    </item>
</rdf:RDF>
