Moved C++ tools out
This commit is contained in:
36
archive/dawntools/util/Language.cpp
Normal file
36
archive/dawntools/util/Language.cpp
Normal 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;
|
||||
}
|
Reference in New Issue
Block a user