Issues

ZF-2296: Zend_Locale::getQuestion() does not return yesexpr and noexpr

Issue Type: Bug Created: 2007-12-12T04:55:05.000+0000 Last Updated: 2008-03-21T16:25:35.000+0000 Status: Resolved Fix version(s): - 1.5.0 (17/Mar/08)

Reporter: Fabrizio Balliano (balliano) Assignee: Thomas Weidner (thomas) Tags: - Zend_Locale

Related issues: Attachments:

Description

in this doc: http://framework.zend.com/manual/en/… you say that the getQuestion method returns the regular expressions for matching "yes" and "no" strings but this is not true

running getQuestion('en_US') returns: Array ( [yes] => yes [no] => no [yesabbr] => y [noabbr] => n )

Comments

Posted by Thomas Weidner (thomas) on 2007-12-12T07:28:13.000+0000

The documentation reads:

<pre class="highlight">
Use getQuestion() to obtain an array containing the correct word(s) or regex strings to use for prompting the user

It is not said that you will get regex strings for sure because the underlaying data is provided from the cldr repository. Some languages and versions provide regex strings, and some not.

Therefor the documentation states "OR"... But if you receive Strings it should be very simple to use them within an regex, or even to ask them plain.

If the new CLDR version does no longer provide regex strings we will rewrite the docu, because this is nothing we could do per code for all languages.

Therefor this issue is closed because we will check this with our unittests and the new cldr version which we are awaiting until christmas.

Posted by Thomas Weidner (thomas) on 2007-12-12T08:23:37.000+0000

I've just seen that this data is no longer supported and depreciated since CLDR 1.4 It is now recommended to self create the regex string which has been integrated with SVN 7090.

Posted by Fabrizio Balliano (balliano) on 2007-12-13T03:23:01.000+0000

yeah that's great and thank you for the speed!

anyway i can see a problem in svn version of locale.php, problem comes with non-english languages, for example in italian the word "yes" is translated into "sì", well... the generated regexp seems to be something like

[s|S][ì|ì]

but the problem is that we should also add the ì char without the accent, to have something like

[s|S][i|I|ì|ì]

you think it's possible?

Posted by Fabrizio Balliano (balliano) on 2007-12-13T03:32:19.000+0000

reading the CLDR xml files i found an interesting part

<posix>
    <messages>
        <yesstr>sì:si:s</yesstr>
    </messages>
</posix>

that "yesstr" (think also nostr exists) contains the full match for yes (separated by ":") thus this should be used to generate the regex, maybe simply using the "case insensitive" modificator

$yes = "sì:si:s"; $regex = str_replace(':', '|', $yes); $regex = "/($regex)/i";

what do you think?

Posted by Thomas Weidner (thomas) on 2007-12-15T13:42:00.000+0000

That's not possible because several locales do not contain the abbreviation and read only

<pre class="highlight">
nein

This would then produce failures.

The colon ':' is just an option which can be avaiable but it's not recommended as per definition of the cldr standard.

Posted by Thomas Weidner (thomas) on 2007-12-15T14:25:41.000+0000

Integrated with SVN-7141.

See the new docu and the changed array informations.

Have you found an issue?

See the Overview section for more details.

Copyright

© 2006-2016 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.

Contacts