CodeIgniter Forums
setFlashData Always Return EN Value - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28)
+--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forumdisplay.php?fid=30)
+--- Thread: setFlashData Always Return EN Value (/showthread.php?tid=76388)



setFlashData Always Return EN Value - mcsaygili - 05-08-2020

Hi,

I just want to ask question about flashData. I was upgrade my codeigniter base 4.0.2 to 4.0.3 and i faced that stuation.

My language properties are, 
Code:
public $negotiateLocale = TRUE;
public $supportedLocales = ['tr', 'en', 'fr'];

setting flashData
Code:
$check['status']
     ? \Config\Services::session()->setFlashdata('success', lang('FlashMessageType.success.general'))
     : \Config\Services::session()->setFlashdata('error', 'lang('FlashMessageType.error.custom'));

View page, 
Code:
<?php if(Services::session()->getFlashdata('success')): ?>
    <p><?php echo lang('Home.try'); ?></p>
    <div class="alert_message green"><p><?php echo \Config\Services::session()->getFlashdata('success'); ?></p></div>
<?php else: ?>

I added some lang parameters for debug. Only lang parameters works correct. But flashData parameters are incorrect. I haven't any idea what couse that problem. 

Any idea for debugging that problem or solving that problem would be great. Thanks

Sorry for my Engilish, its not my native.

It's my mistake. I was read changelog but i misunderstand some information.

https://github.com/codeigniter4/CodeIgniter4/releases
"Added the ability to have nested language defintions."

My all language files based on that rule. After upgrade system nested language definitions are effected by system Smile 
After changing my language files,

Code:
return [
'success.general' => 'Success',
];
to
Code:
return [
'success-general' => 'Success',
];

works perfectly.