Page 14 of 19
Re: STRU - Lists and modifies the structure of the dbfs file
Posted: Thu Oct 11, 2012 5:33 pm
by IMATECH
Hi Pablo !
Back to my 1st choice: If files was previous saved as UTF8 we don't need to use translations
Thanks to 'vszakats' that remember me about this simple fact
Code: Select all
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 + ';;' + cText )
cFile := 'French.Lng'
cText := MemoRead( cFile )
alert( cFile + ';;' + cText )
cFile := 'Italian.Lng'
cText := MemoRead( cFile )
alert( cFile + ';;' + cText )
cFile := 'Polish.lng'
cText := MemoRead( cFile )
alert( cFile + ';;' + cText )
cFile := 'Portuguese.Lng'
cText := MemoRead( cFile )
alert( cFile + ';;' + cText )
cFile := 'Spanish.Lng'
cText := MemoRead( cFile )
alert( cFile + ';;' + cText )
cFile := 'Turkish.Lng'
cText := MemoRead( cFile )
alert( cFile + ';;' + cText )
RETURN
STRU - Lists and modifies the structure of the dbfs file
Posted: Fri Oct 12, 2012 3:58 am
by Pablo César
Chacal.GO wrote:I have downloaded your project for case study....
When understand core logic will make some tests, and give a new reply...
Ronaldo, I thought that you had understood my source code, mas you not are considering format in the Portuguese.Lng file which is constructed with 135 lines and are in quotes because I need keeping same quantity of space characters in the length. And still giving some errors (as it was mentioned in my previous msg) for this reason.
Another question is STRU can be run in console and GUI modes. Not only in console.
Here in attached file are files of simplified examples with same STRU´S question.
Re: STRU - Lists and modifies the structure of the dbfs file
Posted: Fri Oct 12, 2012 4:55 am
by IMATECH
Hi Pablo !
.
.
.
Unicode support will work fine on any gui/console projects ( off course: all source need to be unicode ready too )
Then you need to re-write some of your functions...
Try to replace your function: MakeLangArry
.
.
.
Code: Select all
//*----------------------------------------------------------------------------*
//
// M., Ronaldo <ronmesq@gmail.com> 2012/10/12
//
// Function MR_FileUTF8_To_Array( cLangFile )
//
// Uses: hbMisc
//
//*----------------------------------------------------------------------------*
Function MR_FileUTF8_To_Array( cLangFile )
Local aLines := {}
LOCAL oFile := TFileRead():New( cFile )
oFile:Open()
IF !( oFile:Error() )
WHILE oFile:MoreToRead()
Aadd(aLines, TRIM( oFile:ReadLine() ) )
END
Endif
oFile:Close()
Return( aLines )
.
.
.
Finally
I sugest you to change language files format: as ini files saved as utf8 ( in case of any line missing you can use a default value for your array elements )
.
.
.
Regards
STRU - Lists and modifies the structure of the dbfs files
Posted: Fri Oct 12, 2012 2:28 pm
by Pablo César
In console mode it is working OK but in GUI not:

