2012-12-23 23:23:24 +04:00
|
|
|
#ifndef COMPONENTS_TRANSLATION_DATA_H
|
|
|
|
#define COMPONENTS_TRANSLATION_DATA_H
|
|
|
|
|
|
|
|
#include <components/files/collections.hpp>
|
|
|
|
#include <components/to_utf8/to_utf8.hpp>
|
|
|
|
|
2012-12-26 17:06:33 +01:00
|
|
|
namespace Translation
|
2012-12-23 23:23:24 +04:00
|
|
|
{
|
|
|
|
class Storage
|
|
|
|
{
|
|
|
|
public:
|
2014-09-26 17:12:48 +02:00
|
|
|
Storage();
|
2012-12-23 23:23:24 +04:00
|
|
|
|
2023-05-21 18:14:12 +02:00
|
|
|
void loadTranslationData(const Files::Collections& dataFileCollections, std::string_view esmFileName);
|
2012-12-23 23:23:24 +04:00
|
|
|
|
2023-05-21 18:14:12 +02:00
|
|
|
std::string_view translateCellName(std::string_view cellName) const;
|
|
|
|
std::string_view topicID(std::string_view phrase) const;
|
2012-12-23 23:23:24 +04:00
|
|
|
|
2012-12-31 04:15:47 +04:00
|
|
|
// Standard form usually means nominative case
|
2023-05-21 18:14:12 +02:00
|
|
|
std::string_view topicStandardForm(std::string_view phrase) const;
|
2012-12-31 04:15:47 +04:00
|
|
|
|
2013-01-06 01:37:58 +01:00
|
|
|
void setEncoder(ToUTF8::Utf8Encoder* encoder);
|
2012-12-26 17:03:37 +01:00
|
|
|
|
2012-12-31 04:15:47 +04:00
|
|
|
bool hasTranslation() const;
|
|
|
|
|
2012-12-23 23:23:24 +04:00
|
|
|
private:
|
2023-05-21 18:14:12 +02:00
|
|
|
typedef std::map<std::string, std::string, std::less<>> ContainerType;
|
2012-12-23 23:23:24 +04:00
|
|
|
|
|
|
|
void loadData(ContainerType& container, const std::string& fileNameNoExtension, const std::string& extension,
|
|
|
|
const Files::Collections& dataFileCollections);
|
|
|
|
|
|
|
|
void loadDataFromStream(ContainerType& container, std::istream& stream);
|
|
|
|
|
2013-01-06 01:37:58 +01:00
|
|
|
ToUTF8::Utf8Encoder* mEncoder;
|
2012-12-31 04:15:47 +04:00
|
|
|
ContainerType mCellNamesTranslations, mTopicIDs, mPhraseForms;
|
2012-12-23 23:23:24 +04:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|