UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
ICUInternationalization.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2#pragma once
3
4#include "CoreTypes.h"
5#include "Containers/Array.h"
7#include "Containers/Set.h"
8#include "Containers/Map.h"
10#include "Templates/UniquePtr.h"
11#include "Templates/PimplPtr.h"
12
13class FCultureFilter;
15
16#if UE_ENABLE_ICU
17
19 #include <unicode/umachine.h>
21 #include <unicode/gregocal.h> // icu::Calendar can be affected by the non-standard packing UE4 uses, so force the platform default
24
25// This should be defined by ICU.build.cs
26#ifndef NEEDS_ICU_DLLS
27 #define NEEDS_ICU_DLLS 0
28#endif
29
31{
32public:
34
35 bool Initialize();
36 void Terminate();
37
38 void LoadAllCultureData();
39
40 bool IsCultureRemapped(const FString& Name, FString* OutMappedCulture);
41 bool IsCultureAllowed(const FString& Name);
42
43 void RefreshCultureDisplayNames(const TArray<FString>& InPrioritizedDisplayCultureNames);
44 void RefreshCachedConfigData();
45
46 void HandleLanguageChanged(const FCultureRef InNewLanguage);
47 void GetCultureNames(TArray<FString>& CultureNames) const;
48 TArray<FString> GetPrioritizedCultureNames(const FString& Name);
49 FCulturePtr GetCulture(const FString& Name);
50
52
53private:
54#if NEEDS_ICU_DLLS
55 void LoadDLLs();
56 void UnloadDLLs();
57#endif
58
62
63 enum class EAllowDefaultCultureFallback : uint8 { No, Yes, };
66
67 void InitializeTimeZone();
69
70private:
71 struct FICUCultureData
72 {
73 FString Name;
74 FString LanguageCode;
75 FString ScriptCode;
76 FString CountryCode;
77
78 bool operator==(const FICUCultureData& Other) const
79 {
80 return Name == Other.Name;
81 }
82
83 bool operator!=(const FICUCultureData& Other) const
84 {
85 return Name != Other.Name;
86 }
87 };
88
89private:
90 FInternationalization* const I18N;
91
93 FString ICUDataDirectory;
94
98
101
104
107
110
112
113 static UBool OpenDataFile(const void* InContext, void** OutFileContext, void** OutContents, const char* InPath);
114 static void CloseDataFile(const void* InContext, void* const InFileContext, void* const InContents);
115
116 // Tidy class for storing the count of references for an ICU data file and the file's data itself.
117 struct FICUCachedFileData
118 {
119 FICUCachedFileData(const int64 FileSize);
122
123 FICUCachedFileData(const FICUCachedFileData&) = delete;
124 FICUCachedFileData& operator=(const FICUCachedFileData&) = delete;
125
126 uint32 ReferenceCount;
127 void* Buffer;
128 };
129
130 // Map for associating ICU data file paths with cached file data, to prevent multiple copies of immutable ICU data files from residing in memory.
133};
134
135#endif
FPlatformTypes::int64 int64
A 64-bit signed integer.
Definition Platform.h:1127
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
UE::FPlatformRecursiveMutex FCriticalSection
Definition CriticalSection.h:53
#define THIRD_PARTY_INCLUDES_START
Definition GenericPlatformCompilerPreSetup.h:63
UE_FORCEINLINE_HINT bool operator!=(const FIndexedPointer &Other) const
Definition LockFreeList.h:76
#define PRAGMA_POP_PLATFORM_DEFAULT_PACKING
Definition MSVCPlatformCompilerPreSetup.h:229
#define PRAGMA_PUSH_PLATFORM_DEFAULT_PACKING
Definition MSVCPlatformCompilerPreSetup.h:223
uint8_t uint8
Definition binka_ue_file_header.h:8
uint32_t uint32
Definition binka_ue_file_header.h:6
Definition CultureFilter.h:12
Definition Internationalization.h:24
Definition Array.h:670
Definition UnrealString.h.inl:34
Definition SharedPointer.h:153
Definition UniquePtr.h:107
Definition Voronoi.cpp:10
bool operator==(const FCachedAssetKey &A, const FCachedAssetKey &B)
Definition AssetDataMap.h:501
Definition DateTime.h:76
Definition PimplPtr.h:50