Issues

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

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

The documentation reads:


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.

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.

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?

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?

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


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.

Integrated with SVN-7141.

See the new docu and the changed array informations.