Changeset 114 for trunk/Lucide


Ignore:
Timestamp:
Sep 3, 2006, 8:22:53 AM (15 years ago)
Author:
Eugene Romanenko
Message:

Lucide's i18n now respects 'territory' modifier for 'LANG' env var.

Location:
trunk/Lucide/SOURCE/gui
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Lucide/SOURCE/gui/intern.cpp

    r91 r114  
    2222 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
    2323 * in which case the provisions of the LGPL are applicable instead of those
    24  * above. If you wish to allow use of your version of this file only under the 
     24 * above. If you wish to allow use of your version of this file only under the
    2525 * terms of the LGPL, and not to allow others to use your version of this file
    2626 * under the terms of the CDDL, indicate your decision by deleting the
    2727 * provisions above and replace them with the notice and other provisions
    2828 * required by the LGPL. If you do not delete the provisions above, a recipient
    29  * may use your version of this file under the terms of any one of the CDDL 
     29 * may use your version of this file under the terms of any one of the CDDL
    3030 * or the LGPL.
    3131 *
     
    135135}
    136136
    137 static const char *lfilespec1 = "%sLUCIDE_%s.LNG";
    138 static const char *lfilespec2 = "%sLUCIDE.LNG";
     137static const char *lfilespec1 = "%sLUCIDE_%s_%s.LNG";
     138static const char *lfilespec2 = "%sLUCIDE_%s.LNG";
     139static const char *lfilespec3 = "%sLUCIDE.LNG";
    139140
    140141void loadLang()
     
    156157    afbuf lfile( _MAX_PATH );
    157158
    158     snprintf( lfile.buffer, lfile.getSize(), lfilespec1, appdir, "EN" );
     159    snprintf( lfile.buffer, lfile.getSize(), lfilespec2, appdir, "EN" );
    159160    if ( access( lfile.buffer, F_OK ) == 0 ) {
    160161        loadLng( langDefault, lfile.buffer, true );
    161162    }
    162163    else {
    163         snprintf( lfile.buffer, lfile.getSize(), lfilespec2, appdir );
     164        snprintf( lfile.buffer, lfile.getSize(), lfilespec3, appdir );
    164165        loadLng( langDefault, lfile.buffer, true );
    165166    }
     
    169170        return;
    170171    }
     172
     173    // Find language specifier
    171174    char *upos = strchr( lng, '_' );
    172175    if ( upos == NULL ) {
     
    180183    memset( lngSpec, 0, sizeof( lngSpec ) );
    181184    strncpy( lngSpec, lng, lngSpecLen );
    182     if ( stricmp( lngSpec, "EN" ) != 0 )
    183     {
    184         snprintf( lfile.buffer, lfile.getSize(), lfilespec1, appdir, lngSpec );
     185
     186    // Find territory specifier
     187    char *lrest = upos + 1;
     188    char terrSpec[ 4 ];
     189    memset( terrSpec, 0, sizeof( terrSpec ) );
     190    if ( strlen( lrest ) >= 2 ) {
     191        strncpy( terrSpec, lrest, 2 );
     192    }
     193
     194    bool nlsLoaded = false;
     195    if ( terrSpec[0] != 0 )
     196    {
     197        // First, search the file with territory specifier
     198        snprintf( lfile.buffer, lfile.getSize(), lfilespec1, appdir, lngSpec, terrSpec );
     199        if ( access( lfile.buffer, F_OK ) == 0 ) {
     200            // File with territory specifier exist, load it
     201            loadLng( langCurrent, lfile.buffer, false );
     202            nlsLoaded = true;
     203        }
     204
     205    }
     206    if ( !nlsLoaded )
     207    {
     208        // File with territory specifier not found, load file without territory specifier
     209        snprintf( lfile.buffer, lfile.getSize(), lfilespec2, appdir, lngSpec );
    185210        loadLng( langCurrent, lfile.buffer, false );
    186211    }
  • trunk/Lucide/SOURCE/gui/makefile

    r103 r114  
    22
    33TEST=0
    4 VERSION=Beta 3
     4VERSION=Beta 4
    55
    66!if $(TEST)==1
Note: See TracChangeset for help on using the changeset viewer.