+static struct ldaperror *ldap_errlist = ldap_builtin_errlist;
+
+void ldap_int_error_init( void ) {
+#ifdef LDAP_NLS
+#define LDAP_NLS_SDK_CAT "openldap_sdk"
+#define LDAP_NLS_LIBLDAP_SET (0)
+
+ int i;
+ nl_catd catd = catopen( LDAP_NLS_SDK_CAT, NL_CAT_LOCALE );
+
+ if( catd == -1 ) {
+ return;
+ }
+
+ for ( i=0; ldap_errlist[i].e_reason != NULL; i++ ) {
+ char *msg = catgets( catd,
+ LDAP_NLS_LIBLDAP_SET,
+ ldap_errlist[i].e_code, NULL );
+
+ if( msg != NULL ) {
+ msg = LDAP_STRDUP( msg );
+
+ if( msg != NULL ) {
+ ldap_errlist[i].e_reason = msg;
+ }
+ }
+ }
+
+ catclose( catd );
+#endif
+}
+