These nouns might have one gender in one language, and a different gender in another language. This is important for languages with grammar rules for gender, as it allows your translators to switch their translation based on the gender (see Gender Forms).Īvoid injecting nouns for objects (such as "table," "door," or "chair"), or be prepared to make them localizable. When injecting a personal noun, make sure you include an argument for the gender of the person. When you use plural forms, the sentence is correctly translated for languages that do not share the plural rules of your source language. When injecting a number that affects the sentence, handle these variances using the plural forms argument modifiers, rather than branching in code. "|hpp(은,는)" Text Formatting Best Practices These are specified as a pipe followed by the function name and arguments. For example:įormat placeholders can also specify a function (called an "argument modifier") to run on their argument data. Text formatting provides a way to combine text in a way that is easier to localize, by using a localizable format pattern that injects real text to replace format placeholders.įormat placeholders are contained within a pair of curly braces, and can be numbers (for index-based formatting) or strings (for name-based formatting). It is also fine to use the default namespace or key. A key is generated for you automatically, but you can define a custom namespace or key for your text by using the advanced combo next to the text field. Text literals can be created using FText properties. Text literals can be created in INI files using the NSLOCTEXT macro syntax. #undef LOCTEXT_NAMESPACE Creating Text Literals in INI Files Undefine the namespace before the end of the file This is only valid within a single file, and must be undefined before the end of the fileĬonstFTextHelloWorld= NSLOCTEXT("MyOtherNamespace","HelloWorld","Hello World!")ĬonstFTextGoodbyeWorld= LOCTEXT("GoodbyeWorld","Goodbye World!") 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 |