Fix multilanguage, make an example, fixes #416
This commit is contained in:
parent
e831e75958
commit
97a4e73878
3
examples/multilanguage/_index.md
Normal file
3
examples/multilanguage/_index.md
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
This is our landing page.
|
||||||
|
|
||||||
|
Welcome to this awesome multilanguage documentation.
|
9
examples/multilanguage/config.json
Normal file
9
examples/multilanguage/config.json
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
"title": "Multilanguage Example",
|
||||||
|
"tagline": "The Easiest Way To Document Your Project",
|
||||||
|
|
||||||
|
"languages": {
|
||||||
|
"en": "English",
|
||||||
|
"fr": "Français"
|
||||||
|
}
|
||||||
|
}
|
1
examples/multilanguage/en/00_Getting_Started.md
Normal file
1
examples/multilanguage/en/00_Getting_Started.md
Normal file
@ -0,0 +1 @@
|
|||||||
|
It starts here.
|
1
examples/multilanguage/en/Configuration/Options.md
Normal file
1
examples/multilanguage/en/Configuration/Options.md
Normal file
@ -0,0 +1 @@
|
|||||||
|
Some configuration options
|
1
examples/multilanguage/fr/00_Commencer.md
Normal file
1
examples/multilanguage/fr/00_Commencer.md
Normal file
@ -0,0 +1 @@
|
|||||||
|
C'est ici que tout commence.
|
1
examples/multilanguage/fr/Configuration/Options.md
Normal file
1
examples/multilanguage/fr/Configuration/Options.md
Normal file
@ -0,0 +1 @@
|
|||||||
|
Quelques options de configuration
|
@ -229,7 +229,8 @@ class Daux
|
|||||||
$this->tree = new Root($this->getParams());
|
$this->tree = new Root($this->getParams());
|
||||||
Builder::build($this->tree, $this->options['ignore']);
|
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) {
|
foreach ($this->options['languages'] as $key => $node) {
|
||||||
$this->tree->getEntries()[$key]->setTitle($node);
|
$this->tree->getEntries()[$key]->setTitle($node);
|
||||||
}
|
}
|
||||||
|
@ -9,18 +9,17 @@ class ContentPage extends \Todaymade\Daux\Format\Base\ContentPage
|
|||||||
|
|
||||||
private function isHomepage()
|
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']) {
|
if (array_key_exists('auto_landing', $this->params['html']) && !$this->params['html']['auto_landing']) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If the current page isn't the index, no chance it is the landing page
|
||||||
if ($this->file->getParent()->getIndexPage() != $this->file) {
|
if ($this->file->getParent()->getIndexPage() != $this->file) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->params->isMultilanguage()) {
|
// If the direct parent is root, this is the homage
|
||||||
return $this->file->getParent()->getParent() instanceof Root;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this->file->getParent() instanceof Root;
|
return $this->file->getParent() instanceof Root;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
$path = '';
|
$path = '';
|
||||||
|
|
||||||
if ($page['language'] !== '') {
|
if ($page['language'] !== '') {
|
||||||
$rendertree = $tree->value[$page['language']];
|
$rendertree = $tree[$page['language']];
|
||||||
$path = $page['language'];
|
$path = $page['language'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user