fix: fix content cached between languages
This commit is contained in:
parent
e898505125
commit
8591ae53fa
|
|
@ -33,10 +33,12 @@ class ContentDirectory(Content):
|
|||
for item in self.path.glob(pattern):
|
||||
yield self.load(str(item.relative_to(self.path)))
|
||||
|
||||
@cache # noqa: B019
|
||||
def __load_children(self, name: str) -> Content:
|
||||
child_path = self.__get_localized_path(self.path / name)
|
||||
return self.__load_path(child_path)
|
||||
|
||||
@cache # noqa: B019
|
||||
def __load_path(self, child_path: Path) -> Content:
|
||||
if not child_path.exists():
|
||||
raise FileNotFoundError(child_path)
|
||||
|
||||
|
|
@ -56,6 +58,7 @@ class ContentDirectory(Content):
|
|||
if Content.current_language is None:
|
||||
return path
|
||||
localized_path = path.with_name(f"{path.stem}-{Content.current_language}{path.suffix}")
|
||||
print(localized_path)
|
||||
if not localized_path.exists():
|
||||
return path
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue