# disco/1.3.48/vendor/micropackage/internationalization/src/Internationalization.php

Discount Rules for WooCommerce – Disco | Dynamic Pricing, Conditions, Bulk, Bundle, BOGO, version 1.3.48. 58 lines.

- Page: https://pluginprobe.com/plugins/disco/1.3.48/code/vendor/micropackage/internationalization/src/Internationalization.php
- Raw: https://pluginprobe.com/plugins/disco/1.3.48/raw/vendor/micropackage/internationalization/src/Internationalization.php
- Modified: 2024-09-18T11:17:48+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/disco/1.3.48/code/vendor/micropackage/internationalization/src/Internationalization.php#L10-L20`.

```php
<?php
/**
 * Internationalization class
 *
 * @package micropackage/internationalization
 */

namespace Micropackage\Internationalization;

/**
 * Internationalization class
 */
class Internationalization {

	/**
	 * Textdomain
	 *
	 * @since 1.0.0
	 * @var   string
	 */
	protected $textdomain;

	/**
	 * Full path to language files directory
	 *
	 * @since 1.0.0
	 * @var   string
	 */
	protected $lang_dir;

	/**
	 * Constructor
	 *
	 * @since 1.0.0
	 * @param string $textdomain         Textdomain.
	 * @param string $full_lang_dir_path Full path to language files directory.
	 */
	public function __construct( $textdomain, $full_lang_dir_path ) {
		$this->textdomain = $textdomain;
		$this->lang_dir   = trailingslashit( $full_lang_dir_path );
	}

	/**
	 * Loads the translation
	 * The file has to be named: {textdomain}-{locale_LOCALE}.mo
	 *
	 * @action init
	 *
	 * @since  1.0.0
	 * @return bool Whether the translation has been loaded or not.
	 */
	public function load_translation() {
		$mo_file = sprintf( '%s%s-%s.mo', $this->lang_dir, $this->textdomain, determine_locale() );
		return load_textdomain( $this->textdomain, $mo_file );
	}

}

```
