public function validate($value, $possibleValues = [])
 {
     if (!is_array($value)) {
         throw new InvalidValueException(Translate::t("The value must be an array."));
     }
     foreach ($value as $val) {
         if (!in_array($val, $possibleValues)) {
             throw new InvalidValueException(sprintf(Translate::t("The value must be one of the following: “%s”."), implode(Translate::x("quotation inside collection", "”, “"), $possibleValues)));
         }
     }
 }
Ejemplo n.º 2
0
 public function testX()
 {
     // without a locale and a textdomain loaded,
     // the translation service should just return the original string.
     $this->assertSame("foobar", Translate::x("foo", "foobar"));
 }
Ejemplo n.º 3
0
 /**
  * Get name.
  *
  * @return string
  */
 public function getName()
 {
     return Translate::x("timezone", $this->name);
 }
Ejemplo n.º 4
0
 public static function getFirstDayOfWeek()
 {
     return (int) Translate::x("first day of week; 0: Sunday, 1: Monday", "0");
 }
Ejemplo n.º 5
0
 /**
  * Get name.
  *
  * @return string
  */
 public function getName()
 {
     return Translate::x("payment module", $this->name);
 }
Ejemplo n.º 6
0
 public function x($ctxt, $string)
 {
     return Translate::x($ctxt, $string);
 }
Ejemplo n.º 7
0
 /**
  * Get name.
  *
  * @return string
  */
 public function getName()
 {
     return Translate::x("language", $this->name);
 }
Ejemplo n.º 8
0
 /**
  * Get name.
  *
  * @return string
  */
 public function getName()
 {
     return Translate::x("user capability", $this->name);
 }
Ejemplo n.º 9
0
 public function getName()
 {
     return $this->context ? Translate::x($this->context, $this->value) : Translate::t($this->value);
 }
Ejemplo n.º 10
0
 /**
  * Get name.
  *
  * @return string
  */
 public function getName()
 {
     return Translate::x("currency", $this->name);
 }
Ejemplo n.º 11
0
 /**
  * Get name.
  *
  * @return string
  */
 public function getName()
 {
     return Translate::x("country", $this->name);
 }
Ejemplo n.º 12
0
 public function x($context, $string)
 {
     return $this->getMultilangString(function () use($context, $string) {
         return Translate::x($context, $string);
     });
 }
Ejemplo n.º 13
0
 /**
  * Get name.
  *
  * @return string
  */
 public function getName()
 {
     return Translate::x("logging category", $this->name);
 }
Ejemplo n.º 14
0
 /**
  * Get name.
  *
  * @return string
  */
 public function getName()
 {
     return Translate::x("user role", $this->name);
 }