Mercurial > hg > isophonics-drupal-site
annotate core/modules/locale/src/SourceString.php @ 0:4c8ae668cc8c
Initial import (non-working)
author | Chris Cannam |
---|---|
date | Wed, 29 Nov 2017 16:09:58 +0000 |
parents | |
children | 129ea1e6d783 |
rev | line source |
---|---|
Chris@0 | 1 <?php |
Chris@0 | 2 |
Chris@0 | 3 namespace Drupal\locale; |
Chris@0 | 4 |
Chris@0 | 5 /** |
Chris@0 | 6 * Defines the locale source string object. |
Chris@0 | 7 * |
Chris@0 | 8 * This class represents a module-defined string value that is to be translated. |
Chris@0 | 9 * This string must at least contain a 'source' field, which is the raw source |
Chris@0 | 10 * value, and is assumed to be in English language. |
Chris@0 | 11 */ |
Chris@0 | 12 class SourceString extends StringBase { |
Chris@0 | 13 /** |
Chris@0 | 14 * {@inheritdoc} |
Chris@0 | 15 */ |
Chris@0 | 16 public function isSource() { |
Chris@0 | 17 return isset($this->source); |
Chris@0 | 18 } |
Chris@0 | 19 |
Chris@0 | 20 /** |
Chris@0 | 21 * {@inheritdoc} |
Chris@0 | 22 */ |
Chris@0 | 23 public function isTranslation() { |
Chris@0 | 24 return FALSE; |
Chris@0 | 25 } |
Chris@0 | 26 |
Chris@0 | 27 /** |
Chris@0 | 28 * {@inheritdoc} |
Chris@0 | 29 */ |
Chris@0 | 30 public function getString() { |
Chris@0 | 31 return isset($this->source) ? $this->source : ''; |
Chris@0 | 32 } |
Chris@0 | 33 |
Chris@0 | 34 /** |
Chris@0 | 35 * {@inheritdoc} |
Chris@0 | 36 */ |
Chris@0 | 37 public function setString($string) { |
Chris@0 | 38 $this->source = $string; |
Chris@0 | 39 return $this; |
Chris@0 | 40 } |
Chris@0 | 41 |
Chris@0 | 42 /** |
Chris@0 | 43 * {@inheritdoc} |
Chris@0 | 44 */ |
Chris@0 | 45 public function isNew() { |
Chris@0 | 46 return empty($this->lid); |
Chris@0 | 47 } |
Chris@0 | 48 |
Chris@0 | 49 } |