Skip to content

Commit

Permalink
fix(folder): fix navigation detection with and without nav and fallba…
Browse files Browse the repository at this point in the history
…ck_to_default
  • Loading branch information
ultrabug committed Aug 14, 2023
1 parent a2e5f81 commit 21192df
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion mkdocs_static_i18n/folder.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,17 @@ def get_file_from_path(self, path: str) -> Optional[File]:
"""
expected_src_uri = PurePath(path)
expected_src_uris = []
# non localized paths detection (root)
if is_relative_to(expected_src_uri, self.plugin.current_language):
expected_src_uris.append(expected_src_uri.relative_to(self.plugin.current_language))
if is_relative_to(expected_src_uri, self.plugin.default_language):
elif is_relative_to(expected_src_uri, self.plugin.default_language):
expected_src_uris.append(expected_src_uri.relative_to(self.plugin.default_language))
# localized paths detection
else:
expected_src_uris.append(PurePath(self.plugin.current_language) / expected_src_uri)
# default language path detection
if self.plugin.config.fallback_to_default is True:
expected_src_uris.append(PurePath(self.plugin.default_language) / expected_src_uri)
expected_src_uris.append(expected_src_uri)
for src_uri in expected_src_uris:
file = self.src_uris.get(src_uri.as_posix())
Expand Down

0 comments on commit 21192df

Please sign in to comment.