Moved C++ tools out

This commit is contained in:
2023-10-31 21:15:03 -05:00
parent f8a715ec78
commit 343f75433e
98 changed files with 5 additions and 16 deletions

View File

@ -0,0 +1,36 @@
// Copyright (c) 2023 Dominic Masters
//
// This software is released under the MIT License.
// https://opensource.org/licenses/MIT
#include "Language.hpp"
using namespace Dawn;
int32_t languageSaveStrings(
std::string languagesDir,
std::vector<struct LanguageString> strings
) {
if(languagesDir.size() <= 0) {
std::cout << "Languages dir is not defined" << std::endl;
return 1;
}
File file(languagesDir);
if(!file.mkdirp()) {
std::cout << "Failed to create languages string output dir " << file.filename << std::endl;
return 1;
}
// Now convert to xml
std::string buffer;
auto it = strings.begin();
while(it != strings.end()) {
auto s = *it;
buffer += s.lang + "|" + s.key + "|" + s.text + "|";
++it;
}
file.writeString(buffer);
return 0;
}