From d4b2053379a88aabf4a5d04f8380a09705114b94 Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Sat, 2 May 2009 10:06:09 +0000 Subject: [PATCH] 2009-05-02 12:05 UTC+0200 Viktor Szakats (harbour.01 syenar hu) * utils/hbmk2/hbmk2.prg + Added multilanguage support. Now LC_ALL, LC_MESSAGES and LANG envvar will be checked for language ID and loading of translation will be attempted from hbmk2..hbl file (not final name yet). You can compile such .hbl file by using command: > hbi18n -g -ohbmk2..hbl hbmk2..pot You can create .pot using this command: > ..\..\bin\harbour hbmk2.prg /jhbmk2-.pot /i..\..\include Where is preferable the std ISO language ID, like: pt_BR. --- harbour/ChangeLog | 12 ++++++++++++ harbour/utils/hbmk2/hbmk2.prg | 25 ++++++++++++++++++++++--- 2 files changed, 34 insertions(+), 3 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 3e1b0cc06b..2dc69d00d5 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -17,6 +17,18 @@ past entries belonging to these authors: Viktor Szakats. */ +2009-05-02 12:05 UTC+0200 Viktor Szakats (harbour.01 syenar hu) + * utils/hbmk2/hbmk2.prg + + Added multilanguage support. Now LC_ALL, LC_MESSAGES and + LANG envvar will be checked for language ID and loading + of translation will be attempted from hbmk2..hbl + file (not final name yet). You can compile such .hbl file by using + command: + > hbi18n -g -ohbmk2..hbl hbmk2..pot + You can create .pot using this command: + > ..\..\bin\harbour hbmk2.prg /jhbmk2-.pot /i..\..\include + Where is preferable the std ISO language ID, like: pt_BR. + 2009-05-02 10:52 UTC+0200 Viktor Szakats (harbour.01 syenar hu) * utils/hbmk2/hbmk2.prg ! Minor s&r error in help text. diff --git a/harbour/utils/hbmk2/hbmk2.prg b/harbour/utils/hbmk2/hbmk2.prg index aa1b5014cf..7a25bcbf42 100644 --- a/harbour/utils/hbmk2/hbmk2.prg +++ b/harbour/utils/hbmk2/hbmk2.prg @@ -311,6 +311,7 @@ FUNCTION hbmk( aArgs ) LOCAL s_aLNG LOCAL s_cVCSDIR LOCAL s_cVCSHEAD + LOCAL s_cUILNG LOCAL s_lCPP := NIL LOCAL s_lSHARED := NIL @@ -423,6 +424,24 @@ FUNCTION hbmk( aArgs ) LOCAL nStart := Seconds() + IF Empty( s_cUILNG := GetEnv( "LC_ALL" ) ) + IF Empty( s_cUILNG := GetEnv( "LC_MESSAGES" ) ) + IF Empty( s_cUILNG := GetEnv( "LANG" ) ) + s_cUILNG := "en_EN" + ENDIF + ENDIF + ENDIF + + IF !( s_cUILNG == "en_EN" ) + tmp := "${hb_root}hbmk2.${lng}.hbl" + tmp := StrTran( tmp, "${hb_root}", PathSepToSelf( DirAddPathSep( hb_DirBase() ) ) ) + tmp := StrTran( tmp, "${lng}", s_cUILNG ) + tmp := hb_MemoRead( tmp ) + IF hb_i18n_check( tmp ) + hb_i18n_set( hb_i18n_restoretable( tmp ) ) + ENDIF + ENDIF + IF Empty( aArgs ) ShowHeader() ShowHelp() @@ -5264,9 +5283,9 @@ STATIC PROCEDURE ShowHelp( lLong ) I_( " The file format is the same as .hbp." ),; I_( " - .hbp option files in current dir are automatically processed." ),; I_( " - .hbp options (they should come in separate lines):" ),; - I_( " libs=[], gt=[gtname], prgflags=[Harbour flags]" ),; - I_( " cflags=[C compiler flags], resflags=[resource compiler flags]" ),; - I_( " ldflags=[Linker flags], libpaths=[paths], pots=[.pot files]" ),; + I_( " libs=[], gt=[gtname], prgflags=[Harbour flags]," ),; + I_( " cflags=[C compiler flags], resflags=[resource compiler flags]," ),; + I_( " ldflags=[Linker flags], libpaths=[paths], pots=[.pot files]," ),; I_( " incpaths=[paths], inctrypaths=[paths]" ),; I_( " gui|mt|shared|nulrdd|debug|opt|map|strip|run|inc=[yes|no]" ),; I_( " compr=[yes|no|def|min|max], head=[off|partial|full], echo=" ),;