summaryrefslogtreecommitdiff
blob: 1a2bd1c14b30440a3a7323aa6a3e2e205df10af7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<?php
declare( strict_types = 1 );

namespace MediaWiki\Extension\Translate\TranslatorInterface\Insertable;

/**
 * Insertable is a string that usually does not need translation and is
 * difficult to type manually.
 * @author Niklas Laxström
 * @license GPL-2.0-or-later
 * @since 2020.12
 */
class Insertable {
	/** @var string What to show to the user */
	protected $display;
	/** @var string What to insert before selection */
	protected $pre;
	/** @var string What to insert after selection */
	protected $post;

	/**
	 * @param string $display What to show to the user
	 * @param string $pre What to insert before selection
	 * @param string $post What to insert after selection
	 */
	public function __construct( string $display, string $pre = '', string $post = '' ) {
		$this->display = $display;
		$this->pre = $pre;
		$this->post = $post;
	}

	public function getPreText(): string {
		return $this->pre;
	}

	public function getPostText(): string {
		return $this->post;
	}

	public function getDisplayText(): string {
		return $this->display;
	}
}

class_alias( Insertable::class, '\MediaWiki\Extensions\Translate\Insertable' );