You are here

class SourceString in Localization update 7.2

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

1 string reference to 'SourceString'
StringDatabaseStorage::getStrings in includes/locale/StringDatabaseStorage.php
Implements StringStorageInterface::getStrings().

File

includes/locale/SourceString.php, line 15
Definition of SourceString.

View source
class SourceString extends StringBase {

  /**
   * Implements StringInterface::getParentId().
   */
  public function getParentId() {

    // Source strings don't have a parent; Translations do.
    return 0;
  }

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

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

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

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

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

}

Members

Namesort descending Modifiers Type Description Overrides
SourceString::getParentId public function Implements StringInterface::getParentId(). Overrides StringBase::getParentId
SourceString::getString public function Implements LocaleString::getString(). Overrides StringInterface::getString
SourceString::isNew public function Implements LocaleString::isNew(). Overrides StringInterface::isNew
SourceString::isSource public function Implements StringInterface::isSource(). Overrides StringInterface::isSource
SourceString::isTranslation public function Implements StringInterface::isTranslation(). Overrides StringInterface::isTranslation
SourceString::setString public function Implements 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::$plid public property The parent string identifier for plural translations.
StringBase::$plural public property Plural index in case of plural string.
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::$textgroup public property The string group.
StringBase::$version public property The string version.
StringBase::delete public function Implements LocaleString::delete(). Overrides StringInterface::delete 1
StringBase::getId public function Implements StringInterface::getId(). Overrides StringInterface::getId
StringBase::getStorage public function Implements StringInterface::getStorage(). Overrides StringInterface::getStorage
StringBase::getTextgroup public function Implements StringInterface::getTextgroup(). Overrides StringInterface::getTextgroup
StringBase::getValues public function Implements StringInterface::getValues(). Overrides StringInterface::getValues
StringBase::getVersion public function Implements StringInterface::getVersion(). Overrides StringInterface::getVersion
StringBase::save public function Implements LocaleString::save(). Overrides StringInterface::save 1
StringBase::setId public function Implements StringInterface::setId(). Overrides StringInterface::setId
StringBase::setParentId public function Implements StringInterface::setParentId(). Overrides StringInterface::setParentId
StringBase::setStorage public function Implements StringInterface::setStorage(). Overrides StringInterface::setStorage
StringBase::setTextgroup public function Implements StringInterface::setTextgroup(). Overrides StringInterface::setTextgroup
StringBase::setValues public function Implements StringInterface::setValues(). Overrides StringInterface::setValues
StringBase::setVersion public function Implements StringInterface::setVersion(). Overrides StringInterface::setVersion
StringBase::__construct public function Constructs a new locale string object. 1