Skip to content

Commit 7d11a82

Browse files
committed
wip
1 parent f2b3bb0 commit 7d11a82

File tree

3 files changed

+11
-5
lines changed

3 files changed

+11
-5
lines changed

docs/usage/index.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,9 +150,11 @@ plugins:
150150
[__all__]: https://docs.python.org/3/tutorial/modules.html#importing-from-a-package
151151

152152
[](){#setting-locale}
153-
#### `locale`
153+
#### ~~`locale`~~
154154

155-
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.
155+
**Deprecated.** Use mkdocstrings' own `locale` setting.
156+
157+
~~The locale to use when translating template strings.~~
156158

157159
[](){#setting-paths}
158160
#### `paths`

src/mkdocstrings_handlers/python/_internal/config.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1019,7 +1019,9 @@ class PythonInputConfig:
10191019

10201020
locale: Annotated[
10211021
str | None,
1022-
_Field(description="The locale to use when translating template strings."),
1022+
_Field(
1023+
description="Deprecated. Use mkdocstrings' own `locale` setting instead. The locale to use when translating template strings.",
1024+
),
10231025
] = None
10241026

10251027
@classmethod

src/mkdocstrings_handlers/python/_internal/handler.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ def collect(self, identifier: str, options: PythonOptions) -> CollectorItem:
278278

279279
return doc_object
280280

281-
def render(self, data: CollectorItem, options: PythonOptions) -> str:
281+
def render(self, data: CollectorItem, options: PythonOptions, locale: str | None = None) -> str:
282282
"""Render the collected data.
283283
284284
Parameters:
@@ -300,7 +300,8 @@ def render(self, data: CollectorItem, options: PythonOptions) -> str:
300300
# than as an item in a dictionary.
301301
"heading_level": options.heading_level,
302302
"root": True,
303-
"locale": self.config.locale,
303+
# YORE: Bump 2: Regex-replace ` or .+` with `,` within line.
304+
"locale": locale or self.config.locale,
304305
},
305306
)
306307

@@ -401,6 +402,7 @@ def get_handler(
401402
Parameters:
402403
handler_config: The handler configuration.
403404
tool_config: The tool (SSG) configuration.
405+
**kwargs: Additional arguments to pass to the handler.
404406
405407
Returns:
406408
An instance of `PythonHandler`.

0 commit comments

Comments
 (0)