fix bug translation

This commit is contained in:
Geriano
2022-08-22 11:15:29 +07:00
parent 8dc1569b7b
commit 61c7ccfb24
2 changed files with 5 additions and 4 deletions

View File

@@ -93,9 +93,10 @@ class TranslationController extends Controller
app()->setLocale($locale);
$all = $this->all();
$key = mb_strtolower($request->text);
if (!array_key_exists($request->text, $all)) {
$all[$request->text] = $request->text;
if (!array_key_exists($key, $all)) {
$all[$key] = $request->text;
}
return File::put($this->path(), json_encode(

View File

@@ -46,8 +46,8 @@ translation()
window.can = can
window.__ = (text, replacements = {}) => {
if (typeof text === 'string') {
if (window.translations.hasOwnProperty(text)) {
text = window.translations[text]
if (window.translations.hasOwnProperty(text.trim().toLowerCase())) {
text = window.translations[text.trim().toLocaleLowerCase()]
} else {
axios.post(route(
'api.translation.register', window.locale