commit 2c3af874b7bf05b3c5be91406d654967349cdb95
Author: fago <nuppla@zites.net>
Date:   Thu Nov 29 15:21:34 2012 +0100

    Translation test

diff --git a/core/lib/Drupal/Core/Language/Translatable.php b/core/lib/Drupal/Core/Language/Translatable.php
new file mode 100644
index 0000000..3138c3c
--- /dev/null
+++ b/core/lib/Drupal/Core/Language/Translatable.php
@@ -0,0 +1,91 @@
+<?php
+
+/**
+ * @file
+ * Contains \Drupal\Core\Language\Translatable.
+ */
+
+namespace Drupal\Core\Language;
+
+use LogicException;
+
+/**
+ * A translatable string.
+ */
+class Translatable {
+
+  protected $singularString;
+  protected $pluralString;
+  protected $count;
+  protected $arguments;
+  protected $context;
+
+
+  public function __construct($string = NULL) {
+    if (isset($string)) {
+      $this->setSingularString($string);
+    }
+  }
+
+  public function setSingularString($string) {
+    $this->singularString = $string;
+    return $this;
+  }
+
+  public function setPluralString($string = NULL) {
+    $this->pluralString = $string;
+    return $this;
+  }
+
+  public function setArguments(array $arguments = array()) {
+    $this->arguments = $arguments;
+    return $this;
+  }
+
+  public function setContext($context = NULL) {
+    $this->context = $context;
+    return $this;
+  }
+
+  public function setCount($count) {
+    $this->count = $count;
+    return $this;
+  }
+
+  public function getArguments() {
+    return $this->arguments;
+  }
+
+  public function getContext() {
+    return $this->context;
+  }
+
+  public function getCount() {
+    return $this->count;
+  }
+
+  public function getPluralString() {
+    return $this->pluralString;
+  }
+
+  public function getSingularString() {
+    return $this->singularString;
+  }
+
+  public function getTranslation($langcode = NULL) {
+    $options = array('context' => $this->context, 'langcode' => $langcode);
+
+    if (isset($count)) {
+      if (!isset($this->pluralString)) {
+        throw new LogicException('Formatting strings with count of items requires a plural string.');
+      }
+
+      return format_plural($this->count, $this->singularString, $this->pluralString, $this->arguments, $options);
+    }
+    return t($this->singularString, $this->arguments, $options);
+  }
+
+  public function __toString() {
+    return $this->getTranslation();
+  }
+}
diff --git a/core/modules/system/system.module b/core/modules/system/system.module
index e837fe9..5909774 100644
--- a/core/modules/system/system.module
+++ b/core/modules/system/system.module
@@ -5,6 +5,7 @@
  * Configuration system that lets administrators modify the workings of the site.
  */
 
+use Drupal\Core\Language\Translatable;
 use Drupal\Core\Utility\ModuleInfo;
 use Drupal\Core\TypedData\Primitive;
 
