bernhardh / nova-translation-editor

A laravel nova translation editor
12 stars 14 forks source link

feat: edit keys through panel #5

Closed ibrunotome closed 2 years ago

ibrunotome commented 3 years ago

The keys seems to be not editable

Screen Shot 2020-12-16 at 09 25 23
bernhardh commented 3 years ago

Thats correct. You can't delete a key either atm. Is this needed?

ibrunotome commented 3 years ago

Edit option will be cool, I just fixed this key of screenshot (remove the @) direct in the database right now.

It's just a suggestion, you can close the issue if you think it's not useful 😅

bernhardh commented 3 years ago

I think it would be usefull, but there is the problem with existing keys from the files.

The packages uses the spatie/laravel-translation-loader packages, where all changes and newly created stuff is stored in the database.

So if you create a custom key like my-cool-new over the ui, it wouldn't be a problem to make it editable, since there is no corresponding key in any translation file. But if you would rename, let's say the failed key in the auth group, then you would have a problem / unexpected behavior. The translation would be stored into the database with the new key (for examplefaild-new), but there would be still the auth key in the resources/lang/en/auth.php (and other languages as well). So renaming would basically double the row in the ui, since now you would have failed AND failed-new as keys. And if you again rename failed again, then you would have another row (so 3 rows in total), etc.

ibrunotome commented 3 years ago

Understood, here I try to keep original translations out of the database, I take them from repos like this https://github.com/Laravel-Lang/lang for example. And use the database only for custom texts. But in your example, things will start to have a lot of unexpected behavior 😢

bernhardh commented 3 years ago

I will think about. Maybe I find a solution to make keys from "database only" rows editable plus deleteable. Will take me some days.

bernhardh commented 2 years ago

Sorry, don't use nova anymore, since I switched to filamentadmin. So this feature will not be implemented :(