2
0
mirror of https://github.com/Laupetin/OpenAssetTools.git synced 2025-10-19 13:05:20 +00:00
Files
OpenAssetTools/src/ObjWriting/Game/T5/Localize/LocalizeDumperT5.cpp
2025-10-15 20:06:01 +01:00

53 lines
1.6 KiB
C++

#include "LocalizeDumperT5.h"
#include "Dumping/Localize/StringFileDumper.h"
#include "Localize/LocalizeCommon.h"
#include "Utils/Logging/Log.h"
#include <format>
#include <iostream>
using namespace T5;
namespace localize
{
DumperT5::DumperT5(const AssetPool<AssetLocalize::Type>& pool)
: AbstractSingleProgressAssetDumper(pool)
{
}
void DumperT5::Dump(AssetDumpingContext& context)
{
if (m_pool.m_asset_lookup.empty())
return;
const auto language = LocalizeCommon::GetNameOfLanguage(context.m_zone.m_language);
const auto assetFile = context.OpenAssetFile(std::format("{}/localizedstrings/{}.str", language, context.m_zone.m_name));
if (assetFile)
{
StringFileDumper stringFileDumper(context.m_zone, *assetFile);
stringFileDumper.SetLanguageName(language);
// Magic string. Original string files do have this config file. The purpose of the config file is unknown though.
stringFileDumper.SetConfigFile(R"(C:/projects/cod/t5/bin/StringEd.cfg)");
stringFileDumper.SetNotes("");
for (const auto* localizeEntry : m_pool)
{
stringFileDumper.WriteLocalizeEntry(localizeEntry->m_name, localizeEntry->Asset()->value);
}
stringFileDumper.Finalize();
}
else
{
con::error("Could not create string file for dumping localized strings of zone '{}'", context.m_zone.m_name);
}
context.IncrementProgress();
}
} // namespace localize