Closed kamilkrzyskow closed 10 months ago
Uh oh o_O, the commits got duplicated?
I had to fetch the current main branch and cherry-pick the commits, because the hash of c41bb168232eea3c9d37c4b7841794ecec4c70f2 and 037001a30161a6acc80303855a14084aca051eb9 changed after the PR, because you rebased (?) on your local PC and then pushed to upstream? Dark magic of git, I guess. It's best to just merge via the GitHub interface :v:
Installed this PR using pip install git+https://github.com/kamilkrzyskow/i18n.git@fix/folder-file-lookup
and used it on my docs (The ones I encountered this issue with outlined in #277).
The logs don't show any errors and the links seem to be properly translated now to the right page, as can be seen at the bottom of the logs here, where I navigated to the page using the embedded links on the index page.
$ mkdocs serve
INFO - Building documentation...
INFO - theme_overrides_manager: Theme overrides manager initialized
INFO - mkdocs_static_i18n: Building 'en' documentation to directory: C:\Users\*******\AppData\Local\Temp\mkdocs_ia8jef9_
INFO - Cleaning site directory
INFO - language_flags: Registered processors
INFO - theme_overrides_manager: Backing up 1 file...
INFO - theme_overrides_manager: Restoring 1 file...
INFO - theme_overrides_manager: Theme overrides manager initialized
INFO - mkdocs_static_i18n: Building 'de-CH' documentation to directory: C:\Users\*******\AppData\Local\Temp\mkdocs_ia8jef9_\de-CH
INFO - mkdocs_static_i18n: Language 'de-CH' is not supported by lunr.js, not setting it in the 'plugins.search.lang' option
INFO - mkdocs_static_i18n: Overriding 'de-CH' config 'copyright' with 'Dokumentation mit
<img alt="\u2764" class="twemoji heart-anim md-footer-custom-text" src="https://twemoji.maxcdn.com/v/latest/svg/2764.svg" title="Liebe">
gemacht und unter der
<a href="https://github.com/purrbot-site/Docs/blob/master/LICENSE" target="_blank" rel="nofollow">MIT-Lizenz</a> verf▒gbar.
'
INFO - mkdocs_static_i18n: Updating 'de-CH' config 'extra' with '{'translate': {'missing_translation': 'Diese Seite wurde noch nicht ▒bersetzt.', 'not_translatable': 'Diese Seite kann nicht ▒bersetzt werden und ist darum nur auf Englisch verf▒gbar.', 'footer': 'Erstellt mit <a href="https://www.mkdocs.org" target="_blank" rel="noopener">MkDocs</a>,\n<a href="https://squidfunk.github.io/mkdocs-material" target="_blank" rel="noopener">Material for MkDocs</a> und\n<a href="https://facelessuser.github.io/pymdown-extensions/" target="_blank" rel="noopener">Pymdown Extensions</a>.\n'}}'
INFO - mkdocs_static_i18n: Overriding 'de-CH' config 'site_description' with 'API-Dokumentation und Wiki von *Purr*'
INFO - mkdocs_static_i18n: Overriding 'de-CH' config 'site_name' with 'PurrBot Dokumentation'
INFO - mkdocs_static_i18n: Translated 4 navigation elements to 'de-CH'
INFO - language_flags: Registered processors
INFO - theme_overrides_manager: Backing up 1 file...
INFO - theme_overrides_manager: Restoring 1 file...
INFO - Documentation built in 4.52 seconds
INFO - [14:40:05] Watching paths for changes: 'docs', 'mkdocs.yml', 'theme'
INFO - [14:40:05] Serving on http://127.0.0.1:8000/
INFO - [14:40:16] Browser connected: http://127.0.0.1:8000/
INFO - [14:41:13] Browser connected: http://127.0.0.1:8000/de-CH/
INFO - [14:41:15] Browser connected: http://127.0.0.1:8000/de-CH/api/
INFO - [14:41:18] Browser connected: http://127.0.0.1:8000/de-CH/legal/
INFO - [14:41:28] Browser connected: http://127.0.0.1:8000/de-CH/legal/bot/
So this fix seems to work. :thumbsup:
I've not yet looked at this since I said I was going to work on the blog plugin support first.
I've been struggling with how the plugin detects translated files when they've been generated (like the blog do) so I've decided to switch from basing the detection logic from dest_uri to src_uri in #279
I'd thus like #279 to be merged first, then get this PR reviewed and merged. Get a release on the road, and get back to work on the blog support.
Hope that's okay?
If you could give #279 a try, that would be great to confirm that I'm not breaking anything!
I won't have access to a PC to test it today so perhaps @Andre601 could check out that other branch
Thanks @kamilkrzyskow I'll make a release with that
Fixes #277
Fixed the obvious issues, but when I wanted to delete this additional fallback path it creates warnings for missing nav files:
So I kept it around, and therefore it still generates an invalid path sometimes:
I don't know what would be a good solution, to avoid any warnings and avoid such
default/current/.../file.md
paths, but for now it's enough to patch it.