What I did for my install was the following:

moved the "MAIN CODE" section in lang_api.php to a new file: lang_load_strings.php

then in core.php:

        # Load internationalization functions
        require_once( $t_core_path.'lang_api.php' );
        # Load the actual language strings
        require( $t_core_path.'lang_load_strings.php' );

        # error functions should be loaded to allow database to print errors
        require_once( $t_core_path.'html_api.php' );
        require_once( $t_core_path.'error_api.php' );

(... code ...)

        # DATABASE WILL BE OPENED HERE!!  THE DATABASE SHOULDN'T BE EXPLICITLY
        # OPENED ANYWHERE ELSE.
        require_once( $t_core_path.'database_api.php' );

        # Load language strings now localized
        require( $t_core_path.'lang_load_strings.php' );

*********

this way first lang_api and lang_load_strings define the language functions and load the strings. Since we got no db yet, they fall back to english (or the language defined in $g_default_language with a little change to that section of lang_load_strings.php). Then after we require database_api.php we require lang_load_strings.php again, which now will load the localized strings.

That way we get to handle the db errors using error_api and handle the rest of the error with the localized strings at the same time.

What do you guys think?

Ariel


> -----Original Message-----
> From: Julian Fitzell [mailto:julian@beta4.com]
> Sent: Friday, January 31, 2003 4:41 AM
> To: jlatour@users.sourceforge.net
> Cc: mantisbt-dev@lists.sourceforge.net
> Subject: [Mantisbt-dev] Re: [Mantisbt-cvs] mantisbt core.php,1.16,1.17
>
>
> This was the commit a few days ago from Ariel (beerfrick, not
> vboctor as
> I had said):
>
> ---------------------
> Modified Files:
>       core.php
> Log Message:
> moved the loading of lang_api.php to after database_api.php
> because functions in lang_api.php issue db calls.
> this fixed the bug where language strings were not being loaded.
>
> ------------------
>
> Is this not a problem jeroen?
>
> I think we need to get rid of this circular dependency.  lang_api
> depends on database_api, database_api depends on error_api, and
> error_api depends on lang_api.  The only place I can see to break the
> cycle is between database_api and error_api (which is a dependency I
> introduce a few months back).
>
> So I propose:
>
> - database_api contines to use trigger_error() but passes in a string
> (in english) rather than an error number.  This shouldn't be a huge
> problem since the error text we are getting from MySQL will
> presumably
> be in english anyway (or at least in the locale of the server).  Then
> database_api should no longer depend on error_api but errors
> will still
> be displayed using our custom handler as long as it is present.
>
> Thoughts anyone?
>
> Julian
>
> jlatour@users.sourceforge.net wrote:
> > Update of /cvsroot/mantisbt/mantisbt
> > In directory sc8-pr-cvs1:/tmp/cvs-serv32543
> >
> > Modified Files:
> >     core.php
> > Log Message:
> > Changed the include order of the core libraries, to (again)
> allow the database connection errors to be displayed.
> >
> > Index: core.php
> > ===================================================================
> > RCS file: /cvsroot/mantisbt/mantisbt/core.php,v
> > retrieving revision 1.16
> > retrieving revision 1.17
> > diff -u -d -r1.16 -r1.17
> > --- core.php        29 Jan 2003 15:56:42 -0000      1.16
> > +++ core.php        31 Jan 2003 07:43:54 -0000      1.17
> > @@ -65,6 +65,9 @@
> >     # load utility functions used by everything else
> >     require_once( $t_core_path.'utility_api.php' );
> >    
> > +   # Load internationalization functions (needed before
> database_api, in case database connection fails)
> > +   require_once( $t_core_path.'lang_api.php' );
> > +
> >     # error functions should be loaded to allow database to
> print errors
> >     require_once( $t_core_path.'html_api.php' );
> >     require_once( $t_core_path.'error_api.php' );
> > @@ -79,9 +82,6 @@
> >     # DATABASE WILL BE OPENED HERE!!  THE DATABASE
> SHOULDN'T BE EXPLICITLY
> >     # OPENED ANYWHERE ELSE.
> >     require_once( $t_core_path.'database_api.php' );
> > -
> > -   # Load internationalization functions
> > -   require_once( $t_core_path.'lang_api.php' );
> > 
> >     # SEND USER-DEFINED HEADERS
> >     foreach( config_get( 'custom_headers' ) as $t_header ) {
> >
> >
> >
> >
> > -------------------------------------------------------
> > This SF.NET email is sponsored by:
> > SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See!
> > http://www.vasoftware.com
> > _______________________________________________
> > Mantisbt-cvs mailing list
> > Mantisbt-cvs@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/mantisbt-cvs
>
>
> --
> julian@beta4.com
> Beta4 Productions (http://www.beta4.com)
>
>
>
> -------------------------------------------------------
> This SF.NET email is sponsored by:
> SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See!
> http://www.vasoftware.com
> _______________________________________________
> Mantisbt-dev mailing list
> Mantisbt-dev@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/mantisbt-dev
>

*****************************************************************
Los comentarios plasmados en este correo son del remitente solamente y no reflejan
necesariamente la posición de Banistmo y subsidiarias.
*****************************************************************
The opinions above are those of their author and do not necessarily reflect the position
of Banistmo and subsidiaries.
*****************************************************************