- Screen53.PNG (9.42 KiB) Viewed 5467 times
Portuguese.Lng in attached compressed file is in UTF-8 format. Some strange characters in first element is been wrongly displayed.
I sugest you to change language files format: as ini files saved as utf8
But do you believe that is possible to keep spaces without triming ? As example see 17 element.
Re: STRU - Lists and modifies the structure of the dbfs file
Posted: Fri Oct 12, 2012 2:50 pm
by esgici
Hi Ronaldo and Pablo
IMHO writing international applications banned by Harbour management team a short time ago
Saudação
Re: STRU - Lists and modifies the structure of the dbfs file
Posted: Fri Oct 12, 2012 4:12 pm
by IMATECH
Hi Esgici !
.
.
.
IMHO writing international applications banned by Harbour management team a short time ago
.
.
.
! Madness !
Harbour use modern C compiler, your reply make no sense ( imho )...
Please: send a link with this fact
.
.
.
Regards
Re: STRU - Lists and modifies the structure of the dbfs file
Posted: Fri Oct 12, 2012 4:34 pm
by IMATECH
Hi Pablo !
.
.
.
About Ini files:
A sample to use
.
.
.
Code: Select all
STATIC cIniFile := "MR_Stru.ini"
//*----------------------------------------------------------------------------*
//
// M., Ronaldo <ronmesq@gmail.com> 2012/10/12
//
// MR_Read_Ini_File( cIniFile )
//
// Uses: hbMisc
//
//*----------------------------------------------------------------------------*
Function MR_Read_Ini_File( cIniFile )
LOCAL aLines := AFILL( ARRAY( 10 ), '' )
LOCAL cSection := 'MESSAGES'
LOCAL oIni := TIniFile():New( cIniFile )
FOR i := 1 to Len( aLines )
aLines[ i ] := PADC( oIni:ReadString( cSection, 'MSG_' + STRZERO( i, 3 ), '' ), 40 )
NEXT
Return( aLines )
//*----------------------------------------------------------------------------*
//
// M., Ronaldo <ronmesq@gmail.com> 2012/10/12
//
// MR_Save_Ini_File( cIniFile, aLines )
//
// Uses: hbMisc
//
//*----------------------------------------------------------------------------*
Function MR_Save_Ini_File( cIniFile, aLines )
LOCAL cSection := 'MESSAGES'
LOCAL oIni := TIniFile():New( cIniFile )
FOR i := 1 to Len( aLines )
oIni:WriteString( cSection, 'MSG_' + STRZERO( i, 3 ), ALLTRIM( aLines[ i ] ) )
NEXT
oIni:UpdateFile()
Return( NILL )
.
.
.
About Unicode in HMG
HMG is not unicode ready... then you will need to handle this fact ( or update HMG sources )
.
.
.
Regards
Re: STRU - Lists and modifies the structure of the dbfs file
Posted: Fri Oct 12, 2012 4:36 pm
by esgici
Chacal.GO wrote:Hi Esgici !
.
.
.
! Madness !
Harbour using a modern C compiler, your reply make no sense ( imho )...
Please: send a link with this fact
.
.
.
Regards
Hi Ronaldo
Sorry, not understood
Which reply you are about, what relation there is between C compiler and my reply,
and how / which link you ask and where I'll send
Saudação
Re: STRU - Lists and modifies the structure of the dbfs file
Posted: Fri Oct 12, 2012 4:47 pm
by IMATECH
Hi Esgici !
.
.
.
IMHO writing international applications banned by Harbour management team a short time ago
This is mad !
Which reply you are about, what relation there is between C compiler and my reply,
and how / which link you ask and where I'll send
1 - When you send a message to forum you need to click in: "Post a reply"
1.1 - IF you are using a C compiler you have no limits on creating any app
1.1.1 - Then your affirmation send harbour to Trash Programing language ( imho II )
2 - I think you have read this info in some place, then tell to us
2.1 - Please post here ( with you next reply )
.
.
.
Regards
Re: STRU - Lists and modifies the structure of the dbfs file
Posted: Fri Oct 12, 2012 5:19 pm
by esgici
Chacal.GO wrote:This is mad !
What is mad; banning or my opinion ?
1 - When you send a message to forum you need to click in: "Post a reply"
Really
1.1 - IF you are using a C compiler you have no limits on creating any app
If I am using C language, I don't use Harbour
Someone think they are using C language by adding some
#pragma ... end dump block into .prg, by borrowing anywhere
1.1.1 - Then your affirmation send harbour to Trash Programing language ( imho II )
I didn't affirm anything and I don't send nor intent to send anything to anywhere.
2 - I think you have read this info in some place, then tell to us
I didn't transfer any info, only I write one "H" opinion. If you are wondering what is the base of this opinion it is :
If you intend to use unicode, no. (unless, you intend to sort or use other culture/dialect/language dependent operation, but displaying chars is not amongst these.)
Did you remember ?
By the way, are you in Harbour management team, or your are think so ?