Intented to fix #69
See analysis in this comment and the recap after that.
The recursion to find translated slug path fails if at first a translated file is found, but then at some point in the recursion, a translated file is missing at that level.
(If the missing file is right at the beginning, the failure doesn't happen because of the code here which falls back to page route. )
For my own purposes I think it would have been good enough to add
} else {
return '';
}
at the end of the if (file_exists($translated_md_filepath)) block (and I think the code would have been no worse off than before), but trying to make it work better in other cases to my own, I tried to keep going down the path, and at each level
falling back to the default slug instead of a translated slug. I believe this will allow certain folders along the path to have translated slugs without requiring all of them to have a translated version.
That said I don't really have experience with translated slugs so someone who knows more about them should have a look at this. But the plugin in its current state completely breaks my links in the langswitcher for the reasons outlined in the comment linked above.
Intented to fix #69 See analysis in this comment and the recap after that.
The recursion to find translated slug path fails if at first a translated file is found, but then at some point in the recursion, a translated file is missing at that level. (If the missing file is right at the beginning, the failure doesn't happen because of the code here which falls back to page route. )
For my own purposes I think it would have been good enough to add
at the end of the
if (file_exists($translated_md_filepath))
block (and I think the code would have been no worse off than before), but trying to make it work better in other cases to my own, I tried to keep going down the path, and at each level falling back to the default slug instead of a translated slug. I believe this will allow certain folders along the path to have translated slugs without requiring all of them to have a translated version.That said I don't really have experience with translated slugs so someone who knows more about them should have a look at this. But the plugin in its current state completely breaks my links in the langswitcher for the reasons outlined in the comment linked above.
CC: @flagar @rhukster @godfatherjohn