* "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. */
| 5746 | * to allow dehardcoding it in the XML and doing proper substitutions everywhere. |
| 5747 | */ |
| 5748 | String 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 |
nothing calls this directly
no test coverage detected