<?php
/**
 * @version 7.2
 */
?>
<form action="<?php echo $this->url(null, null, true, array('title', 'save_language', 'language')); ?>" method="post">
    <nav class="navbar navbar-filter">
        <!-- TODO: (optional) add option to create a language file directly from this page -->

        <div class="navbar-form navbar-right">

            <div class="form-group">
                <label class="control-label">
                    <?php echo $this->_('Select Language'); ?>
                </label>
                <?php echo $this->formElement('select', 'language', $this->language)
                    ->setMultiOptions(\Ppb\Utility::getLanguages())
                    ->setAttributes(array(
                        'class' => 'form-control input-default'))
                    ->render();
                ?>
            </div>
            <?php echo $this->formElement('submit', 'submit', $this->_('Proceed'))
                ->setAttributes(array('class' => 'btn btn-default'))
                ->render();
            ?>
        </div>
    </nav>

    <p>
        <?php echo $this->_("Important: the majority of the sentences are found in the .mo files, that can be translated only using a gettext parser, like poedit. <br>"
            . "For more information, please check our <a href='http://www.phpprobid.com/translation-tutorial' target='_blank'>translation tutorial</a>."); ?>
    </p>

    <?php if ($this->language) { ?>
        <div class="form-group">
            <?php echo $this->formElement('\Ppb\Form\Element\LinkedTextarea', 'langData')
                ->setAttributes(array(
                    'rows' => '32',
                ))
                ->setValue($this->data)
                ->render(); ?>
            <span class="help-block">
                <?php echo $this->_('Recommended: you should edit this file using a dedicated editor, preferably one that recognizes php syntax. <br>'
                    . 'Important: the quote (&quot;) character is reserved, please escape it (\&quot;) if needing to use it. <br>'
                    . 'Important: adding invalid code to this file might render your site unusable.'); ?>
            </span>
        </div>

        <div class="form-group">
            <?php echo $this->formElement('submit', 'save_language', $this->_('Save'))
                ->setAttributes(array('class' => 'btn btn-primary'))
                ->render();
            ?>
        </div>
    <?php } ?>
</form>
