MCPcopy Create free account
hub / github.com/SakuraEngine/SakuraEngine / DTRN

Function DTRN

modules/gui/gui/src/backend/text_server/ustring.cpp:5748–5764  ·  view source on GitHub ↗

* "Docs TRanslate for N items". Used for the editor class reference documentation * (with support for plurals), handling descriptions extracted from the XML. * It also replaces `$DOCS_URL` with the actual URL to the documentation's branch, * to allow dehardcoding it in the XML and doing proper substitutions everywhere. */

Source from the content-addressed store, hash-verified

5746 * to allow dehardcoding it in the XML and doing proper substitutions everywhere.
5747 */
5748String DTRN(const String& p_text, const String& p_text_plural, int p_n, const String& p_context)
5749{
5750 const String text = p_text.dedent().strip_edges();
5751 const String text_plural = p_text_plural.dedent().strip_edges();
5752
5753 if (TranslationServer::get_singleton())
5754 {
5755 return String(TranslationServer::get_singleton()->doc_translate_plural(text, text_plural, p_n, p_context)).replace("$DOCS_URL", VERSION_DOCS_URL);
5756 }
5757
5758 // Return message based on English plural rule if translation is not possible.
5759 if (p_n == 1)
5760 {
5761 return text.replace("$DOCS_URL", VERSION_DOCS_URL);
5762 }
5763 return text_plural.replace("$DOCS_URL", VERSION_DOCS_URL);
5764}
5765#endif
5766
5767} // namespace godot

Callers

nothing calls this directly

Calls 5

get_singletonFunction · 0.85
strip_edgesMethod · 0.80
dedentMethod · 0.80
StringClass · 0.70
replaceMethod · 0.45

Tested by

no test coverage detected