API: upload sections list

This commit is contained in:
xiaomlove
2025-02-15 03:15:45 +08:00
parent 0d7cbcde9f
commit c9b2237efd
16 changed files with 262 additions and 10 deletions

View File

@@ -1,6 +1,7 @@
<?php
namespace Nexus;
use App\Http\Middleware\Locale;
use Illuminate\Support\Arr;
use Illuminate\Support\Str;
use Nexus\Plugin\Hook;
@@ -290,7 +291,7 @@ final class Nexus
public static function trans($key, $replace = [], $locale = null)
{
if (!IN_NEXUS) {
return trans($key, $replace, $locale);
return trans($key, $replace, $locale ?? Locale::getDefault());
}
if (empty(self::$translations)) {
//load from default lang dir
@@ -301,7 +302,7 @@ final class Nexus
self::loadTranslations($path, $namespace);
}
}
return self::getTranslation($key, $replace, $locale);
return self::getTranslation($key, $replace, $locale ?? Locale::getDefault());
}
private static function loadTranslations($path, $namespace = null)