<?php
// namespace IRI\Polemictweet\Web;

use Zend\I18n\Translator\Translator as ZendTranslator;
use Zend\I18n\Translator\TextDomain;
use Zend\I18n\Translator\Loader\PhpMemoryArray;

class Translator extends ZendTranslator {


    public function _($message) {
        return $this->translate($message, 'default');
    }

    public function addTranslation($messages, $locale) {

        if (! isset($this->messages['default'])) {
            $this->messages['default'] = [];
        }
        $textDomain = new TextDomain($messages);
        if (isset($this->messages['default'][$locale])) {
            $this->messages['default'][$locale]->merge($textDomain);
        } else {
            $this->messages['default'][$locale] = $textDomain;
        }
    }

}

