• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Unable to overwrite language file from vendor

#1
When using a third party add in and language files, own language files adjustments are overwritten with the default values in the third party's vendor folder.

Using Codeigniter 4.0.2 and looking at the framework > system > Language > Language.php file, the $files are loaded in the correct order: app, vendor. But afterwards the array_replace_recursive is reverting this again.

PHP Code:
protected function requireFile(string $path): array
{
    
$files   Services::locator()->search($path);
    
$strings = [];

    foreach (
$files as $file)
    {
        
// On some OS's we were seeing failures
        // on this command returning boolean instead
        // of array during testing, so we've removed
        // the require_once for now.
        
if (is_file($file))
        {
            
$strings[] = require $file;
        }
    }

    if (isset(
$strings[1]))
    {
        
$strings array_replace_recursive(...$strings);
    }
    elseif (isset(
$strings[0]))
    {
        
$strings $strings[0];
    }

    return 
$strings;



So when there is a language file in vendor, and you use lang(vendor.) that still has priority over a customized user language file.
Reply

#2
Bug report: https://github.com/codeigniter4/CodeIgni...ssues/3125
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.