Utility Functions

Localization Tool 带有一些方便的功能来控制游戏中的本地化:

Localization Tool comes with some convenient features to control localization in the game:

Setting Text in C++

			FText Text = LOCALIZATION_TEXT("SwitchButton");
		
The parameter in LOCALIZATION_TEXT is a Key in the csv configuration table. It searches all CSVs and assigns the value. However, if you have Keys with duplicate names, this method may produce incorrect results.
			FText Text = NLOCALIZATION_TEXT("DemoLocalization", "SwitchButton");
		
NLOCALIZATION_TEXT: This method is more optimized and can perform lookups more accurately.
Parameter 1 is the relative path of the csv configuration table, and it can be the csv filename because it performs a substring search; if you have duplicate names in two folders, such as A/Menu.csv and B/Menu.csv, and you want to use the Key in B/Menu.csv, you can use NLOCALIZATION_TEXT("B.Menu", "SwitchButton_en"); to assign the value. When the system concatenates names, it converts / to . for processing.
Parameter 2: the Key in the csv configuration table.

Get Available Languages

Returns a list of language codes that the system can use. This comes from the multiple language-xx column configurations in the csv file.
未知区块:uploadLoader
			GET_LOCALIZATION_TOOL().GetAvailableLanguages();
ULocalizationToolLibrary::GetAvailableLanguage();
		

Get Current Language

Returns the code of the language currently in use.
未知区块:uploadLoader
未知区块:uploadLoader
			GET_LOCALIZATION_TOOL().GetCurrentLanguage();
ULocalizationToolLibrary::GetCurrentLanguage();
		

Can Set Language

Checks whether a language with the given language code can be set.
未知区块:uploadLoader
未知区块:uploadLoader
			GET_LOCALIZATION_TOOL().CanSetLanguage(TEXT("en"));
ULocalizationToolLibrary::CanSetLanguage(FLanguageCategory(TEXT("en")));
		

Set Language

Sets the language using the given language code. If the language cannot be set, returns false.
未知区块:uploadLoader
			GET_LOCALIZATION_TOOL().SetLanguage(TEXT("en"));
ULocalizationToolLibrary::SetLanguage(FLanguageCategory(TEXT("en")));
		

Comments

Table of Contents