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

Function TTRN

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

* "Tools TRanslate for N items". Performs string replacement for * internationalization within the editor. A translation context can optionally * be specified to disambiguate between identical source strings in * translations. Use `TTR()` if the string doesn't need dynamic plural form. * When placeholders are desired, use * `vformat(TTRN("%d item", "%d items", some_integer), some_integer)`.

Source from the content-addressed store, hash-verified

5706 * For translations that can be supplied by exported projects, use `RTRN()` instead.
5707 */
5708String TTRN(const String& p_text, const String& p_text_plural, int p_n, const String& p_context)
5709{
5710 if (TranslationServer::get_singleton())
5711 {
5712 return TranslationServer::get_singleton()->tool_translate_plural(p_text, p_text_plural, p_n, p_context);
5713 }
5714
5715 // Return message based on English plural rule if translation is not possible.
5716 if (p_n == 1)
5717 {
5718 return p_text;
5719 }
5720 return p_text_plural;
5721}
5722
5723/**
5724 * "Docs TRanslate". Used for the editor class reference documentation,

Callers

nothing calls this directly

Calls 1

get_singletonFunction · 0.85

Tested by

no test coverage detected