Open fvsch opened 7 years ago
The work around works! Merci!
Ref the workaround code above, I found that it only worked on the home/index page. To get it to work on sub pages I had to include
rather than include_once
.
<?php
// make sure to load the translations
$langfile = $kirby->roots()->languages() . '/' . $site->language()->code() . '.php';
if (file_exists($langfile)) include $langfile;
?>
Good catch, thanks.
Bug report: https://forum.getkirby.com/t/staticbuilder-kirby-as-a-static-site-generator/4084/26
So basically how the
l::set
andl::get
system works in Kirby:L::$data
is an empty array./fr/foo/bar
) and loads the corresponding PHP file insite/languages/fr.php
.c::set
) is just convention. There's nothing special about it. It's a static class with an array and the get/set methods.When rendering from
/staticbuilder/
, Kirby does not set the current language and does not load this language-specific config file. We then go to great lengths to set the page's language when rendering each version, but don't load those files either. Not sure what would be a decent solution. :/Possible workaround, in e.g.
site/snippets/header.php
: