<?php

/**
 * LolaCore — Plugin text domain bootstrap.
 *
 * @package LolaCore
 * @license GPL-2.0-or-later
 */

declare(strict_types=1);

namespace LolaCore\I18n;

if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

/**
 * Loads the lolacore text domain on init.
 */
class TextDomain {

	/**
	 * Register the init hook.
	 */
	public static function register(): void {
		\add_action( 'init', array( self::class, 'load' ) );
	}

	/**
	 * Load plugin translations.
	 */
	public static function load(): void {
		// phpcs:ignore PluginCheck.CodeAnalysis.DiscouragedFunctions.load_plugin_textdomainFound -- Required for local/dev installs; wp.org auto-loads translations for the plugin slug.
		\load_plugin_textdomain(
			'lolacore',
			false,
			\dirname( \plugin_basename( LOLACORE_PLUGIN_FILE ) ) . '/languages/'
		);
	}
}
