Closed jrson83 closed 3 years ago
Hey, the extension is working fine, but I can't figure out how to access the variable CurrentLocale inside my CustomPageController.
CurrentLocale
I found out I can use in template:
<% if $CurrentLocale == 'de_DE' %>Mehr erfahren<% else %>Learn more<% end_if %>
But if I try the variable $CurrentLocale in my CustomPageController it returns nothing.
$CurrentLocale
I have a CustomForm inside my PageController, for which I could easy translate the output if I could access the variable.
Hiya, you can get the current locale like this in PHP.
$locale = FluentState::singleton()->getLocale();
Make sure to import FluentState.
use TractorCow\Fluent\State\FluentState;
Hey, the extension is working fine, but I can't figure out how to access the variable
CurrentLocale
inside my CustomPageController.I found out I can use in template:
<% if $CurrentLocale == 'de_DE' %>Mehr erfahren<% else %>Learn more<% end_if %>
But if I try the variable
$CurrentLocale
in my CustomPageController it returns nothing.I have a CustomForm inside my PageController, for which I could easy translate the output if I could access the variable.