From: Modestas Vainius <modestas@vainius.eu>
Subject: [PATCH] Make Amarok use locally installed errsys.msg

This patch makes Amarok MySQLe use locally installed errsys.msg
(by amarok-common package) instead of global MySQL one which
might not be available if mysql-server is not installed.

--- a/src/core-impl/collections/db/sql/mysqlecollection/MySqlEmbeddedStorage.cpp
+++ b/src/core-impl/collections/db/sql/mysqlecollection/MySqlEmbeddedStorage.cpp
@@ -27,6 +27,11 @@
 #include <QThreadStorage>
 #include <QVarLengthArray>
 
+#include <KStandardDirs>
+
+#define MYSQLE_ERRMSG_FILENAME "errmsg.sys"
+#define MYSQLE_ERRMSG_LOCAL_DIR "amarok/mysqle"
+
 #include <mysql.h>
 
 MySqlEmbeddedStorage::MySqlEmbeddedStorage( const QString &storageLocation )
@@ -37,6 +42,7 @@ MySqlEmbeddedStorage::MySqlEmbeddedStora
     QString storagePath = storageLocation;
     QString defaultsFile;
     QString databaseDir;
+    QString languageDataDir;
     if( storageLocation.isEmpty() )
     {
         storagePath = Amarok::saveLocation();
@@ -50,6 +56,7 @@ MySqlEmbeddedStorage::MySqlEmbeddedStora
         defaultsFile = QDir::cleanPath( dir.absoluteFilePath( "my.cnf" ) );
         databaseDir = dir.absolutePath() + QDir::separator() + "mysqle";
     }
+    languageDataDir = KGlobal::dirs()->findResourceDir( "data", MYSQLE_ERRMSG_LOCAL_DIR "/" MYSQLE_ERRMSG_FILENAME );
 
     if( !Amarok::config( "MySQLe" ).readEntry( "keepUserMyCnf", false ) )
     {
@@ -70,6 +77,8 @@ MySqlEmbeddedStorage::MySqlEmbeddedStora
         out << "key_buffer_size = 16777216" << endl; // (16Mb)
         out << "character-set-server = utf8" << endl;
         out << "collation-server = utf8_bin" << endl;
+        if (!languageDataDir.isNull())
+            out << "language = " << languageDataDir.toAscii() << MYSQLE_ERRMSG_LOCAL_DIR << endl;
         //If the file is world-writable MySQL won't even read it
         df.setPermissions( QFile::ReadOwner | QFile::WriteOwner | QFile::ReadGroup | QFile::ReadOther );
         df.close();
