<commit_before><sect1 id="zend.locale.migration">

    <title>Migrating from previous versions</title>

    <para>
        The API of <code>Zend_Locale</code> has changed from time to time.
        If you started to use <code>Zend_Locale</code> and it's subcomponents
        in earlier versions follow the guidelines below to migrate your scripts to
        use the new API.
    </para>

    <sect2 id="zend.locale.migration.fromonesixtooneseven">
        <title>Migrating from 1.6 to 1.7 or newer</title>
        <sect3 id="zend.locale.migration.fromonesixtooneseven.islocale">
            <title>Changes when using isLocale()</title>

            <para>
                According to the coding standards isLocale() had to be changed to return
                a boolean. In previous releases a string was returned on success. For
                release 1.7 a compatibility mode has been added which allows to use the
                old behaviour of a returned string, but it triggers a user warning to
                mention you to change to the new behaviour. The rerouting which the old
                behaviour of isLocale() could have done is no longer neccessary as all
                I18N will now process a rerouting themself.
            </para>

            <para>
                To migrate your scripts to the new API, simply use the method as shown below.
            </para>

            <example id="zend.locale.migration.fromonesixtooneseven.example">
                <title>How to change isLocale() from 1.6 to 1.7</title>

                <programlisting role="php"><![CDATA[
// Example for 1.6
if ($locale = Zend_Locale::isLocale($locale)) {
    // do something
}

// You should change the compatiblity mode to prevent user warnings
// But you can do this in your bootstrap
Zend_Locale::compatibilityMode = false;

// Same example for 1.7
if (Zend_Locale::isLocale($locale)) {
}
]]>
                </programlisting>

                <para>
                    Note that you can use the second parameter to see if the locale is correct without
                    processing a rerouting.
                </para>

                <programlisting role="php"><![CDATA[
// Example for 1.6
if ($locale = Zend_Locale::isLocale($locale, false)) {
    // do something
}

// You should change the compatiblity mode to prevent user warnings
// But you can do this in your bootstrap
Zend_Locale::compatibilityMode = false;

// Same example for 1.7
if (Zend_Locale::isLocale($locale, false)) {
    if (Zend_Locale::isLocale($locale, true)) {
        // no locale at all
    }
<commit_msg>Zend_Locale:  - clearified probably misunderstood migration example<commit_after><sect1 id="zend.locale.migration">

    <title>Migrating from previous versions</title>

    <para>
        The API of <code>Zend_Locale</code> has changed from time to time.
        If you started to use <code>Zend_Locale</code> and it's subcomponents
        in earlier versions follow the guidelines below to migrate your scripts to
        use the new API.
    </para>

    <sect2 id="zend.locale.migration.fromonesixtooneseven">
        <title>Migrating from 1.6 to 1.7 or newer</title>
        <sect3 id="zend.locale.migration.fromonesixtooneseven.islocale">
            <title>Changes when using isLocale()</title>

            <para>
                According to the coding standards isLocale() had to be changed to return
                a boolean. In previous releases a string was returned on success. For
                release 1.7 a compatibility mode has been added which allows to use the
                old behaviour of a returned string, but it triggers a user warning to
                mention you to change to the new behaviour. The rerouting which the old
                behaviour of isLocale() could have done is no longer neccessary as all
                I18N will now process a rerouting themself.
            </para>

            <para>
                To migrate your scripts to the new API, simply use the method as shown below.
            </para>

            <example id="zend.locale.migration.fromonesixtooneseven.example">
                <title>How to change isLocale() from 1.6 to 1.7</title>

                <programlisting role="php"><![CDATA[
// Example for 1.6
if ($locale = Zend_Locale::isLocale($locale)) {
    // do something
}

// Same example for 1.7

// You should change the compatiblity mode to prevent user warnings
// But you can do this in your bootstrap
Zend_Locale::compatibilityMode = false;

if (Zend_Locale::isLocale($locale)) {
}
]]>
                </programlisting>

                <para>
                    Note that you can use the second parameter to see if the locale is correct without
                    processing a rerouting.
                </para>

                <programlisting role="php"><![CDATA[
// Example for 1.6
if ($locale = Zend_Locale::isLocale($locale, false)) {
    // do something
}

// Same example for 1.7

// You should change the compatiblity mode to prevent user warnings
// But you can do this in your bootstrap
Zend_Locale::compatibilityMode = false;

if (Zend_Locale::isLocale($locale, false)) {
    if (Zend_Locale::isLocale($locale, true)) {
        // no locale at all
    }

{'fraction_non_alphanumeric': 0.08368200836820083, 'fraction_numerical': 0.008748573602130088, 'mean_word_length': 2.276635514018692, 'pattern_counts': {'":': 0, '<': 61, '<?xml version=': 0, '>': 59, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2767860', 'n_tokens_mistral': 1466, 'n_tokens_neox': 1368, 'n_words': 549}