mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-10 05:21:49 +00:00
context-based translation test
This commit is contained in:
parent
4e6818fb7f
commit
e97eb441d5
5 changed files with 48 additions and 54 deletions
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -56,6 +56,8 @@ namespace langs {
|
|||
std::vector<const ContentPack*>& packs);
|
||||
|
||||
extern const std::wstring& get(const std::wstring& key);
|
||||
extern const std::wstring& get(const std::wstring& key,
|
||||
const std::wstring& context);
|
||||
|
||||
extern void setup(const std::filesystem::path& resdir,
|
||||
const std::string& locale,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue