aboutsummaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
authorShauren <shauren.trinity@gmail.com>2021-05-03 20:09:39 +0200
committerShauren <shauren.trinity@gmail.com>2021-05-03 23:53:24 +0200
commit67e16888ac76d144fab7433b542d660b13e7cb62 (patch)
treea79271b1fcc2f56eec88f02357c95d3cdee2a3a2 /src/common
parent14098b28b39bc9d1ea17d18a7ecd3dd610f29cdc (diff)
Core/Chat: Chat translation improvements
* Remove hyperlinks from translated chat messages * Implement case preservation rules depending on receiver client locale
Diffstat (limited to 'src/common')
-rw-r--r--src/common/Utilities/Util.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/common/Utilities/Util.h b/src/common/Utilities/Util.h
index 1060f5d090f..78672c22b12 100644
--- a/src/common/Utilities/Util.h
+++ b/src/common/Utilities/Util.h
@@ -291,6 +291,24 @@ inline wchar_t wcharToLower(wchar_t wchar)
return wchar;
}
+inline bool isLower(wchar_t wchar)
+{
+ if (wchar >= L'a' && wchar <= L'z') // LATIN CAPITAL LETTER A - LATIN CAPITAL LETTER Z
+ return true;
+ if (wchar >= 0x00E0 && wchar <= 0x00FF) // LATIN SMALL LETTER A WITH GRAVE - LATIN SMALL LETTER Y WITH DIAERESIS
+ return true;
+ if (wchar >= 0x0430 && wchar <= 0x044F) // CYRILLIC SMALL LETTER A - CYRILLIC SMALL LETTER YA
+ return true;
+ if (wchar == 0x0451) // CYRILLIC SMALL LETTER IO
+ return true;
+ return false;
+}
+
+inline bool isUpper(wchar_t wchar)
+{
+ return !isLower(wchar);
+}
+
TC_COMMON_API std::wstring wstrCaseAccentInsensitiveParse(std::wstring const& wstr, LocaleConstant locale);
TC_COMMON_API void wstrToUpper(std::wstring& str);