@@ -2023,93 +2024,93 @@ function system_stream_wrappers() {
 function system_data_type_info() {
   return array(
     'boolean' => array(
-      'label' => t('Boolean'),
+      'label' => new Translatable('Boolean'),
       'class' => '\Drupal\Core\TypedData\Type\Boolean',
       'primitive type' => Primitive::BOOLEAN,
     ),
     'string' => array(
-      'label' => t('String'),
+      'label' => new Translatable('String'),
       'class' => '\Drupal\Core\TypedData\Type\String',
       'primitive type' => Primitive::STRING,
     ),
     'integer' => array(
-      'label' => t('Integer'),
+      'label' => new Translatable('Integer'),
       'class' => '\Drupal\Core\TypedData\Type\Integer',
       'primitive type' => Primitive::INTEGER,
     ),
     'float' => array(
-      'label' => t('Float'),
+      'label' => new Translatable('Float'),
       'class' => '\Drupal\Core\TypedData\Type\Float',
       'primitive type' => Primitive::FLOAT,
     ),
     'date' => array(
-      'label' => t('Date'),
+      'label' => new Translatable('Date'),
       'class' => '\Drupal\Core\TypedData\Type\Date',
       'primitive type' => Primitive::DATE,
     ),
     'duration' => array(
-      'label' => t('Duration'),
+      'label' => new Translatable('Duration'),
       'class' => '\Drupal\Core\TypedData\Type\Duration',
       'primitive type' => Primitive::DURATION,
     ),
     'uri' => array(
-      'label' => t('URI'),
+      'label' => new Translatable('URI'),
       'class' => '\Drupal\Core\TypedData\Type\Uri',
       'primitive type' => Primitive::URI,
     ),
     'binary' => array(
-      'label' => t('Binary'),
+      'label' => new Translatable('Binary'),
       'class' => '\Drupal\Core\TypedData\Type\Binary',
       'primitive type' => Primitive::BINARY,
     ),
     'language' => array(
-      'label' => t('Language'),
-      'description' => t('A language object.'),
+      'label' => new Translatable('Language'),
+      'description' => new Translatable('A language object.'),
       'class' => '\Drupal\Core\TypedData\Type\Language',
     ),
     'entity' => array(
-      'label' => t('Entity'),
-      'description' => t('All kind of entities, e.g. nodes, comments or users.'),
+      'label' => new Translatable('Entity'),
+      'description' => new Translatable('All kind of entities, e.g. nodes, comments or users.'),
       'class' => '\Drupal\Core\Entity\Field\Type\EntityWrapper',
     ),
     'entity_translation' => array(
-      'label' => t('Entity translation'),
-      'description' => t('A translation of an entity'),
+      'label' => new Translatable('Entity translation'),
+      'description' => new Translatable('A translation of an entity'),
       'class' => '\Drupal\Core\Entity\Field\Type\EntityTranslation',
     ),
     'boolean_field' => array(
-      'label' => t('Boolean field item'),
-      'description' => t('An entity field containing a boolean value.'),
+      'label' => new Translatable('Boolean field item'),
+      'description' => new Translatable('An entity field containing a boolean value.'),
       'class' => '\Drupal\Core\Entity\Field\Type\BooleanItem',
       'list class' => '\Drupal\Core\Entity\Field\Type\Field',
     ),
     'string_field' => array(
-      'label' => t('String field item'),
-      'description' => t('An entity field containing a string value.'),
+      'label' => new Translatable('String field item'),
+      'description' => new Translatable('An entity field containing a string value.'),
       'class' => '\Drupal\Core\Entity\Field\Type\StringItem',
       'list class' => '\Drupal\Core\Entity\Field\Type\Field',
     ),
     'integer_field' => array(
-      'label' => t('Integer field item'),
-      'description' => t('An entity field containing an integer value.'),
+      'label' => new Translatable('Integer field item'),
+      'description' => new Translatable('An entity field containing an integer value.'),
       'class' => '\Drupal\Core\Entity\Field\Type\IntegerItem',
       'list class' => '\Drupal\Core\Entity\Field\Type\Field',
     ),
     'date_field' => array(
-      'label' => t('Date field item'),
-      'description' => t('An entity field containing a date value.'),
+      'label' => new Translatable('Date field item'),
+      'description' => new Translatable('An entity field containing a date value.'),
       'class' => '\Drupal\Core\Entity\Field\Type\DateItem',
       'list class' => '\Drupal\Core\Entity\Field\Type\Field',
     ),
     'language_field' => array(
-      'label' => t('Language field item'),
-      'description' => t('An entity field referencing a language.'),
+      'label' => new Translatable('Language field item'),
+      'description' => new Translatable('An entity field referencing a language.'),
       'class' => '\Drupal\Core\Entity\Field\Type\LanguageItem',
       'list class' => '\Drupal\Core\Entity\Field\Type\Field',
     ),
     'entityreference_field' => array(
-      'label' => t('Entity reference field item'),
-      'description' => t('An entity field containing an entity reference.'),
+      'label' => new Translatable('Entity reference field item'),
+      'description' => new Translatable('An entity field containing an entity reference.'),
       'class' => '\Drupal\Core\Entity\Field\Type\EntityReferenceItem',
       'list class' => '\Drupal\Core\Entity\Field\Type\Field',
     ),
