You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
I'm working on a project that has 4 different modules, but for simplicity let's keep it on 2 (admin, site). Both modules have a language file inside located under Languages/en/global_lang.php. Due to an issue, and debugging I've notice that CI goes through all namespaces looking for that languages path and file.
The method Language::requireFile will load both files, regardless of the current namespace, and set unneeded language lines.
According to CI docs:
Language files are located automatically from defined namespaces when using the lang() method, as long as the file follows the same directory structures as the main application directory.
Problem with that, is that it adds a lot of extra load of unnecessary files. I should have a way to indicate in which namespace the file that I want is, or some way to the lang() function only goes to look on my current module namespace and not all around.
CodeIgniter 4 version
4.0.4
Affected module(s)
Language
Expected behavior, and steps to reproduce if appropriate Steps to reproduce
Create two modules with language files on them, same language and same file name.
load language on any controller of those modules
print all language lines, you'll see lines from both files, even the one that's outside the namespace.
Expected
I only get the language lines from the file within the namespace
Context
OS: [Linux]
Web server [Apache/2.4.38 (Debian)]
PHP version [7.4.10]
The text was updated successfully, but these errors were encountered:
LucasKovacs
added
the
bug
Verified issues on the current code behavior or pull requests that will fix them
label
Nov 8, 2020
Sorry, but it's not a bug - it is the desired behavior.
The way it's working this way is because we want to have the ability to override language files loaded from the external modules in our application.
The easiest solution seems to be renaming the language files. Unless you have a different idea that will allow us to stick to the current behavior and at the same time meet your needs.
Describe the bug
I'm working on a project that has 4 different modules, but for simplicity let's keep it on 2 (admin, site). Both modules have a language file inside located under Languages/en/global_lang.php. Due to an issue, and debugging I've notice that CI goes through all namespaces looking for that languages path and file.
The method Language::requireFile will load both files, regardless of the current namespace, and set unneeded language lines.
According to CI docs:
Problem with that, is that it adds a lot of extra load of unnecessary files. I should have a way to indicate in which namespace the file that I want is, or some way to the lang() function only goes to look on my current module namespace and not all around.
CodeIgniter 4 version
4.0.4
Affected module(s)
Language
Expected behavior, and steps to reproduce if appropriate
Steps to reproduce
Expected
Context
The text was updated successfully, but these errors were encountered: