Recently, on July 9, 2023, the next release of OpenCart 4.0.2.2 was released and again with a whole bunch of problems, flaws, bugs, etc. Apparently, there is some unknown intention of the author, but everyone is already starting to get used to the fact that nothing good can be expected from the release of a new version. This time, too, a half-working build was released without any warning that it should not be used for developing real online stores. It is only suitable for training and bug detection.
One of the problems with OpenCart 4.0.2.2 is that it is impossible to change the language in the admin panel. This has been a stable problem for the entire branch since 4.0.0.0, the sixth release has already been released, and the language still cannot be changed. On the official Github, the author has been bombarded with "issues" and "pool-requests" regarding this bug, but every time he closes the request, he says that this problem does not exist. Of course, there is no such problem for monolingual sites :)
So, what is the solution? It's simple, just two edits. Thanks to one of the contributors to the system, we hope that in the new release this problem will disappear forever, because the commit with the fix has already been merged to the official OpenCart repository.
We will explain what and where you need to change to make the language switching in the OpenCart 4.0.2.2 admin without any problems:
1. File /admin/controller/startup/language.php
Find the line
$code = $this->config->get('config_language');
and replace with
$code = $this->config->get('config_language_admin');
2. File /system/config/admin.php
Find the line
'view/*/before' => [
add the code before it
'language/*/after' => [
0 => 'startup/language.after',
1 => 'event/translation'
],
This is a simple solution to the problem. We are looking forward to the stable version of OpenCart 4 and are ready to develop custom extensions for your online stores on the "oc four".