Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions docs/usage/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -150,9 +150,11 @@ plugins:
[__all__]: https://docs.python.org/3/tutorial/modules.html#importing-from-a-package

[](){#setting-locale}
#### `locale`
#### ~~`locale`~~

The locale to use when translating template strings. The translation system is not fully ready yet, so we don't recommend setting the option for now.
**Deprecated.** Use mkdocstrings' own `locale` setting.

~~The locale to use when translating template strings.~~

[](){#setting-paths}
#### `paths`
Expand Down
4 changes: 3 additions & 1 deletion src/mkdocstrings_handlers/python/_internal/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -1019,7 +1019,9 @@ class PythonInputConfig:

locale: Annotated[
str | None,
_Field(description="The locale to use when translating template strings."),
_Field(
description="Deprecated. Use mkdocstrings' own `locale` setting instead. The locale to use when translating template strings.",
),
] = None

@classmethod
Expand Down
6 changes: 4 additions & 2 deletions src/mkdocstrings_handlers/python/_internal/handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ def collect(self, identifier: str, options: PythonOptions) -> CollectorItem:

return doc_object

def render(self, data: CollectorItem, options: PythonOptions) -> str:
def render(self, data: CollectorItem, options: PythonOptions, locale: str | None = None) -> str:
"""Render the collected data.

Parameters:
Expand All @@ -300,7 +300,8 @@ def render(self, data: CollectorItem, options: PythonOptions) -> str:
# than as an item in a dictionary.
"heading_level": options.heading_level,
"root": True,
"locale": self.config.locale,
# YORE: Bump 2: Regex-replace ` or .+` with `,` within line.
"locale": locale or self.config.locale,
},
)

Expand Down Expand Up @@ -401,6 +402,7 @@ def get_handler(
Parameters:
handler_config: The handler configuration.
tool_config: The tool (SSG) configuration.
**kwargs: Additional arguments to pass to the handler.

Returns:
An instance of `PythonHandler`.
Expand Down
Loading