24 lines
575 B
C++
24 lines
575 B
C++
#pragma once
|
|||
|
|
|
||
|
|
#include <string>
|
||
|
|
|
||
|
|
#include "i18n/catalog.hpp"
|
||
|
|
|
||
|
|
namespace molo::i18n {
|
||
|
|
|
||
|
|
struct PoLoadResult {
|
||
|
|
Catalog catalog = Catalog(Locale::english());
|
||
|
|
std::string error;
|
||
|
|
bool ok() const { return error.empty(); }
|
||
|
|
};
|
||
|
|
|
||
|
|
// GNU gettext PO loader: msgid, msgstr, msgid_plural, msgstr[n], msgctxt,
|
||
|
|
// translator comments (#), multiline strings, C escapes.
|
||
|
|
class PoLoader {
|
||
|
|
public:
|
||
|
|
static PoLoadResult load_file(const std::string& path, const Locale& locale);
|
||
|
|
static PoLoadResult load_text(const std::string& text, const Locale& locale);
|
||
|
|
};
|
||
|
|
|
||
|
|
} // namespace molo::i18n
|