summaryrefslogtreecommitdiff
path: root/src/resources/db
diff options
context:
space:
mode:
Diffstat (limited to 'src/resources/db')
-rw-r--r--src/resources/db/languagedb.cpp37
-rw-r--r--src/resources/db/languagedb.h2
2 files changed, 34 insertions, 5 deletions
diff --git a/src/resources/db/languagedb.cpp b/src/resources/db/languagedb.cpp
index e4bbffea4..b7e3ebc0e 100644
--- a/src/resources/db/languagedb.cpp
+++ b/src/resources/db/languagedb.cpp
@@ -31,7 +31,9 @@
namespace
{
std::string mDefaultIcon;
- std::map<int, std::string> mLanguages;
+ std::string mDefaultPo;
+ std::map<int, std::string> mIcons;
+ std::map<int, std::string> mPo;
} // namespace
void LanguageDb::load()
@@ -74,7 +76,23 @@ void LanguageDb::loadXmlFile(const std::string &fileName,
continue;
}
const std::string icon = XML::getProperty(node, "icon", "");
- mLanguages[id] = icon;
+ const std::string po = XML::getProperty(node, "po", "");
+ if (icon.empty())
+ {
+ reportAlways("LanguageDb: empty icon field");
+ }
+ else
+ {
+ mIcons[id] = icon;
+ }
+ if (po.empty())
+ {
+ reportAlways("LanguageDb: empty po field");
+ }
+ else
+ {
+ mPo[id] = po;
+ }
}
}
@@ -83,13 +101,22 @@ void LanguageDb::loadXmlFile(const std::string &fileName,
void LanguageDb::unload()
{
- mLanguages.clear();
+ mIcons.clear();
+ mPo.clear();
}
const std::string &LanguageDb::getIcon(const int id)
{
- std::map<int, std::string>::const_iterator it = mLanguages.find(id);
- if (it == mLanguages.end())
+ std::map<int, std::string>::const_iterator it = mIcons.find(id);
+ if (it == mIcons.end())
return mDefaultIcon;
return (*it).second;
}
+
+const std::string &LanguageDb::getPo(const int id)
+{
+ std::map<int, std::string>::const_iterator it = mPo.find(id);
+ if (it == mPo.end())
+ return mDefaultPo;
+ return (*it).second;
+}
diff --git a/src/resources/db/languagedb.h b/src/resources/db/languagedb.h
index 18302a451..8f33576a6 100644
--- a/src/resources/db/languagedb.h
+++ b/src/resources/db/languagedb.h
@@ -37,6 +37,8 @@ namespace LanguageDb
void unload();
const std::string &getIcon(const int id);
+
+ const std::string &getPo(const int id);
} // namespace LanguageDB
#endif // RESOURCES_DB_LANGUAGEDB_H