fix bug translation
This commit is contained in:
@@ -93,9 +93,10 @@ class TranslationController extends Controller
|
|||||||
app()->setLocale($locale);
|
app()->setLocale($locale);
|
||||||
|
|
||||||
$all = $this->all();
|
$all = $this->all();
|
||||||
|
$key = mb_strtolower($request->text);
|
||||||
|
|
||||||
if (!array_key_exists($request->text, $all)) {
|
if (!array_key_exists($key, $all)) {
|
||||||
$all[$request->text] = $request->text;
|
$all[$key] = $request->text;
|
||||||
}
|
}
|
||||||
|
|
||||||
return File::put($this->path(), json_encode(
|
return File::put($this->path(), json_encode(
|
||||||
|
|||||||
@@ -46,8 +46,8 @@ translation()
|
|||||||
window.can = can
|
window.can = can
|
||||||
window.__ = (text, replacements = {}) => {
|
window.__ = (text, replacements = {}) => {
|
||||||
if (typeof text === 'string') {
|
if (typeof text === 'string') {
|
||||||
if (window.translations.hasOwnProperty(text)) {
|
if (window.translations.hasOwnProperty(text.trim().toLowerCase())) {
|
||||||
text = window.translations[text]
|
text = window.translations[text.trim().toLocaleLowerCase()]
|
||||||
} else {
|
} else {
|
||||||
axios.post(route(
|
axios.post(route(
|
||||||
'api.translation.register', window.locale
|
'api.translation.register', window.locale
|
||||||
|
|||||||
Reference in New Issue
Block a user