Translate rows in acl acos in cakephp 4.2

I need to translate tha acl acos to spanish so that the user can select these to grant permissions to another users, how can I do that?

Please, can you help me with this? I added the translate behavior and used the shadow table strategy in AcosTable and when I execute the command bin/cake acl_extras aco_sync it saves all the acos in acos table and in acos_translations table, but in acos table all the fields have null values and in acos_translations are not translated, how can I solve that?

Can you help me with this? I need to solve this as soon as possible and don’t know how to solve it.
Thank you very much for your help.

At least give me an answer and I will stop asking, I need to know if it’s possible or not.

I don’t have an exact answer for you because I have never used the ACL plugin for CakePHP.
But in the end ACL in general is just one way how you can implement authorization in your app.

And if you need something that may or may not be out of scope (or not obvious in the docs or to somone else inhere) then you as a developer need to find a way to solve this problem.
It may very well be needed to fork the acl plugin and adjust it to your needs so that the correct acos are loaded accordingly.

Authorization alone can get complicated very quickly, and the fact that you now have translatable permissions multiplies that complexity again. So just by the information you have given this can’t be answered appropriately in my honest opinion.

It’s not actually clear to me whether your problem is that the values are wrong in the database, or they are correct in the database but you’re not getting the translations when you load them in your code.

When I execute bin/cake acl_extras aco_sync and have the acos_translations table with the TranslateBehavior added to the AcosTable class in namespace Acl\Model\Table, in acos saves all the records for my controllers and actions but with null values and in acos_translations the values are the correct ones but in english, they are not translated to spanish (locale: es_ES), maybe I have to create a MyAcosTable in App\Model\Table, is that correct?

Like Kevin, I’ve never used ACL, so I have no idea what the problem might be for you. Just pointing out that the question is vaguely worded and includes no relevant code or data, so that might be a contributing factor to getting a response.

Do you have translations for those strings somewhere, in a locale file or the like?

No, those strings are not in the code, there is no __('text') that I want to translate, is everything in acos table, that’s why I am not posting any code

Where, then, are you expecting the translations to come from?

From acos table, I don’t know how it works the TranslateBehavior

But how do you expect they get into that table? If the answer is “from the bake process”, then my question becomes how do you expect the bake process to get them? Translations don’t materialize from nowhere, and there’s no connection from any standard Cake functionality to anything like Google Translate. You need to provide the initial translation, somehow.

Last month I could save the acos and the acos_translations with bake process and the records in acos had null values and the records in acos_translations were in english language, right now the bake process is not saving the translations, it saves only the acos records.
How does it work the translatebehavior in cakephp 4.4?
I updated the version with composer update, maybe in cakephp 4.2 works in a different way than cakephp 4.4.

I will change the Acl for Authorization plugin, I will investigate how to use it, because is giving me too many problems.
Is it too much to ask how to configure the Authorization plugin dinamically?

You’ll certainly need to give specifics about what you mean by that, and it should go into a new topic, not extend this one where nobody will likely see it.

Why don’t you use cakedc Users plugin?

I will use the Acl plugin with the TranslateBehavior added with ShadowStrategy, is there a way to translate automatically the field alias of acos table and put that translation in a form control to save it in the table acos_translations, maybe with google or another translator?

You can get yourself a Google API key, and look up how to access their APIs, and call them as appropriate from your own code. Is there a Cake plugin that does that for your acos table? Almost certainly not.

Thank you @Zuluru for the answer, I will look how to add the google api in cakephp

How can I do $this->Acos->find('all', ['locale' => 'es'])->count() and only have the count of the acos_translations table and not the acos table? Because the acos_translations is empty and the acos table has 118 records, I want to have the count = 0 of acos_translations.