Localization.UseLocaleSpecificDigitCharacters

Localization.UseLocaleSpecificDigitCharacters

#Overview

name: Localization.UseLocaleSpecificDigitCharacters

This variable is created as a Console Variable (cvar).

It is referenced in 3 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of Localization.UseLocaleSpecificDigitCharacters is to control the use of locale-specific digit characters in Unreal Engine’s localization system.

This setting variable is primarily used by the Internationalization subsystem of Unreal Engine, specifically within the ICU (International Components for Unicode) culture implementation.

The value of this variable is set through a console variable (CVar) named CVarUseLocaleSpecificDigitCharacters. It is defined in the ICUCulture.cpp file and initialized with a default value of true.

The associated variable CVarUseLocaleSpecificDigitCharacters directly interacts with Localization.UseLocaleSpecificDigitCharacters. They share the same value and purpose.

Developers must be aware that this variable affects how numbers are displayed in localized content. When set to true (default), the engine will use digit characters specified in the CLDR (Common Locale Data Repository) data for each locale. When set to false, Arabic digit characters (0-9) will be used universally across all locales.

Best practices when using this variable include:

  1. Consider the target audience and their expectations for number representation.
  2. Test thoroughly with various locales to ensure correct number formatting.
  3. Document any changes to this setting, as it can significantly impact the user experience across different regions.

Regarding the associated variable CVarUseLocaleSpecificDigitCharacters:

Developers should be cautious when modifying this variable at runtime, as it can lead to inconsistent number representations within the same session if changed mid-execution. It’s generally safer to set this value at startup and maintain it throughout the application’s lifecycle.

#References in C++ code

#Callsites

This variable is referenced in the following C++ source code:

#Loc: <Workspace>/Engine/Source/Runtime/Core/Private/Internationalization/ICUCulture.cpp:11

Scope: file

Source code excerpt:


static TAutoConsoleVariable<bool> CVarUseLocaleSpecificDigitCharacters(
	TEXT("Localization.UseLocaleSpecificDigitCharacters"),
	true,
	TEXT("False: Locales will always use Arabic digit characters (eg, 1234), True: Locales will use the digit characters specified in their CLDR data (default)."),
	ECVF_Default
	);

static TAutoConsoleVariable<bool> CVarSpanishUsesRAENumberFormat(

#Associated Variable and Callsites

This variable is associated with another variable named CVarUseLocaleSpecificDigitCharacters. They share the same value. See the following C++ source code.

#Loc: <Workspace>/Engine/Source/Runtime/Core/Private/Internationalization/ICUCulture.cpp:10

Scope: file

Source code excerpt:

#include "HAL/IConsoleManager.h"

static TAutoConsoleVariable<bool> CVarUseLocaleSpecificDigitCharacters(
	TEXT("Localization.UseLocaleSpecificDigitCharacters"),
	true,
	TEXT("False: Locales will always use Arabic digit characters (eg, 1234), True: Locales will use the digit characters specified in their CLDR data (default)."),
	ECVF_Default
	);

#Loc: <Workspace>/Engine/Source/Runtime/Core/Private/Internationalization/ICUCulture.cpp:693

Scope (from outer to inner):

file
namespace    anonymous
function     FDecimalNumberFormattingRules ExtractNumberFormattingRulesFromICUDecimalFormatter

Source code excerpt:

#endif

	if (CVarUseLocaleSpecificDigitCharacters.AsVariable()->GetBool())
	{
		NewUEDecimalNumberFormattingRules.DigitCharacters[0]		= ExtractFormattingSymbolAsCharacter(icu::DecimalFormatSymbols::kZeroDigitSymbol,	TEXT('0'));
		NewUEDecimalNumberFormattingRules.DigitCharacters[1]		= ExtractFormattingSymbolAsCharacter(icu::DecimalFormatSymbols::kOneDigitSymbol,	TEXT('1'));
		NewUEDecimalNumberFormattingRules.DigitCharacters[2]		= ExtractFormattingSymbolAsCharacter(icu::DecimalFormatSymbols::kTwoDigitSymbol,	TEXT('2'));
		NewUEDecimalNumberFormattingRules.DigitCharacters[3]		= ExtractFormattingSymbolAsCharacter(icu::DecimalFormatSymbols::kThreeDigitSymbol,	TEXT('3'));
		NewUEDecimalNumberFormattingRules.DigitCharacters[4]		= ExtractFormattingSymbolAsCharacter(icu::DecimalFormatSymbols::kFourDigitSymbol,	TEXT('4'));