summaryrefslogtreecommitdiff
path: root/include/language.h
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2012-11-22 00:50:33 -0500
committerAdam <Adam@anope.org>2012-11-22 00:50:33 -0500
commitd33a0f75a5c0c584fbb7cc0076da36d494f39494 (patch)
tree7b2274cc833c793c0f5595660cbd4d715de52ffd /include/language.h
parent368d469631763e9c8bf399980d0ac7c5b5664d39 (diff)
Pretty large coding style cleanup, in source doc
cleanup, and allow protocol mods to depend on each other
Diffstat (limited to 'include/language.h')
-rw-r--r--include/language.h58
1 files changed, 57 insertions, 1 deletions
diff --git a/include/language.h b/include/language.h
index f48d9ce2d..eeb23af02 100644
--- a/include/language.h
+++ b/include/language.h
@@ -1,11 +1,67 @@
-/* Commonly used language strings
+/*
*
* (C) 2008-2012 Anope Team
* Contact us at team@anope.org
*
* Please read COPYING and README for further details.
+ *
*/
+namespace Language
+{
+
+ /* Languages we support as configured in services.conf. They are
+ * added to this list if we detect a language exists in the correct
+ * location for each language.
+ */
+ extern std::vector<Anope::string> Languages;
+
+ /* Domains to search when looking for translations other than the
+ * default "anope domain. This is used by modules who add their own
+ * language files (and thus domains) to Anope. If a module is loaded
+ * and we detect a language file exists for at least one of the supported
+ * languages for the module, then we add the module's domain (its name)
+ * here.
+ *
+ * When strings are translated they are checked against all domains.
+ */
+ extern std::vector<Anope::string> Domains;
+
+ /** Initialize the language system. Finds valid language files and
+ * populates the Languages list.
+ */
+ extern void InitLanguages();
+
+ /** Translates a string to the default language.
+ * @param string A string to translate
+ * @return The translated string if found, else the original string.
+ */
+ extern const char *Translate(const char *string);
+
+ /** Translates a string to the language of the given user.
+ * @param u The user to transate the string for
+ * @param string A string to translate
+ * @return The translated string if found, else the original string.
+ */
+ extern const char *Translate(User *u, const char *string);
+
+ /** Translates a string to the language of the given account.
+ * @param nc The account to translate the string for
+ * @param string A string to translate
+ * @return The translated string if count, else the original string
+ */
+ extern const char *Translate(const NickCore *nc, const char *string);
+
+ /** Translatesa string to the given language.
+ * @param lang The language to trnalsate to
+ * @param string The string to translate
+ * @return The translated string if found, else the original string.
+ */
+ extern const char *Translate(const char *lang, const char *string);
+
+} // namespace Language
+
+/* Commonly used language strings */
#define MORE_INFO _("\002%s%s HELP %s\002 for more information.")
#define BAD_USERHOST_MASK _("Mask must be in the form \037user\037@\037host\037.")
#define BAD_EXPIRY_TIME _("Invalid expiry time.")