This commit is contained in:
Paolo A
2024-08-13 13:44:16 +00:00
parent 1bbb23088d
commit e796d76612
4001 changed files with 30101 additions and 40075 deletions

16
vendor/laravel/framework/src/Illuminate/Translation/FileLoader.php vendored Normal file → Executable file
View File

@@ -164,6 +164,16 @@ class FileLoader implements Loader
$this->hints[$namespace] = $hint;
}
/**
* Get an array of all the registered namespaces.
*
* @return array
*/
public function namespaces()
{
return $this->hints;
}
/**
* Add a new JSON path to the loader.
*
@@ -176,12 +186,12 @@ class FileLoader implements Loader
}
/**
* Get an array of all the registered namespaces.
* Get an array of all the registered paths to JSON translation files.
*
* @return array
*/
public function namespaces()
public function jsonPaths()
{
return $this->hints;
return $this->jsonPaths;
}
}

View File

@@ -61,7 +61,7 @@ class MessageSelector
preg_match('/^[\{\[]([^\[\]\{\}]*)[\}\]](.*)/s', $part, $matches);
if (count($matches) !== 3) {
return;
return null;
}
$condition = $matches[1];

View File

30
vendor/laravel/framework/src/Illuminate/Translation/Translator.php vendored Normal file → Executable file
View File

@@ -6,7 +6,6 @@ use Countable;
use Illuminate\Contracts\Translation\Loader;
use Illuminate\Contracts\Translation\Translator as TranslatorContract;
use Illuminate\Support\Arr;
use Illuminate\Support\Collection;
use Illuminate\Support\NamespacedItemResolver;
use Illuminate\Support\Str;
use Illuminate\Support\Traits\Macroable;
@@ -125,7 +124,7 @@ class Translator extends NamespacedItemResolver implements TranslatorContract
if (! is_null($line = $this->getLine(
$namespace, $group, $locale, $item, $replace
))) {
return $line ?? $key;
return $line;
}
}
}
@@ -216,30 +215,15 @@ class Translator extends NamespacedItemResolver implements TranslatorContract
return $line;
}
$replace = $this->sortReplacements($replace);
$shouldReplace = [];
foreach ($replace as $key => $value) {
$line = str_replace(
[':'.$key, ':'.Str::upper($key), ':'.Str::ucfirst($key)],
[$value, Str::upper($value), Str::ucfirst($value)],
$line
);
$shouldReplace[':'.Str::ucfirst($key ?? '')] = Str::ucfirst($value ?? '');
$shouldReplace[':'.Str::upper($key ?? '')] = Str::upper($value ?? '');
$shouldReplace[':'.$key] = $value;
}
return $line;
}
/**
* Sort the replacements array.
*
* @param array $replace
* @return array
*/
protected function sortReplacements(array $replace)
{
return (new Collection($replace))->sortBy(function ($value, $key) {
return mb_strlen($key) * -1;
})->all();
return strtr($line, $shouldReplace);
}
/**
@@ -405,6 +389,8 @@ class Translator extends NamespacedItemResolver implements TranslatorContract
*
* @param string $locale
* @return void
*
* @throws \InvalidArgumentException
*/
public function setLocale($locale)
{

12
vendor/laravel/framework/src/Illuminate/Translation/composer.json vendored Normal file → Executable file
View File

@@ -14,11 +14,13 @@
}
],
"require": {
"php": "^7.2.5|^8.0",
"php": "^7.3|^8.0",
"ext-json": "*",
"illuminate/contracts": "^7.0",
"illuminate/filesystem": "^7.0",
"illuminate/support": "^7.0"
"illuminate/collections": "^8.0",
"illuminate/contracts": "^8.0",
"illuminate/macroable": "^8.0",
"illuminate/filesystem": "^8.0",
"illuminate/support": "^8.0"
},
"autoload": {
"psr-4": {
@@ -27,7 +29,7 @@
},
"extra": {
"branch-alias": {
"dev-master": "7.x-dev"
"dev-master": "8.x-dev"
}
},
"config": {