SimpleCrudGenerator icon indicating copy to clipboard operation
SimpleCrudGenerator copied to clipboard

Suggestion: don't put translation into app.php, but create separate crud

Open rabol opened this issue 3 years ago • 5 comments

Please consider creating a separate language for the crud general translations

rabol avatar Mar 13 '21 13:03 rabol

Hello @rabol, the app.php translation file only used for the general texts or labels.

For each CRUD feature, we have this master.stub file which will be replaced by the model name.

nafiesl avatar Mar 13 '21 14:03 nafiesl

Yes, I understand, but my suggestion is to leave app.php alone and generate a new e.g. crud.php for the general translation

in app.php the following are created:


// Labels
    'table_no'          => '#',
    'total'             => 'Total',
    'action'            => 'Actions',
    'show_detail_title' => 'View :name :type detail',

    // Actions
    'show'           => 'View Detail',
    'edit'           => 'Edit',
    'delete'         => 'Delete',
    'cancel'         => 'Cancel',
    'reset'          => 'Reset',
    'delete_confirm' => 'Are you sure to delete this?',
    'delete_confirm_button' => 'YES, delete it!',

Imagine that one already have 'show' with another text like

'show' => 'Show details'

then that will be overridden by the CRUD

rabol avatar Mar 13 '21 14:03 rabol

You mean if we already have an existing resources/lang/en/app.php this package will replace the file content with the one that comes from the stub, @rabol?

nafiesl avatar Mar 13 '21 15:03 nafiesl

yes, app.php is a very common lang file for the 'app' :) But, only a suggestion, to keep backwards comaptibility you could add a parameter like --languagefile crud.php

rabol avatar Mar 13 '21 15:03 rabol

Ok, I got your point for to this consideration app.php is a very common.

I will consider this suggestion. I will get back to you if I have another possible solution.

nafiesl avatar Mar 13 '21 15:03 nafiesl