FWString() : how to add "Keywords"

FWString() : how to add "Keywords"

Postby Jimmy » Mon Apr 03, 2023 8:37 pm

hi,

i have now use FWString() ... WOW

i CODE i found
Code: Select all  Expand view
  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
Jimmy
 
Posts: 1725
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany

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

Postby Antonio Linares » Mon Apr 03, 2023 8:46 pm

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
Antonio Linares
Site Admin
 
Posts: 42081
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

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

Postby nageswaragunupudi » Tue Apr 04, 2023 4:40 am

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 view
// 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: 10625
Joined: Sun Nov 19, 2006 5:22 am
Location: India

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

Postby nageswaragunupudi » Tue Apr 04, 2023 4:42 am

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
nageswaragunupudi
 
Posts: 10625
Joined: Sun Nov 19, 2006 5:22 am
Location: India

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

Postby Jimmy » Tue Apr 04, 2023 5:41 am

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
Jimmy
 
Posts: 1725
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany

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

Postby Antonio Linares » Tue Apr 04, 2023 6:35 am

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

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42081
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

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

Postby Jimmy » Tue Apr 04, 2023 12:18 pm

hi,

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

i also write Result into File
Code: Select all  Expand view
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
Jimmy
 
Posts: 1725
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany

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

Postby Antonio Linares » Tue Apr 04, 2023 1:56 pm

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
Antonio Linares
Site Admin
 
Posts: 42081
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

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

Postby nageswaragunupudi » Tue Apr 04, 2023 3:24 pm

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

Code: Select all  Expand view
Function FW_TransLang( cTSource, cLSource, cLTarget, lUTf8 )
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10625
Joined: Sun Nov 19, 2006 5:22 am
Location: India

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

Postby nageswaragunupudi » Tue Apr 04, 2023 3:34 pm

I just now tested our FWH built-in function:
Code: Select all  Expand view
? 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
nageswaragunupudi
 
Posts: 10625
Joined: Sun Nov 19, 2006 5:22 am
Location: India

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

Postby Jimmy » Tue Apr 04, 2023 4:12 pm

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
Jimmy
 
Posts: 1725
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany

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

Postby cnavarro » Tue Apr 04, 2023 4:18 pm

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
cnavarro
 
Posts: 6541
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: FWString() : how to add

Postby Jimmy » Tue Apr 04, 2023 4:20 pm

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: 1725
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany

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

Postby Jimmy » Tue Apr 04, 2023 4:26 pm

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
Jimmy
 
Posts: 1725
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany

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

Postby cnavarro » Tue Apr 04, 2023 4:32 pm

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
User avatar
cnavarro
 
Posts: 6541
Joined: Wed Feb 15, 2012 8:25 pm
Location: España


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 73 guests

cron