-
Notifications
You must be signed in to change notification settings - Fork 35
Expand file tree
/
Copy pathCopyOperationNames.cpp
More file actions
74 lines (72 loc) · 2.08 KB
/
CopyOperationNames.cpp
File metadata and controls
74 lines (72 loc) · 2.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#include "CopyOperationNames.h"
#include <Windows.h>
#include <algorithm>
static std::wstring getDefaultLanguage()
{
ULONG bytes{};
ULONG numLanguages{};
GetUserPreferredUILanguages(MUI_LANGUAGE_NAME, &numLanguages, nullptr, &bytes);
std::wstring buffer(bytes, {});
GetUserPreferredUILanguages(MUI_LANGUAGE_NAME, &numLanguages, buffer.data(), &bytes);
return std::wstring{ buffer.data() };
}
CopyOperationNames& CopyOperationNames::GetInstance()
{
static CopyOperationNames s_instance = []
{
auto defaultLang = getDefaultLanguage();
std::transform(defaultLang.begin(), defaultLang.end(), defaultLang.begin(), [](wchar_t c) { return towlower(c); });
if (defaultLang == L"en-us")
{
return CopyOperationNames
{
.Copy = L"Copy",
.Move = L"Move",
.Paste = L"Paste",
.Delete = L"Delete"
};
}
else if (defaultLang == L"zh-cn")
{
return CopyOperationNames
{
.Copy = L"复制",
.Move = L"剪切",
.Paste = L"粘贴",
.Delete = L"删除"
};
}
else if (defaultLang == L"de-de")
{
return CopyOperationNames
{
.Copy = L"Kopieren",
.Move = L"Verschieben",
.Paste = L"Einfügen",
.Delete = L"Löschen"
};
}
else if (defaultLang == L"es-es")
{
return CopyOperationNames
{
.Copy = L"Copiar",
.Move = L"Mover",
.Paste = L"Pegar",
.Delete = L"Borrar"
};
}
else if (defaultLang == L"zh-tw")
{
return CopyOperationNames
{
.Copy = L"複製",
.Move = L"移動",
.Paste = L"貼上",
.Delete = L"刪除"
};
}
//Add more languages here
}();
return s_instance;
}