Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Always fall back to default slug instead of failing #70

Closed
wants to merge 1 commit into from

Conversation

yankl
Copy link

@yankl yankl commented Aug 15, 2022

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.

CC: @flagar @rhukster @godfatherjohn

... at every level of recursion.
@rhukster
Copy link
Member

Closing due to my rewrite for version 3.0

@rhukster rhukster closed this Aug 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Full path not being created for other-language pages
2 participants