Skip to content

Commit 7a41062

Browse files
Update crowdin script to use suffixed overloads. (#57)
1 parent 425aeb9 commit 7a41062

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

scripts/crowdin_convert.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -271,9 +271,14 @@ def handle_docstring(self, node: ast.AST, name: str) -> None:
271271
key_root = ".".join([*self.key, name])
272272
key = key_root
273273
suffix = 1
274-
while key in self.used_keys:
275-
key = f"{key_root}-{suffix}"
276-
suffix += 1
274+
if isinstance(node, ast.FunctionDef): # ctx.id
275+
for decorator in node.decorator_list:
276+
if hasattr(decorator, "id"):
277+
if decorator.id == "overload":
278+
key = f"{key}-{suffix}"
279+
while key in self.used_keys:
280+
suffix += 1
281+
key = f"{key_root}-{suffix}"
277282
self.used_keys.add(key)
278283
update_docstring(node, key, en_json, translated_json)
279284

0 commit comments

Comments
 (0)