localization udpates

This commit is contained in:
honzapatCZ
2021-08-23 19:30:13 +02:00
parent d4a4ae996e
commit d493eb9ada
8 changed files with 112 additions and 22 deletions

View File

@@ -5,6 +5,7 @@
#include "Engine/Content/JsonAsset.h"
#include "Engine/Core/Collections/Array.h"
#include "Engine/Core/Collections/Dictionary.h"
#include "Engine/Content/AssetReference.h"
/// <summary>
/// Contains localized strings table for a given culture.
@@ -19,6 +20,11 @@ public:
/// </summary>
API_FIELD() String Locale;
/// <summary>
/// The fallback table used if we couldnt find the key here
/// </summary>
API_FIELD() AssetReference<LocalizedStringTable> FallbackTable;
/// <summary>
/// The string table. Maps the message id into the localized text. For plural messages the list contains separate items for value numbers.
/// </summary>
@@ -40,6 +46,26 @@ public:
/// <param name="n">The plural value (0, 1, 2..).</param>
API_FUNCTION() void AddPluralString(const StringView& id, const StringView& value, int32 n);
/// <summary>
/// Gets the localized string for the current language by using string id lookup.
/// </summary>
/// <param name="id">The message identifier.</param>
/// <param name="fallback">The optional fallback string value to use if localized string is missing.</param>
/// <returns>The localized text.</returns>
API_FUNCTION() String GetString(const String& id);
/// <summary>
/// Gets the localized plural string for the current language by using string id lookup.
/// </summary>
/// <param name="id">The message identifier.</param>
/// <param name="n">The value count for plural message selection.</param>
/// <param name="fallback">The optional fallback string value to use if localized string is missing.</param>
/// <returns>The localized text.</returns>
API_FUNCTION() String GetPluralString(const String& id, int32 n);
#if USE_EDITOR
/// <summary>