summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorSadie Powell <sadie@witchery.services>2024-11-13 02:28:36 +0000
committerSadie Powell <sadie@witchery.services>2024-11-13 02:48:13 +0000
commit2e6c90d5023cfcce36cebf0823df73f0bfd940c1 (patch)
tree98c7dcbd6aab12f75cc97a239d70e509b40e211c /include
parent127ea3e68a4d8a5d7177a8bb6b16bf06c2312cbe (diff)
Add support for plural form translation.
Closes #340.
Diffstat (limited to 'include')
-rw-r--r--include/language.h37
-rw-r--r--include/services.h1
2 files changed, 37 insertions, 1 deletions
diff --git a/include/language.h b/include/language.h
index 5d2e28bb5..9b91d49c9 100644
--- a/include/language.h
+++ b/include/language.h
@@ -55,13 +55,48 @@ namespace Language
*/
extern CoreExport const char *Translate(const NickCore *nc, const char *string);
- /** Translatesa string to the given language.
+ /** Translates a string to the given language.
* @param lang The language to translate to
* @param string The string to translate
* @return The translated string if found, else the original string.
*/
extern CoreExport const char *Translate(const char *lang, const char *string);
+ /** Translates a plural string to the default language.
+ * @param count The number of items the string is counting.
+ * @param singular The string to translate if there is one of \p count
+ * @param plural The string to translate if there is multiple of \p count
+ * @return The translated string if found, else the original string.
+ */
+ extern CoreExport const char *Translate(int count, const char *singular, const char *plural);
+
+ /** Translates a plural string to the language of the given user.
+ * @param u The user to translate the string for
+ * @param count The number of items the string is counting.
+ * @param singular The string to translate if there is one of \p count
+ * @param plural The string to translate if there is multiple of \p count
+ * @return The translated string if found, else the original string.
+ */
+ extern CoreExport const char *Translate(User *u, int count, const char *singular, const char *plural);
+
+ /** Translates a plural string to the language of the given account.
+ * @param nc The account to translate the string for
+ * @param count The number of items the string is counting.
+ * @param singular The string to translate if there is one of \p count
+ * @param plural The string to translate if there is multiple of \p count
+ * @return The translated string if count, else the original string
+ */
+ extern CoreExport const char *Translate(const NickCore *nc, int count, const char *singular, const char *plural);
+
+ /** Translates a plural string to the given language.
+ * @param lang The language to translate to
+ * @param count The number of items the string is counting.
+ * @param singular The string to translate if there is one of \p count
+ * @param plural The string to translate if there is multiple of \p count
+ * @return The translated string if found, else the original string.
+ */
+ extern CoreExport const char *Translate(const char *lang, int count, const char *singular, const char *plural);
+
} // namespace Language
/* Commonly used language strings */
diff --git a/include/services.h b/include/services.h
index e8875daa5..ce5ce0296 100644
--- a/include/services.h
+++ b/include/services.h
@@ -40,6 +40,7 @@
#define BUFSIZE 1024
#define _(x) x
+#define N_(x, y) x, y
#ifndef _WIN32
# define DllExport __attribute__ ((visibility ("default")))