![]() Text literals can be created in C++ by using the LOCTEXT family of macros.Ĭreates a localized piece of text by defining the namespace, key, and source string.Ĭreates a localized piece of text by defining the key and source string, with the namespace being defined with LOCTEXT_NAMESPACE.Įxample: // Define the namespace to use with LOCTEXT The most common way to create localizable text in UE4 is by using a text literal. Localizable text is made up of three components: a namespace a key (which form its identity) and a source string (which is the basis of what gets translated, and acts as validation against "stale" translations). The INVTEXT macro can do the same thing for literal strings. If you need text that not localizable (such as converting a player name from an external API into something you can display in your UI), you can use FText::AsCultureInvariant, which produces an FText instance that has no localization data (and cannot be localized). Text histories support the culture-correct rebuilding of text, and and also form the key component for the following: This variance is handled by the internal "text history" ( FTextHistory). The data held within FText instances varies, depending on how the FText was created. This makes it very cheap to copy, and the FTextSnapshot utility provides an efficient way to detect if a cached FText value has actually changed. ![]() Internally, FText is implemented as a TSharedRef to an ITextData. This should be used when you have user-facing text that needs to be localized. It is a specialized string, represented by the FText type in C++. Text in Unreal Engine 4 (UE4) is the primary component for localization. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |