<commit_before><?xml version="1.0" encoding="UTF-8"?>
<!-- Reviewed: no -->
<sect1 id="zend.translate.sourcecreation">
    <title>Creating source files</title>

    <para>
        Below you will find a description of the different source formats
        which can be used with <classname>Zend_Translate</classname>.
    </para>

    <note>
        <para>
            Note that most of the described formats should be created by using
            a tool or a generation process. These Tools and processes are not part
            of Zend Framework and for most of the described formats free tools
            are available.
        </para>
    </note>

    <sect2 id="zend.translate.sourcecreation.array">
        <title>Creating Array source files</title>

        <para>
            Array source files are plain arrays. But you have to define them
            manually since there is no tool to aid this.
            But because they are so simple, it's the fastest way to look up
            messages if your code works as expected. It's generally the best
            adapter to get started with translation business.
        </para>

        <programlisting language="php"><![CDATA[
$english = array(
    'message1' => 'message1',
    'message2' => 'message2',
    'message3' => 'message3');

$german = array(
    'message1' => 'Nachricht1',
    'message2' => 'Nachricht2',
    'message3' => 'Nachricht3');

$translate = new Zend_Translate(
    array(
        'adapter' => 'array',
        'content' => $english,
        'locale'  => 'en'
    )
);
$translate->addTranslation(array('content' => $deutsch, 'locale' => 'de'));
]]></programlisting>

        <para>
            Since release 1.5 it is also supported to have arrays included within an external file.
            You just have to provide the filename and <classname>Zend_Translate</classname> will
            automatically include it and look for the array. See the following example for details:
        </para>

        <programlisting language="php"><![CDATA[<commit_msg>[ZF-9652] Manual:<commit_after><?xml version="1.0" encoding="UTF-8"?>
<!-- Reviewed: no -->
<sect1 id="zend.translate.sourcecreation">
    <title>Creating source files</title>

    <para>
        Below you will find a description of the different source formats
        which can be used with <classname>Zend_Translate</classname>.
    </para>

    <note>
        <para>
            Note that most of the described formats should be created by using
            a tool or a generation process. These Tools and processes are not part
            of Zend Framework and for most of the described formats free tools
            are available.
        </para>
    </note>

    <sect2 id="zend.translate.sourcecreation.array">
        <title>Creating Array source files</title>

        <para>
            Array source files are plain arrays. But you have to define them
            manually since there is no tool to aid this.
            But because they are so simple, it's the fastest way to look up
            messages if your code works as expected. It's generally the best
            adapter to get started with translation business.
        </para>

        <programlisting language="php"><![CDATA[
$english = array(
    'message1' => 'message1',
    'message2' => 'message2',
    'message3' => 'message3');

$german = array(
    'message1' => 'Nachricht1',
    'message2' => 'Nachricht2',
    'message3' => 'Nachricht3');

$translate = new Zend_Translate(
    array(
        'adapter' => 'array',
        'content' => $english,
        'locale'  => 'en'
    )
);
$translate->addTranslation(array('content' => $german, 'locale' => 'de'));
]]></programlisting>

        <para>
            Since release 1.5 it is also supported to have arrays included within an external file.
            You just have to provide the filename and <classname>Zend_Translate</classname> will
            automatically include it and look for the array. See the following example for details:
        </para>

        <programlisting language="php"><![CDATA[
{'fraction_non_alphanumeric': 0.10732663562852242, 'fraction_numerical': 0.010291595197255575, 'mean_word_length': 2.515934539190353, 'pattern_counts': {'":': 0, '<': 57, '<?xml version=': 2, '>': 79, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, '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': '4231370', 'n_tokens_mistral': 1125, 'n_tokens_neox': 1082, 'n_words': 416}