Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multi-language issue #13833

Open
lemonadvert opened this issue Apr 2, 2024 · 14 comments
Open

Multi-language issue #13833

lemonadvert opened this issue Apr 2, 2024 · 14 comments
Assignees
Labels
Needs Testing Possibly fixed, needs to be tested/verified

Comments

@lemonadvert
Copy link

OpenCart 4.0.2.4 and 4.1

Hello,
We have translated OpenCart into Bulgarian. We have 100% translated all language files. But when we started testing and noticed that language files in extensions are loaded from "extension/opencart/module/account" but they have to be loading from "ocbg_bglang/extension/opencart/module/account".

When you load the store, the Bulgarian translation of the module on the right does not appear.

You can check here: https://shipping.opencartsupports.com/bg?route=account/register

Thanks!

@ppalashturov
Copy link
Contributor

@danielkerr
I have this problem too!

Thanks!

@opencartbot
Copy link
Contributor

You're right!
I solved this problem by custom fix - copying the language files to the 'extension/opencart' folder when installing the language.
But in the new version 4.1.0.0 I see new issue - the language in the admin does not switch, although in version 4.0.2.3 it was finally solved. But now again.
"OpenCart Language Example" not working also.
This must be decided before the release 4.1.0.0.

@ppalashturov
Copy link
Contributor

@opencartbot @danielkerr
Hello,
We also have a problem with the namespace of the libraries uploading to extensions ('library'), I still can't load the library with use from there, and I have to use include to start the library.
thanks!

@opencartbot
Copy link
Contributor

opencartbot commented Apr 3, 2024

We also have a problem with the namespace of the libraries uploading to extensions ('library'), I still can't load the library with use from there, and I have to use include to start the library.

This is not relevant to this topic (issue), i.e. multi-language . Let's be consistent in the topic.

@opencartbot
Copy link
Contributor

opencartbot commented Apr 3, 2024

And another problem is related to multi-language when I install a third-party module - the system looks for its translation in the language extension folder, but not in the module folder. Therefore, third-party modules do not have a translation in the admin, they are always in English.
For example:
I installed second language - Ukrainian, and switch to this language in the admin.
Then installed the new extension - MyModule with Ukrainian localization in the file extension/mymodule/admin/language/uk-ua/module/mymodule.php
But OpenCart connect the module localization with path extension/ukrainian/extension/mymodule/module/mymodule
What do you advise?

@danielkerr
Copy link
Member

i think u have not copied how i setup the language extension included to show developers how to add languages.

sounds like u have just copied language files into the system without setting up a start up controller to add the additional loading paths or even overrides to alter the route to match a extension directory.

@ppalashturov
Copy link
Contributor

Hello,
Thank you very much @danielkerr , everything is working perfectly now with the languages. Can you show an example how to work with the libraries in the modules for example: "ocbg_module/system/library/ocbg_module.php" how to load the corresponding class in some controller. It doesn't work with namespaces, it only works with 'include'.
Thank you very much!

@ppalashturov
Copy link
Contributor

@opencartbot
Hello,
oops, you need to transfer "extension" from module "my_module" folder to "catalog/language/de-de/extension/opencart/module/module.php" and for admin "admin/language/de-de/extension/ opencart/module/module.php"!
unnamed

@opencartbot
Copy link
Contributor

opencartbot commented Apr 4, 2024

@danielkerr We need an example of a full additional localization, not what we have now, where there is only one localization file each.
Moreover, this example does not work correctly, just look at the file admin\language\de-de\language\common\header.php in 'oc_language_example' folder

@ppalashturov
Copy link
Contributor

@opencartbot "admin\language\de-de\language\common\header.php" remove "language" => "admin\language\de-de\common\header.php"!

@opencartbot
Copy link
Contributor

@ppalashturov You didn't understand me. Please open the file extension\oc_language_example\admin\language\de-de\language\common\header.php
What do you see there? Is it a front-end localization file? So. Therefore, it must be corrected. And it is necessary to make a example of full localization to show how the localization of extensions in the admin and in the catalog should look like.

@opencartbot
Copy link
Contributor

you need to transfer "extension" from module "my_module" folder to "catalog/language/de-de/extension/opencart/module/module.php" and for admin "admin/language/de-de/extension/ opencart/module/module.php"!

This works for the default opencart extensions.
But it doesn't work for other extensions.

@ppalashturov
Copy link
Contributor

ppalashturov commented Apr 4, 2024

@opencartbot
For the other modules, you create language files with a language in your module. For example:
"extension/my_module/catalog/language/bg/module/my_module.php"

@opencartbot
Copy link
Contributor

Thank you all.
The issue with switching the language in the admin has been fixed c2b6fb5
With loading the admin localization of third-party modules - it was my fault, I did it like this:
$data = $this->load->language(..);
But it doesn't work anymore, no need to load the localization into the $data array.

@danielkerr danielkerr self-assigned this Apr 23, 2024
@danielkerr danielkerr added the Needs Testing Possibly fixed, needs to be tested/verified label Apr 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs Testing Possibly fixed, needs to be tested/verified
Projects
None yet
Development

No branches or pull requests

4 participants