Fix multilanguage, make an example, fixes #416

This commit is contained in:
Stéphane Goetz 2017-01-10 10:28:58 +01:00
bovenliggende e831e75958
commit 97a4e73878
9 gewijzigde bestanden met toevoegingen van 22 en 6 verwijderingen

Bestand weergeven

@ -0,0 +1,3 @@
This is our landing page.
Welcome to this awesome multilanguage documentation.

Bestand weergeven

@ -0,0 +1,9 @@
{
"title": "Multilanguage Example",
"tagline": "The Easiest Way To Document Your Project",
"languages": {
"en": "English",
"fr": "Français"
}
}

Bestand weergeven

@ -0,0 +1 @@
It starts here.

Bestand weergeven

@ -0,0 +1 @@
Some configuration options

Bestand weergeven

@ -0,0 +1 @@
C'est ici que tout commence.

Bestand weergeven

@ -0,0 +1 @@
Quelques options de configuration

Bestand weergeven

@ -229,7 +229,8 @@ class Daux
$this->tree = new Root($this->getParams());
Builder::build($this->tree, $this->options['ignore']);
if (!empty($this->options['languages'])) {
// Apply the language name as Section title
if ($this->options->isMultilanguage()) {
foreach ($this->options['languages'] as $key => $node) {
$this->tree->getEntries()[$key]->setTitle($node);
}

Bestand weergeven

@ -9,18 +9,17 @@ class ContentPage extends \Todaymade\Daux\Format\Base\ContentPage
private function isHomepage()
{
// If we don't have the auto_landing parameter, we don't want any homepage
if (array_key_exists('auto_landing', $this->params['html']) && !$this->params['html']['auto_landing']) {
return false;
}
// If the current page isn't the index, no chance it is the landing page
if ($this->file->getParent()->getIndexPage() != $this->file) {
return false;
}
if ($this->params->isMultilanguage()) {
return $this->file->getParent()->getParent() instanceof Root;
}
// If the direct parent is root, this is the homage
return $this->file->getParent() instanceof Root;
}

Bestand weergeven

@ -20,7 +20,7 @@
$path = '';
if ($page['language'] !== '') {
$rendertree = $tree->value[$page['language']];
$rendertree = $tree[$page['language']];
$path = $page['language'];
}