0 ? apply_filters('nucleo/language_scope', null, $postId) : null; if (!$scope instanceof LanguageScope) { return self::run(self::forPost($postId), $run); } $scope->enter(); try { return self::run(self::forPost($postId), $run); } finally { $scope->leave(); } } /** * Esegue $run nella lingua indicata e ripristina quella della richiesta. * Se la lingua non è installata, $run gira nella lingua corrente. * * @template T * @param callable(): T $run * @return T */ public static function run(string $locale, callable $run): mixed { // switch_to_locale() restituisce false per la lingua già attiva. if ($locale === determine_locale() || !switch_to_locale($locale)) { return $run(); } try { return $run(); } finally { restore_previous_locale(); } } }