summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2012-12-15 21:35:38 -0500
committerAdam <Adam@anope.org>2012-12-15 21:35:38 -0500
commit8e3ab0d10b8f1d7683d4301b66e6c0609995cff1 (patch)
tree316bb65021b91c9e981d4712cbe62dc1f99a1965
parentb6407afa06917910732966ea3c49ac4bd7850fe4 (diff)
Made all langauges default to the UTF-8 charset
-rw-r--r--data/nickserv.example.conf6
-rw-r--r--src/language.cpp30
2 files changed, 19 insertions, 17 deletions
diff --git a/data/nickserv.example.conf b/data/nickserv.example.conf
index fd624d24a..cbd0734d6 100644
--- a/data/nickserv.example.conf
+++ b/data/nickserv.example.conf
@@ -125,14 +125,16 @@ nickserv
* A list of languages to load on startup that will be available in /nickserv set language.
* Useful if you translate Anope to your language. (Explained further in docs/LANGUAGE).
* Note that english should not be listed here because it is the base language.
+ *
+ * Removing .UTF-8 will instead use the default encoding for the language, eg. iso-8859-1 for western European languages.
*/
- languages = "ca_ES de_DE el_GR es_ES fr_FR hu_HU it_IT nl_NL pl_PL pt_PT ru_RU tr_TR"
+ languages = "ca_ES.UTF-8 de_DE.UTF-8 el_GR.UTF-8 es_ES.UTF-8 fr_FR.UTF-8 hu_HU.UTF-8 it_IT.UTF-8 nl_NL.UTF-8 pl_PL.UTF-8 pt_PT.UTF-8 ru_RU.UTF-8 tr_TR.UTF-8"
/*
* Default language that non- and newly-registered nicks will receive messages in.
* Leave empty to default to English.
*/
- #defaultlanguage = "es_ES"
+ #defaultlanguage = "es_ES.UTF-8"
/*
* The minimum length of time between consecutive uses of NickServ's REGISTER command. This
diff --git a/src/language.cpp b/src/language.cpp
index 1e1f9e704..62e5de90d 100644
--- a/src/language.cpp
+++ b/src/language.cpp
@@ -29,28 +29,28 @@ void Language::InitLanguages()
Log(LOG_DEBUG) << "Initializing Languages...";
Languages.clear();
+
+ if (!bindtextdomain("anope", Anope::LocaleDir.c_str()))
+ Log() << "Error calling bindtextdomain, " << Anope::LastError();
+ else
+ Log(LOG_DEBUG) << "Successfully bound anope to " << Anope::LocaleDir;
+
+ setlocale(LC_ALL, "");
+
spacesepstream sep(Config->Languages);
Anope::string language;
-
while (sep.GetToken(language))
{
- if (!IsFile(Anope::LocaleDir + "/" + language + "/LC_MESSAGES/anope.mo"))
+ const Anope::string &lang_name = Translate(language.c_str(), "English");
+ if (lang_name == "English")
{
- Log() << "Error loading language " << language << ", file does not exist!";
+ Log() << "Unable to use language " << language;
+ continue;
}
- else
- {
- Log(LOG_DEBUG) << "Found language file " << language;
- Languages.push_back(language);
- }
- }
- if (!bindtextdomain("anope", Anope::LocaleDir.c_str()))
- Log() << "Error calling bindtextdomain, " << Anope::LastError();
- else
- Log(LOG_DEBUG) << "Successfully bound anope to " << Anope::LocaleDir;
-
- setlocale(LC_ALL, "");
+ Log(LOG_DEBUG) << "Found language " << language;
+ Languages.push_back(language);
+ }
#else
Log() << "Unable to initialize languages, gettext is not installed";
#endif