aboutsummaryrefslogtreecommitdiff
path: root/Src/Wasabi/api/locales/xlatstr.h
diff options
context:
space:
mode:
authorJean-Francois Mauguit <jfmauguit@mac.com>2024-09-24 09:03:25 -0400
committerGitHub <noreply@github.com>2024-09-24 09:03:25 -0400
commitbab614c421ed7ae329d26bf028c4a3b1d2450f5a (patch)
tree12f17f78986871dd2cfb0a56e5e93b545c1ae0d0 /Src/Wasabi/api/locales/xlatstr.h
parent4bde6044fddf053f31795b9eaccdd2a5a527d21f (diff)
parent20d28e80a5c861a9d5f449ea911ab75b4f37ad0d (diff)
downloadwinamp-bab614c421ed7ae329d26bf028c4a3b1d2450f5a.tar.gz
Merge pull request #5 from WinampDesktop/community
Merge to main
Diffstat (limited to 'Src/Wasabi/api/locales/xlatstr.h')
-rw-r--r--Src/Wasabi/api/locales/xlatstr.h68
1 files changed, 68 insertions, 0 deletions
diff --git a/Src/Wasabi/api/locales/xlatstr.h b/Src/Wasabi/api/locales/xlatstr.h
new file mode 100644
index 00000000..aca8dac1
--- /dev/null
+++ b/Src/Wasabi/api/locales/xlatstr.h
@@ -0,0 +1,68 @@
+#ifndef _XLATSTR_H
+#define _XLATSTR_H
+
+#include <api/locales/localesmgr.h>
+
+/**
+ Provides string translation for the string
+ used as the constructor parameter.
+
+ The constructor will automatically lookup
+ the translated value of the string it receives
+ in the currently loaded locale.
+
+ @short Translates a string using the currently loaded locale.
+ @author Nullsoft
+ @ver 1.0
+ @see ComponentAPI::locales_getTranslation()
+*/
+
+class _ {
+ public:
+ /**
+ Automatically looks up the translated value of the string
+ it receives as a parameter in the currently loaded
+ locale. The same string is returned if there's no
+ translation.
+
+ @param str String to be translated.
+ @ret Translation found, Translated string; Translation not found, Input string;
+ */
+
+#if defined(WASABI_COMPILE_LOCALES)
+ _(const wchar_t *str) { s=LocalesManager::getTranslation(str); }
+#else
+ _(const wchar_t *str) { s=str; }
+#endif
+ operator const wchar_t *() const { return s; }
+
+ private:
+ const wchar_t *s;
+};
+
+
+class __ {
+ public:
+ /**
+ Automatically looks up the translated value of the string
+ it receives as a parameter in the currently loaded
+ locale. The same string is returned if there's no
+ translation.
+
+ @param str String to be translated.
+ @ret Translation found, Translated string; Translation not found, Input string;
+ */
+
+#if defined(WASABI_COMPILE_LOCALES)
+ __(const wchar_t *str) { s=LocalesManager::lookupString(str); }
+#else
+ __(const wchar_t *str) { s=str; }
+#endif
+ operator const wchar_t *() const { return s; }
+
+ private:
+ const wchar_t *s;
+};
+
+
+#endif \ No newline at end of file