PluginProbe
Discount Rules for WooCommerce – Disco | Dynamic Pricing, Conditions, Bulk, Bundle, BOGO / 1.3.53
Discount Rules for WooCommerce – Disco | Dynamic Pricing, Conditions, Bulk, Bundle, BOGO v1.3.53
1.4.17 1.4.16 1.4.15 1.4.14 1.4.13 1.4.12 1.4.11 1.4.10 1.4.9 1.4.8 1.4.7 1.4.6 1.4.5 1.4.4 1.4.3 1.4.2 1.4.1 1.4.0 1.3.54 1.3.53 1.3.52 1.3.51 1.3.50 1.3.49 1.3.48 All 180 releases
disco / vendor / micropackage / internationalization / src / Internationalization.php

Internationalization.php in Discount Rules for WooCommerce – Disco | Dynamic Pricing, Conditions, Bulk, Bundle, BOGO 1.3.53, at vendor/micropackage/internationalization/src/Internationalization.php

58 lines 1.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Internationalization class
4 *
5 * @package micropackage/internationalization
6 */
7
8 namespace Micropackage\Internationalization;
9
10 /**
11 * Internationalization class
12 */
13 class Internationalization {
14
15 /**
16 * Textdomain
17 *
18 * @since 1.0.0
19 * @var string
20 */
21 protected $textdomain;
22
23 /**
24 * Full path to language files directory
25 *
26 * @since 1.0.0
27 * @var string
28 */
29 protected $lang_dir;
30
31 /**
32 * Constructor
33 *
34 * @since 1.0.0
35 * @param string $textdomain Textdomain.
36 * @param string $full_lang_dir_path Full path to language files directory.
37 */
38 public function __construct( $textdomain, $full_lang_dir_path ) {
39 $this->textdomain = $textdomain;
40 $this->lang_dir = trailingslashit( $full_lang_dir_path );
41 }
42
43 /**
44 * Loads the translation
45 * The file has to be named: {textdomain}-{locale_LOCALE}.mo
46 *
47 * @action init
48 *
49 * @since 1.0.0
50 * @return bool Whether the translation has been loaded or not.
51 */
52 public function load_translation() {
53 $mo_file = sprintf( '%s%s-%s.mo', $this->lang_dir, $this->textdomain, determine_locale() );
54 return load_textdomain( $this->textdomain, $mo_file );
55 }
56
57 }
58