class SourceString

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.

Hierarchy

Expanded class hierarchy of SourceString

5 files declare their use of SourceString
locale.module in drupal/core/modules/locale/locale.module
Enables the translation of the user interface to languages other than English.
locale.pages.inc in drupal/core/modules/locale/locale.pages.inc
Interface translation summary, editing and deletion user interfaces.
LocaleLookup.php in drupal/core/modules/locale/lib/Drupal/locale/LocaleLookup.php
Definition of LocaleLookup
LocaleStringTest.php in drupal/core/modules/locale/lib/Drupal/locale/Tests/LocaleStringTest.php
Definition of Drupal\locale\Tests\LocaleStringTest.
PoDatabaseWriter.php in drupal/core/modules/locale/lib/Drupal/locale/PoDatabaseWriter.php
Definition of Drupal\locale\PoDatabaseWriter.

File

drupal/core/modules/locale/lib/Drupal/locale/SourceString.php, line 20
Definition of Drupal\locale\SourceString.

Namespace

Drupal\locale
View source
class SourceString extends StringBase {

  /**
   * Implements Drupal\locale\StringInterface::isSource().
   */
  public function isSource() {
    return isset($this->source);
  }

  /**
   * Implements Drupal\locale\StringInterface::isTranslation().
   */
  public function isTranslation() {
    return FALSE;
  }

  /**
   * Implements Drupal\locale\LocaleString::getString().
   */
  public function getString() {
    return isset($this->source) ? $this->source : '';
  }

  /**
   * Implements Drupal\locale\LocaleString::setString().
   */
  public function setString($string) {
    $this->source = $string;
    return $this;
  }

  /**
   * Implements Drupal\locale\LocaleString::isNew().
   */
  public function isNew() {
    return empty($this->lid);
  }

}

Members

Namesort descending Modifiers Type Description Overrides
SourceString::getString public function Implements Drupal\locale\LocaleString::getString(). Overrides StringInterface::getString
SourceString::isNew public function Implements Drupal\locale\LocaleString::isNew(). Overrides StringInterface::isNew
SourceString::isSource public function Implements Drupal\locale\StringInterface::isSource(). Overrides StringInterface::isSource
SourceString::isTranslation public function Implements Drupal\locale\StringInterface::isTranslation(). Overrides StringInterface::isTranslation
SourceString::setString public function Implements Drupal\locale\LocaleString::setString(). Overrides StringInterface::setString
StringBase::$context public property The string context.
StringBase::$lid public property The string identifier.
StringBase::$locations public property The string locations indexed by type.
StringBase::$source public property The source string.
StringBase::$storage protected property The locale storage this string comes from or is to be saved to.
StringBase::$version public property The string version.
StringBase::addLocation public function Implements Drupal\locale\StringInterface::addLocation(). Overrides StringInterface::addLocation
StringBase::delete public function Implements Drupal\locale\LocaleString::delete(). Overrides StringInterface::delete 1
StringBase::getId public function Implements Drupal\locale\StringInterface::getId(). Overrides StringInterface::getId
StringBase::getLocations public function Implements Drupal\locale\StringInterface::getLocation(). Overrides StringInterface::getLocations
StringBase::getPlurals public function Implements Drupal\locale\StringInterface::getPlurals(). Overrides StringInterface::getPlurals
StringBase::getStorage public function Implements Drupal\locale\StringInterface::getStorage(). Overrides StringInterface::getStorage
StringBase::getValues public function Implements Drupal\locale\StringInterface::getValues(). Overrides StringInterface::getValues
StringBase::getVersion public function Implements Drupal\locale\StringInterface::getVersion(). Overrides StringInterface::getVersion
StringBase::hasLocation public function Implements Drupal\locale\StringInterface::hasLocation(). Overrides StringInterface::hasLocation
StringBase::save public function Implements Drupal\locale\LocaleString::save(). Overrides StringInterface::save 1
StringBase::setId public function Implements Drupal\locale\StringInterface::setId(). Overrides StringInterface::setId
StringBase::setPlurals public function Implements Drupal\locale\StringInterface::setPlurals(). Overrides StringInterface::setPlurals
StringBase::setStorage public function Implements Drupal\locale\StringInterface::setStorage(). Overrides StringInterface::setStorage
StringBase::setValues public function Implements Drupal\locale\StringInterface::setValues(). Overrides StringInterface::setValues
StringBase::setVersion public function Implements Drupal\locale\StringInterface::setVersion(). Overrides StringInterface::setVersion
StringBase::__construct public function Constructs a new locale string object. 1