FWString() : how to add "Keywords"

Post Reply
User avatar
Jimmy
Posts: 1740
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany
Has thanked: 2 times

FWString() : how to add "Keywords"

Post by Jimmy »

hi,

i have now use FWString() ... WOW

i CODE i found

Code: Select all | Expand

   FWString( "Please add it to FWH\source\function\strings.prg" )
so i need to build new LIB when add to "aStrings" :?: how to build new LIB :?:

Question : can i make my own "aStrings" and use a copy of FWString() :?:
greeting,
Jimmy
User avatar
Antonio Linares
Site Admin
Posts: 42520
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Has thanked: 31 times
Been thanked: 75 times
Contact:

Re: FWString() : how to add "Keywords"

Post by Antonio Linares »

Dear Jimmy,

> Question : can i make my own "aStrings" and use a copy of FWString() :?:

Yes, probably thats the easier :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
nageswaragunupudi
Posts: 10721
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Been thanked: 8 times
Contact:

Re: FWString() : how to add "Keywords"

Post by nageswaragunupudi »

We need not make any new libs.
We can add new translates to the existing translates at runtime, preferably at the beginning of our program.

This is a sample.
Here the programmer is adding new translates for Spanish and German languages, so that his software can be used by English, Spanish and German users.

Code: Select all | Expand

// Add Tranlates for Spanish and German

#include "fivewin.ch"

function Main()

   AddTranslates()

   FWSetLanguage( 2 )  // Spanish
   ? FWString( "medium" )
   FWSetLanguage( 5 )  // German
   ? FWString( "large" )

return nil

static function AddTranslates()

   local aTranslates := { ;
      { "large", "grande", nil, nil, "groß" },  ;
      { "medium", "medio", nil, nil, "Mittel"}, ;
      { "small", "pequeño", nil, nil, "klein" }, ;
      { "tiny", "diminuto", nil, nil, "winzig" } ;
   }

   AEval( aTranslates, { |a| FWAddString( a ) } )

return nil
 
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
Posts: 10721
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Been thanked: 8 times
Contact:

Re: FWString() : how to add "Keywords"

Post by nageswaragunupudi »

Notes:
By default FWH handles 6 languages and each of these languages has its own ID from 1 to 6.
1 English, 2 Spanish, 3 French, 4 Portugese, 5 German, 6 Italian

We can add more languages using FWAddLanguage(). We will not discuss this here.

At the beginning of the program we need to set our language to use FWString() capability.
Regards

G. N. Rao.
Hyderabad, India
User avatar
Jimmy
Posts: 1740
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany
Has thanked: 2 times

Re: FWString() : how to add "Keywords"

Post by Jimmy »

hi,
nageswaragunupudi wrote:We need not make any new libs.
We can add new translates to the existing translates at runtime, preferably at the beginning of our program.

This is a sample.
Here the programmer is adding new translates for Spanish and German languages, so that his software can be used by English, Spanish and German users.
GREAT :!:

that way is much shorter ;)
greeting,
Jimmy
User avatar
Antonio Linares
Site Admin
Posts: 42520
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Has thanked: 31 times
Been thanked: 75 times
Contact:

Re: FWString() : how to add "Keywords"

Post by Antonio Linares »

Mr. Rao is totally right. I missed that way
:-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Jimmy
Posts: 1740
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany
Has thanked: 2 times

Re: FWString() : how to add "Keywords"

Post by Jimmy »

hi,

have create a App which does "translate" into other Language via Google
Image

i also write Result into File

Code: Select all | Expand

LOCAL aTRANSLATE := {}
AADD(aTRANSLATE,{'soon here in the forum','pronto aqui en el foro','bientôt ici sur le forum','em breve aqui no forum','demnächst hier im Forum','presto qui nel forum'})
so i can easy add it into "my" Array for FWString()

while i use HMG Syntax in this Version i will release it on HMG Website
https://www.hmgforum.com/viewtopic.php?t=7414
greeting,
Jimmy
User avatar
Antonio Linares
Site Admin
Posts: 42520
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Has thanked: 31 times
Been thanked: 75 times
Contact:

Re: FWString() : how to add "Keywords"

Post by Antonio Linares »

Dear Jimmy,

Could we do the translations automatically ?

I mean, If the Word translation is not found then it automatically invoke google to translate it and feed the array

Enviado desde mi SM-M325FV mediante Tapatalk
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
nageswaragunupudi
Posts: 10721
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Been thanked: 8 times
Contact:

Re: FWString() : how to add "Keywords"

Post by nageswaragunupudi »

We already have this built-in FWH function for the last six years:

Code: Select all | Expand

Function FW_TransLang( cTSource, cLSource, cLTarget, lUTf8 )
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
Posts: 10721
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Been thanked: 8 times
Contact:

Re: FWString() : how to add "Keywords"

Post by nageswaragunupudi »

I just now tested our FWH built-in function:

Code: Select all | Expand

? FW_TransLang( "This is very nice", "en", "te", .t. )
Tried to translate into my mother tongue 'TELUGU', which is a Unicode language and got the correct result:
ఇది చాలా బాగుంది
Perfect translation.
Regards

G. N. Rao.
Hyderabad, India
User avatar
Jimmy
Posts: 1740
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany
Has thanked: 2 times

Re: FWString() : how to add "Keywords"

Post by Jimmy »

hi,
nageswaragunupudi wrote:We already have this built-in FWH function for the last six years:
oh, i didn´t know that

i found Sample c:\fwh\samples\TransFree.prg
but where do i find Function FW_TransLang() :?:
greeting,
Jimmy
User avatar
cnavarro
Posts: 6557
Joined: Wed Feb 15, 2012 8:25 pm
Location: España
Been thanked: 3 times

Re: FWString() : how to add "Keywords"

Post by cnavarro »

Cristobal Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
User avatar
Jimmy
Posts: 1740
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany
Has thanked: 2 times

Re: FWString() : how to add

Post by Jimmy »

hi Antonio,
Antonio Linares wrote:Could we do the translations automatically ?
I mean, If the Word translation is not found then it automatically invoke google to translate it and feed the array
interesting Idea :idea:

i have learn about FW_TransLang()
i have to look at it how to get "right" Language which i saw in c:\fwh\samples\TransFree.prg

to get both path together would be nice
greeting,
Jimmy
User avatar
Jimmy
Posts: 1740
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany
Has thanked: 2 times

Re: FWString() : how to add "Keywords"

Post by Jimmy »

hi,
cnavarro wrote:https://forums.fivetechsupport.com/viewtopic.php?f=6&t=39139&start=0&hilit=fw+translang
thx for Link but there is no Source CODE of Function FW_TransLang()

i do not have \source\internal\FTRANSLATE.PRG which seem to include FW_TransLang()
greeting,
Jimmy
User avatar
cnavarro
Posts: 6557
Joined: Wed Feb 15, 2012 8:25 pm
Location: España
Been thanked: 3 times

Re: FWString() : how to add "Keywords"

Post by cnavarro »

Yes, I have not managed to publish the code
Cristobal Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
Post Reply