Error in "validate.php" in the "_get_language_mapping()" function

Sorry, I’m new here. I’m starting with the new version of Grocery CRUD Enterprise. I was using the old version (1.6.4) and because of that, I’m encountering various problems in the new one.

I found out that there is an error in the “validate.php” file in the “_get_language_mapping()” function

It happened to me that when I made an error in entering an item in the form, a text was displayed where the error description was in English, even though I had set “Czech”:
$crud->setLanguage('Czech');

I searched for what it could be and found that the translation was missing in the “vendor\vlucas\valitron\lang” directory. So I added the “cs.php” file. But the situation did not change.

So I searched further and found that there is an error in the “_get_language_mapping()” function regarding the evaluation of the “Czech” language.

The problem is that the abbreviation for this language is not “cz”, but “cs” and the incorrect abbreviation “cz” was not in the “if” statement where the check is performed.

So I added the line to the “$languageMapping” field:
'Czech' => 'cs',

And that’s how the error description started to be displayed in Czech :wink:

Hi Johnny,

Can you please fix the mapping for Czech in the “Validate.php” file in the “_get_language_mapping()” function in the next update, as I wrote above?

When I did the update, my fix was overwritten by your incorrect file and I had to fix it again.

Thank you

Hello @PaVal ,

Unfortunately you should have a two steps process to also include it to the language Mapping code. If I add the line:

'Czech' => 'cs',

I am getting an error that the file is not there:

I will try to find a solution for this like having my own dependency to Valitron with the extra language of Czech. It will take a while but I believe it is worth it. With this you wouldn’t mind adding the file again to an update. I will let you know for any updates :slight_smile:

Thank you for your answer.

I sent the translated file “cs.php” to the Valitron creators. But they didn’t answer me.

As I write, I translated the file and put it in the directory “vendor\vlucas\valitron\lang”, so it won’t report an error :wink:

And if it does report an error, at least it’s clear that the file with the translation is missing. And it will certainly not be a problem for others to add it.

Thank you