diff --git a/src/Translator.php b/src/Translator.php index 8494fcb0..bc7bbbf0 100644 --- a/src/Translator.php +++ b/src/Translator.php @@ -148,8 +148,8 @@ public function translate($message, $count = NULL, $parameters = [], $domain = N return $message; // what now? } - if (!is_string($message)) { - throw new \Kdyby\Translation\InvalidArgumentException(sprintf('Message id must be a string, %s was given', gettype($message))); + if (!is_string($message) && !is_int($message)) { + throw new \Kdyby\Translation\InvalidArgumentException(sprintf('Message id must be a string or integer, %s was given', gettype($message))); } if (Strings::startsWith($message, '//')) { @@ -182,8 +182,8 @@ public function translate($message, $count = NULL, $parameters = [], $domain = N */ public function trans($message, array $parameters = [], $domain = NULL, $locale = NULL) { - if (!is_string($message)) { - throw new \Kdyby\Translation\InvalidArgumentException(sprintf('Message id must be a string, %s was given', gettype($message))); + if (!is_string($message) && !is_int($message)) { + throw new \Kdyby\Translation\InvalidArgumentException(sprintf('Message id must be a string or integer, %s was given', gettype($message))); } if ($domain === NULL) { @@ -207,8 +207,8 @@ public function trans($message, array $parameters = [], $domain = NULL, $locale */ public function transChoice($message, $number, array $parameters = [], $domain = NULL, $locale = NULL) { - if (!is_string($message)) { - throw new \Kdyby\Translation\InvalidArgumentException(sprintf('Message id must be a string, %s was given', gettype($message))); + if (!is_string($message) && !is_int($message)) { + throw new \Kdyby\Translation\InvalidArgumentException(sprintf('Message id must be a string or integer, %s was given', gettype($message))); } if ($domain === NULL) {