// Copyright (c) 2012-2021 Wojciech Figat. All rights reserved.
#pragma once
#include "Engine/Content/JsonAsset.h"
#include "Engine/Core/Collections/Dictionary.h"
///
/// Contains localized strings table for a given culture.
///
///
API_CLASS(NoSpawn) class FLAXENGINE_API LocalizedStringTable : public JsonAssetBase
{
DECLARE_ASSET_HEADER(LocalizedStringTable);
public:
///
/// The locale of the localized string table (eg. pl-PL).
///
API_FIELD() String Locale;
///
/// The string table. Maps the message id into the localized text. For plural messages the list contains separate items for value numbers.
///
API_FIELD() Dictionary> Entries;
public:
///
/// Adds the localized string to the table.
///
/// The message id. Used for lookups.
/// The localized text.
API_FUNCTION() void AddString(const StringView& id, const StringView& value);
///
/// Adds the localized plural string to the table.
///
/// The message id. Used for lookups.
/// The localized text.
/// The plural value (0, 1, 2..).
API_FUNCTION() void AddPluralString(const StringView& id, const StringView& value, int32 n);
#if USE_EDITOR
///
/// Saves this asset to the file. Supported only in Editor.
///
/// The custom asset path to use for the saving. Use empty value to save this asset to its own storage location. Can be used to duplicate asset. Must be specified when saving virtual asset.
/// True if cannot save data, otherwise false.
API_FUNCTION() bool Save(const StringView& path = StringView::Empty);
#endif
protected:
// [JsonAssetBase]
LoadResult loadAsset() override;
void unload(bool isReloading) override;
};