Invision Community 4: SEO, prepare for v5 and dormant account notifications By Matt Monday at 02:04 PM
TSP Posted August 1, 2019 Posted August 1, 2019 Hello, In applications/core/modules/admin/languages/languages.php Method translate() Could you possibly split this method up so the $table-initializations happens in its own method and returned from that method? So the table settings can be easier manipulated by a hook. Ideally I think I would also like translateWord() to be refactored, but given you don't officially support adding columns on existing database tables, I guess I'll have to manage without.
Daniel F Posted August 1, 2019 Posted August 1, 2019 Couldn’t you create a hook for the Table\Db class with a condition for the database table name and module or url Param to run the custom code only for this specific case?
TSP Posted August 1, 2019 Author Posted August 1, 2019 2 minutes ago, Daniel F said: Couldn’t you create a hook for the Table\Db class with a condition for the database table name and module or url Param to run the custom code only for this specific case? I guess... But then it would only make sense to hook into the toString-method, since I can't know when the table initialization has been "done" otherwise. Just seems a bit over the top to override the toString-method (even though I obviously would limit the cases it would run), but if you feel that's the best approach, then I can do that.
Daniel F Posted August 1, 2019 Posted August 1, 2019 Could you explain what you’re trying to achieve? I’m usually hooking into the constructor or getRows method to customize the table data.
TSP Posted August 1, 2019 Author Posted August 1, 2019 15 minutes ago, Daniel F said: Could you explain what you’re trying to achieve? I’m usually hooking into the constructor or getRows method to customize the table data. I'm adding a field to show the last time a language string was changed and by whom (as well as having both of these sortable). Also removing the Plugin and Theme-columns. I've also added a search field to limit translations to those done by a specific member id. Currently I've just copied the entire translateWord and translate-methods and then added my changes to them. And then I also manually added two columns to the core_sys_lang_words-table to track the time changed and by whom. Currently just for my use... However, in order to not get in trouble with later upgrades, possibly distributing on MP etc. I'm considering doing it in a more proper way at a later point. 😃 I guess the $table will be the least of my worries, as I'll also need to left join (if that's even possible with the Db Form Table?) with another table so I can get that information (and still be able to sort) from another table instead.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.