Comments (7)
Actually, it seems that this also causes an issue with linking, because the link [bot](bot.md)
leads to a 404 page on the built docs, because MkDocs isn't parsing the link into the actual page.
Like, I have the following file structure:
docs/
├── de-CH/
│ └── legal/
│ └── index.md
└── en/
└── legal/
├── bot.md
└── index.md
With index.md
having a link to bot.md
in both folders.
For the default language (English) does this work fine, but for de-CH
does it give a 404 because it doesn't have a bot.md file present and MkDocs treats it as a broken link, not parsing it...
Can this be fixed?
from mkdocs-static-i18n.
Weird, I have a lot of untranslated pages and don't have this error.
But from your docs tree example I see you're using the folder structure instead of suffix like I do.
Perhaps the bug is somewhere there in the folder structure logic. I will try to reproduce it based on the example.
from mkdocs-static-i18n.
The actual docs source can be found here: https://github.com/purrbot-site/Docs
from mkdocs-static-i18n.
I did some debugging and it turned out there are actually two bugs in the folder file lookup:
Here is a console output of some print statements:
looked up target -> de-CH/credits/index.md
variant=credits/index.md file=None
variant=en/de-CH/credits/index.md file=None
variant=de-CH/credits/index.md file=File(src_uri='de-CH/credits/index.md', dest_uri='de-CH/credits/index.html', name='index', url='de-CH/credits/')
---
looked up target -> de-CH/legal/bot.md
variant=legal/bot.md file=None
variant=en/de-CH/legal/bot.md file=None
variant=de-CH/legal/bot.md file=None
WARNING - Doc file 'de-CH/legal/index.md' contains a relative link 'bot.md', but the target 'de-CH/legal/bot.md' is not found among documentation
files.
---
looked up target -> de-CH/legal/api.md
variant=legal/api.md file=None
variant=en/de-CH/legal/api.md file=None
variant=de-CH/legal/api.md file=None
WARNING - Doc file 'de-CH/legal/index.md' contains a relative link 'api.md', but the target 'de-CH/legal/api.md' is not found among documentation
files.
Taking the issue from the OP, the de-CH/legal/bot.md
file lookup searches for en/de-CH/legal/api.md
instead of en/legal/api.md
and therefore it can't find such file.
As for the second bug, it's in the lookup order of the variants. For example if we'd fix the first issue, for de-CH/credits/index.md
it would lookup en/credits/index.md
before finding de-CH/credits/index.md
.
from mkdocs-static-i18n.
Not sure if this is the right logic you have there...
I have en set as default, so the effective path for the link should be equivalent to api.md as an example.
Tho, Ialso may misunderstand stuff...
from mkdocs-static-i18n.
Maybe I missed something when testing, as I was mostly focused on fixing the broken path and warning.
Then found the wrong order of alternative path lookup.
You can clone the branch from the PR and make a more thorough review to make sure nothing else was broken in the process.
from mkdocs-static-i18n.
Maybe I missed something when testing, as I was mostly focused on fixing the broken path and warning. Then found the wrong order of alternative path lookup.
You can clone the branch from the PR and make a more thorough review to make sure nothing else was broken in the process.
Yeah. I'll try to install it with pip and see if there's anything... Will report it in the PR in such a case.
from mkdocs-static-i18n.
Related Issues (20)
- How to fix when translate got problem "warning not found image" HOT 1
- no Language code causing issues HOT 1
- Is there a way to preserve the language selection? HOT 2
- Incompatibility with Mkdocs Material Blog plugin? HOT 3
- [Bug?] 404 page not generated for selected language HOT 2
- Having issues building my translations after updating it to 1.0.0 HOT 8
- [Enhancement] Hiding localization options for unstralated pages HOT 2
- Issue with incorrect language folder being copied HOT 17
- Both languages show on the left-side menu instead of the current language's content only HOT 5
- Warning when homepage is not in nav HOT 1
- Non localized files missing in not default language HOT 3
- [RFE] - scaffold navigation for translations to allow for upstream management of fallback HOT 1
- Custom language selector (non-mkdocs-material) HOT 10
- [Question] INFO - Selected en None File(...) output HOT 4
- Not yet translated files in duplicated navigation entry
- Example not working: translation link in menu HOT 3
- Integration with mkdocs-material privacy plugin - image link invalid HOT 1
- Document how to build the documentation
- Is possible to put default language result in non-root path?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mkdocs-static-i18n.