<?php

/**
 * Plugin translation model.
 *
 * @package northmill-online-shared
 *
 * @phpcs:disable Squiz.Commenting.FunctionComment.MissingParamTag
 */
declare (strict_types=1);
namespace Northmill_Online_Shared_Checkout\Northmill_Online_Shared\Modules\i18n\Models;

use Northmill_Online_Shared_Checkout\Northmill_Online_Shared\Helpers\General_Helpers;
defined('ABSPATH') || exit;
/**
 * Class Plugin_Translation_Model
 */
class Theme_Translation_Model extends Abstract_Translation_Model
{
    /**
     * {@inheritDoc}
     */
    public function __construct(array|string $translation)
    {
        $this->is_plugin = \false;
        parent::__construct($translation);
    }
    /**
     * {@inheritDoc}
     */
    protected function register_translation(): void
    {
        add_action('after_setup_theme', array($this, 'load_textdomain'), $this->priority, 0);
    }
    /**
     * {@inheritDoc}
     */
    protected function set_mofile_name(): void
    {
        $prefix = '';
        if (!is_null($this->mofile_prefix)) {
            $prefix = General_Helpers::ensure_trailing_symbol($this->mofile_prefix, '-');
        }
        $this->mofile_name = $prefix . $this->locale . '.mo';
    }
}
