diff options
author | Roeland Jago Douma <rullzer@users.noreply.github.com> | 2018-02-24 16:26:36 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-02-24 16:26:36 +0100 |
commit | 7144d7a1e364b0996a932d69ec3b3aa60b9adcd0 (patch) | |
tree | 072c74bf8e99260dd814de1afbfd5950829e713c | |
parent | a21024755913819b8795045017657a262b95b1fc (diff) | |
parent | a423860f42a4466e7beb71efea4f132320525716 (diff) | |
download | nextcloud-server-7144d7a1e364b0996a932d69ec3b3aa60b9adcd0.tar.gz nextcloud-server-7144d7a1e364b0996a932d69ec3b3aa60b9adcd0.zip |
Merge pull request #8497 from nextcloud/relax_l10n
Relax what t accepts so we don't break it all
-rw-r--r-- | lib/private/L10N/L10N.php | 8 | ||||
-rw-r--r-- | lib/public/IL10N.php | 4 |
2 files changed, 8 insertions, 4 deletions
diff --git a/lib/private/L10N/L10N.php b/lib/private/L10N/L10N.php index f0e37ca1a5d..a9b1b7377aa 100644 --- a/lib/private/L10N/L10N.php +++ b/lib/private/L10N/L10N.php @@ -78,13 +78,17 @@ class L10N implements IL10N { /** * Translating * @param string $text The text we need a translation for - * @param array $parameters default:array() Parameters for sprintf + * @param array|string $parameters default:array() Parameters for sprintf * @return string Translation or the same text * * Returns the translation. If no translation is found, $text will be * returned. */ - public function t(string $text, array $parameters = []): string { + public function t(string $text, $parameters = []): string { + if (!\is_array($parameters)) { + $parameters = [$parameters]; + } + return (string) new L10NString($this, $text, $parameters); } diff --git a/lib/public/IL10N.php b/lib/public/IL10N.php index 158e0cb156c..2e55c151f62 100644 --- a/lib/public/IL10N.php +++ b/lib/public/IL10N.php @@ -45,14 +45,14 @@ interface IL10N { /** * Translating * @param string $text The text we need a translation for - * @param array $parameters default:array() Parameters for sprintf + * @param array|string $parameters default:array() Parameters for sprintf * @return string Translation or the same text * * Returns the translation. If no translation is found, $text will be * returned. * @since 6.0.0 */ - public function t(string $text, array $parameters = []): string; + public function t(string $text, $parameters = []): string; /** * Translating |