mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-04-23 09:35:45 +00:00
44 lines
1.3 KiB
C++
44 lines
1.3 KiB
C++
#include "AssetDumperLocalizeEntry.h"
|
|
|
|
#include "Dumping/Localize/StringFileDumper.h"
|
|
#include "Localize/LocalizeCommon.h"
|
|
|
|
#include <sstream>
|
|
|
|
using namespace T5;
|
|
|
|
void AssetDumperLocalizeEntry::DumpPool(AssetDumpingContext& context, AssetPool<LocalizeEntry>* pool)
|
|
{
|
|
if (pool->m_asset_lookup.empty())
|
|
return;
|
|
|
|
const auto language = LocalizeCommon::GetNameOfLanguage(context.m_zone->m_language);
|
|
|
|
std::ostringstream ss;
|
|
ss << language << "/localizedstrings/" << context.m_zone->m_name << ".str";
|
|
const auto assetFile = context.OpenAssetFile(ss.str());
|
|
|
|
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 (auto* localizeEntry : *pool)
|
|
{
|
|
stringFileDumper.WriteLocalizeEntry(localizeEntry->m_name, localizeEntry->Asset()->value);
|
|
}
|
|
|
|
stringFileDumper.Finalize();
|
|
}
|
|
else
|
|
{
|
|
printf("Could not create string file for dumping localized strings of zone '%s'\n", context.m_zone->m_name.c_str());
|
|
}
|
|
}
|