godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
91.44k stars 21.27k forks source link

POT translation genaration ignores `TranslationServer.translate()` #96998

Open aXu-AP opened 2 months ago

aXu-AP commented 2 months ago

Tested versions

Any 4.x

System information

Windows 11

Issue description

POT generator ignores strings that are translated via TranslationServer.translate() or TranslationServer.translate_plural().

Steps to reproduce

Minimal reproduction project (MRP)

POT-MRP.zip

aXu-AP commented 2 months ago

One possible solution here is to add "translate" to https://github.com/godotengine/godot/blob/6681f2563b99e14929a8acb27f4908fece398ef1/modules/gdscript/editor/gdscript_translation_parser_plugin.cpp#L279

But there's a catch: user might introduce their own translate function, which would be added to the translation file if the signature matches (fortunately, Node2D.translate gets ignored). Technically, same can be said of tr or atr for example, so I don't know if it's so bad.

AThousandShips commented 2 months ago

As per the documentation only tr, atr, and tr_n are searched for strings, and some special methods, and it's likely due to the inexact nature of translate as a string, and it'd be error prone likely