context-based translation test

This commit is contained in:
MihailRis
2023-12-12 22:59:21 +03:00
parent 4e6818fb7f
commit e97eb441d5
5 changed files with 48 additions and 54 deletions
+9
View File
@@ -131,3 +131,12 @@ void langs::setup(const path& resdir,
const wstring& langs::get(const wstring& key) {
return current->get(key);
}
const wstring& langs::get(const wstring& key, const wstring& context) {
wstring ctxkey = context + L"." + key;
const wstring& text = current->get(ctxkey);
if (&ctxkey != &text) {
return text;
}
return current->get(key);
}