Localization.SpanishUsesMinTwoGrouping
Localization.SpanishUsesMinTwoGrouping
#Overview
name: Localization.SpanishUsesMinTwoGrouping
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
False: 1234 will use a group separator, True: 1234 will not use a group separator (default).
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of Localization.SpanishUsesMinTwoGrouping is to control the number grouping behavior for Spanish localization in Unreal Engine 5. Specifically, it determines whether numbers with four digits should use a group separator or not.
This setting variable is primarily used in the Internationalization subsystem of Unreal Engine’s Core module. It affects how numbers are formatted and displayed in Spanish locales.
The value of this variable is set through a console variable (CVar) system. It is defined as a TAutoConsoleVariable with a default value of true.
The associated variable CVarSpanishUsesMinTwoGrouping directly interacts with Localization.SpanishUsesMinTwoGrouping. They share the same value and purpose.
Developers must be aware that:
- When set to true (default), numbers like 1234 will not use a group separator in Spanish localization.
- When set to false, numbers like 1234 will use a group separator.
- This setting only affects four-digit numbers; five-digit and larger numbers will still use group separators regardless of this setting.
Best practices when using this variable include:
- Consider the target audience’s preferences and expectations when deciding whether to change this setting.
- Ensure consistency across the entire application if modifying this setting.
- Test thoroughly with various number formats to ensure the desired behavior is achieved.
Regarding the associated variable CVarSpanishUsesMinTwoGrouping:
- It is an implementation detail of the Localization.SpanishUsesMinTwoGrouping setting.
- It is used internally in the ICUCulture.cpp file to apply the grouping rules.
- Developers should interact with the Localization.SpanishUsesMinTwoGrouping setting rather than directly manipulating CVarSpanishUsesMinTwoGrouping.
- The value of CVarSpanishUsesMinTwoGrouping is checked in the ExtractNumberFormattingRulesFromICUDecimalFormatter function to determine if the minimum grouping digits should be set to 2 for Spanish localization.
When working with this variable, developers should focus on the Localization.SpanishUsesMinTwoGrouping setting and use the appropriate Unreal Engine localization APIs to ensure proper number formatting across different languages and regions.
#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:25
Scope: file
Source code excerpt:
static TAutoConsoleVariable<bool> CVarSpanishUsesMinTwoGrouping(
TEXT("Localization.SpanishUsesMinTwoGrouping"),
true,
TEXT("False: 1234 will use a group separator, True: 1234 will not use a group separator (default)."),
ECVF_Default
);
namespace
#Associated Variable and Callsites
This variable is associated with another variable named CVarSpanishUsesMinTwoGrouping
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Core/Private/Internationalization/ICUCulture.cpp:24
Scope: file
Source code excerpt:
);
static TAutoConsoleVariable<bool> CVarSpanishUsesMinTwoGrouping(
TEXT("Localization.SpanishUsesMinTwoGrouping"),
true,
TEXT("False: 1234 will use a group separator, True: 1234 will not use a group separator (default)."),
ECVF_Default
);
#Loc: <Workspace>/Engine/Source/Runtime/Core/Private/Internationalization/ICUCulture.cpp:737
Scope (from outer to inner):
file
namespace anonymous
function FDecimalNumberFormattingRules ExtractNumberFormattingRulesFromICUDecimalFormatter
Source code excerpt:
// Should we use "min two" grouping for Spanish (eg, "1234" formats as "1234" rather than "1 234", but "12345" still formats as "12 345")
if (CVarSpanishUsesMinTwoGrouping.AsVariable()->GetBool())
{
NewUEDecimalNumberFormattingRules.MinimumGroupingDigits = 2;
}
}
return NewUEDecimalNumberFormattingRules;