diff 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
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/core/modules/locale/src/SourceString.php	Wed Nov 29 16:09:58 2017 +0000
@@ -0,0 +1,49 @@
+<?php
+
+namespace Drupal\locale;
+
+/**
+ * Defines the locale source string object.
+ *
+ * This class represents a module-defined string value that is to be translated.
+ * This string must at least contain a 'source' field, which is the raw source
+ * value, and is assumed to be in English language.
+ */
+class SourceString extends StringBase {
+  /**
+   * {@inheritdoc}
+   */
+  public function isSource() {
+    return isset($this->source);
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function isTranslation() {
+    return FALSE;
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function getString() {
+    return isset($this->source) ? $this->source : '';
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function setString($string) {
+    $this->source = $string;
+    return $this;
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function isNew() {
+    return empty($this->lid);
+  }
+
+}