Commaaa2
This commit is contained in:
16
vendor/laravel/framework/src/Illuminate/Translation/FileLoader.php
vendored
Normal file → Executable file
16
vendor/laravel/framework/src/Illuminate/Translation/FileLoader.php
vendored
Normal file → Executable 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;
|
||||
}
|
||||
}
|
||||
|
||||
2
vendor/laravel/framework/src/Illuminate/Translation/MessageSelector.php
vendored
Normal file → Executable file
2
vendor/laravel/framework/src/Illuminate/Translation/MessageSelector.php
vendored
Normal file → Executable file
@@ -61,7 +61,7 @@ class MessageSelector
|
||||
preg_match('/^[\{\[]([^\[\]\{\}]*)[\}\]](.*)/s', $part, $matches);
|
||||
|
||||
if (count($matches) !== 3) {
|
||||
return;
|
||||
return null;
|
||||
}
|
||||
|
||||
$condition = $matches[1];
|
||||
|
||||
0
vendor/laravel/framework/src/Illuminate/Translation/TranslationServiceProvider.php
vendored
Normal file → Executable file
0
vendor/laravel/framework/src/Illuminate/Translation/TranslationServiceProvider.php
vendored
Normal file → Executable file
30
vendor/laravel/framework/src/Illuminate/Translation/Translator.php
vendored
Normal file → Executable file
30
vendor/laravel/framework/src/Illuminate/Translation/Translator.php
vendored
Normal file → Executable 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
12
vendor/laravel/framework/src/Illuminate/Translation/composer.json
vendored
Normal file → Executable 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": {
|
||||
|
||||
Reference in New Issue
Block a user