STRU - Lists and modifies the structure of the dbfs files

You can share your experience with HMG. Share with some screenshots/project details so that others will also be benefited.

Moderator: Rathinagiri

User avatar
Pablo César
Posts: 4059
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil

STRU - Lists and modifies the structure of the dbfs files

Post by Pablo César »

Mr. Esgici, you always are very kind and a gentleman ! Thank you !
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
User avatar
mol
Posts: 3720
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Contact:

Re: STRU - Lists and modifies the structure of the dbfs file

Post by mol »

Hi Pablo!
I want to report some problems/bugs with Polish.
When opening in text mode, you should use commands:

Code: Select all

SET LANGUAGE TO POLISH
HB_CDPSELECT("PL852")
You should set as below in graphics mode:

Code: Select all

SET LANGUAGE TO POLISH
HB_CDPSELECT("PLWIN")
I've modified stru.prg in this way:

Code: Select all

Case Upper(IDIOMA)="POLISH"
SET LANGUAGE TO POLISH
SET CODEPAGE TO POLISH
HB_CDPSELECT("PL852")
everything looks good both in text and graphics mode.

I'm attaching polish.lng and polish.tln in zip file
Attachments
polish.zip
(3.54 KiB) Downloaded 364 times
User avatar
IMATECH
Posts: 188
Joined: Sun May 27, 2012 9:33 pm
Location: Brazil: Goiânia-GO.

Re: STRU - Lists and modifies the structure of the dbfs file

Post by IMATECH »

Hi All !
.
.
.
I think the better solution will bet set unicode support to this app...
A first step to do this: below ( if works: then delete any other reference like Language or Codepage )
.
.
.

.lng files need to be saved as unicode for corrrect screen show
.
.
.

Code: Select all


//*----------------------------------------------------------------------------*
//
// M., Ronaldo: 2012/10/09
//
// Class: Unicode support to Harbour app´s
//
//*----------------------------------------------------------------------------*
STATIC PROCEDURE MR_Set_Lang_and_CP()
   
   /* Terminal and OS codepage */
   hb_SetTermCP( hb_cdpTerm() )
   Set( _SET_OSCODEPAGE, hb_cdpOS() )

   /* Set language for Gui */
   hb_langSelect( hb_UserLang(), "UTF8EX" )
   hb_cdpSelect( "UTF8EX" )
   
   ? hb_langname()

   RETURN

.
.
.
Best regards
M., Ronaldo

By: IMATECH

Imation Tecnologia
User avatar
Pablo César
Posts: 4059
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil

STRU - Lists and modifies the structure of the dbfs files

Post by Pablo César »

I have tried but unsuccessfully. It is compiling without error, error only happening at runtime displaying:
Screen50.PNG
Screen50.PNG (10.79 KiB) Viewed 5023 times
I suppose that need to add #include "hbapilng.h" but another errors is coming by this include: C:\hmg.3.0.44\harbour\include\hbdefs.h(56) Error F0029 Can't open #include file 'stdarg.h'

So, I need to know what I am doing wrong... :roll:
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
User avatar
IMATECH
Posts: 188
Joined: Sun May 27, 2012 9:33 pm
Location: Brazil: Goiânia-GO.

Re: STRU - Lists and modifies the structure of the dbfs file

Post by IMATECH »

Are you using HMG 3.0.44 ?

If Yes: Try this code:

//*----------------------------------------------------------------------------*
// PROCEDURE MAIN( ... )
//*----------------------------------------------------------------------------*
PROCEDURE MAIN( ... )

...

*---------------------------------------------------------------------------*
* HMG MESSAGES - PT_BR ( uncomment for test purposes )
*---------------------------------------------------------------------------*
// SET LANGUAGE TO PORTUGUESE
// SET CODEPAGE TO PORTUGUESE

*---------------------------------------------------------------------------*
* UNICODE SUPPORT
*---------------------------------------------------------------------------*
MR_Set_Lang_and_CP()

...
RETURN

//*----------------------------------------------------------------------------*
// HB_GTSYS()
//*----------------------------------------------------------------------------*
PROCEDURE HB_GTSYS()

REQUEST HB_LANG_PT
REQUEST HB_CODEPAGE_PT850

RETURN
M., Ronaldo

By: IMATECH

Imation Tecnologia
User avatar
Pablo César
Posts: 4059
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil

Re: STRU - Lists and modifies the structure of the dbfs file

Post by Pablo César »

Chacal.GO wrote:Are you using HMG 3.0.44 ?
Yes

I have tested by your tow indications, taking off (making like comments) like as:
// SET LANGUAGE TO PORTUGUESE
// SET CODEPAGE TO PORTUGUESE

