joedixon / laravel-translation

Translation management for your Laravel application.
MIT License
694 stars 230 forks source link

Possibility to scan and add missing keys from file to db without update exists translations? #263

Open CrazyFreeMan opened 1 year ago

CrazyFreeMan commented 1 year ago

In my case, I need to check the files for new keys and add them to the database, without updating/overwriting the values for the existing translations. On local add new translation to file, then upload to prod server, ansible run seeders and i need scan new translation from file and add to Database. Its possible? Or only need manualy add keys from UI to db? Thx

For my case i extended driver, add parameter $update, and change line

if ($update) {
      $lang->translations()->updateOrCreate($attributes, $values);
  } else {
      $lang->translations()->firstOrCreate($attributes, $values);
  }