]> git.mxchange.org Git - friendica.git/commitdiff
Merge pull request #4388 from MrPetovan/develop
authorMichael Vogel <icarus@dabo.de>
Sat, 3 Feb 2018 21:12:36 +0000 (22:12 +0100)
committerGitHub <noreply@github.com>
Sat, 3 Feb 2018 21:12:36 +0000 (22:12 +0100)
Use syntaxic sugar in L10n::t()

src/Core/L10n.php

index 215c6f6fb11c1c9a682a22c473d4618a145fecdd..277b3401df270437680e1f6f2fb158aa62265332 100644 (file)
@@ -137,9 +137,10 @@ class L10n
         * - L10n::t('Current version: %s, new version: %s', $current_version, $new_version)
         *
         * @param string $s
+        * @param array  $vars Variables to interpolate in the translation string
         * @return string
         */
-       public static function t($s)
+       public static function t($s, ...$vars)
        {
                $a = get_app();
 
@@ -147,9 +148,9 @@ class L10n
                        $t = $a->strings[$s];
                        $s = is_array($t) ? $t[0] : $t;
                }
-               if (func_num_args() > 1) {
-                       $args = array_slice(func_get_args(), 1);
-                       $s = @vsprintf($s, $args);
+
+               if (count($vars) > 0) {
+                       $s = sprintf($s, ...$vars);
                }
 
                return $s;