then

MR_Set_Lang_and_CP()

But the result is not correct displayed when STRU is in console mode. Even using:

cText_to_be_displayed := hb_translate( cStr, "PT850", "UTF8")
Screen51.PNG
Screen51.PNG (22.11 KiB) Viewed 5236 times
The strange is when I try to use by this way:

cText_to_be_displayed := hb_translate( cStr, hb_UserLang(), "UTF8") // this is with error when try to compile.

Anyway seems is not going to work properly even lng files been in Unicode.
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
User avatar
IMATECH
Posts: 188
Joined: Sun May 27, 2012 9:33 pm
Location: Brazil: Goiânia-GO.

Re: STRU - Lists and modifies the structure of the dbfs file

Post by IMATECH »

Hi Pablo !

Why are you using hb_translate ?

Just use sources and .lng files saved as Unicode...
Any modern editor support this feature...

cText_to_be_displayed := cStr

Alert( cText_to_be_displayed )
M., Ronaldo

By: IMATECH

Imation Tecnologia
User avatar
Pablo César
Posts: 4059
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil

STRU - Lists and modifies the structure of the dbfs file

Post by Pablo César »

Chacal.GO wrote:Why are you using hb_translate ?
Because my files is still in Ansi mode. This function should not translate to Unicode ?
Just use sources and .lng files saved as Unicode...
Any modern editor support this feature...
I made your sugestion. I saved portuguese.lng in UTF-8 format. But now is with another kind of error. Does not recognize "&"... see error:
Screen52.PNG
Screen52.PNG (9.58 KiB) Viewed 5231 times
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
User avatar
IMATECH
Posts: 188
Joined: Sun May 27, 2012 9:33 pm
Location: Brazil: Goiânia-GO.

Re: STRU - Lists and modifies the structure of the dbfs file

Post by IMATECH »

Hi Pablo !


I have downloaded your project for case study....

When understand core logic will make some tests, and give a new reply...


regards...
M., Ronaldo

By: IMATECH

Imation Tecnologia
User avatar
IMATECH
Posts: 188
Joined: Sun May 27, 2012 9:33 pm
Location: Brazil: Goiânia-GO.

Re: STRU - Lists and modifies the structure of the dbfs file

Post by IMATECH »

Hi Pablo !


My 1st choice was not to use HB_TRANSLATE(), but whithout this I can't make this sample work correctly


Below a minimal sample for correct use of Ansi Files to UTF8

Code: Select all

//
// HBMK2 file.prg -gtwin -gui
//

REQUEST HB_LANG_PT
REQUEST HB_CODEPAGE_UTF8

PROCEDURE Main()
   LOCAL cFile
   LOCAL cText

   /* Set language for Screen */
   hb_langSelect( hb_UserLang(), "UTF8EX" )
   hb_cdpSelect( "UTF8EX" )

   /* Terminal and OS codepage */
   // hb_SetTermCP( "UTF8EX" )
   hb_SetTermCP( hb_cdpTerm() )
   Set( _SET_OSCODEPAGE, hb_cdpOS() )

   SETMODE( 62, 164 )

   CLS

   cFile := 'English.Lng'
   cText := MemoRead( cFile )
   alert( cFile + ';;' + HB_TRANSLATE(  cText ,"EN", "UTF8" ) )

   cFile := 'French.Lng'
   cText := MemoRead( cFile )
   alert( cFile + ';;' + HB_TRANSLATE(  cText ,"FRISO", "UTF8" ) )

   cFile := 'Italian.Lng'
   cText := MemoRead( cFile )
   alert( cFile + ';;' + HB_TRANSLATE(  cText ,"ITISO", "UTF8" ) )

   cFile := 'Polish.lng'
   cText := MemoRead( cFile )
   alert( cFile + ';;' + HB_TRANSLATE(  cText ,"PLWIN", "UTF8" ) )

   cFile := 'Portuguese.Lng'
   cText := MemoRead( cFile )
   alert( cFile + ';;' + HB_TRANSLATE(  cText ,"PTISO", "UTF8" ) )

   cFile := 'Spanish.Lng'
   cText := MemoRead( cFile )
   alert( cFile + ';;' + HB_TRANSLATE(  cText ,"ESISO", "UTF8" ) )

   cFile := 'Turkish.Lng'
   cText := MemoRead( cFile )
   alert( cFile + ';;' + HB_TRANSLATE(  cText ,"TRWIN", "UTF8" ) )

   RETURN

M., Ronaldo

By: IMATECH

Imation Tecnologia
Post Reply