FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin para Harbour/xHarbour Aplicaciones Multiidioma
Posts: 1445
Joined: Mon Oct 10, 2005 02:38 PM
Aplicaciones Multiidioma
Posted: Sun Dec 12, 2010 05:15 PM

Hola a todos,

Alguien me podría decir com ha enfocado el que su aplicación sera multiidioma? (ojo no estoy diciendo bilíngüe)

Lo de las ventanas y diálogos lo tengo claro, la mayoría con una DLL para cada idioma (es así no?), y los menús, informes a impresora y mensajes de aviso, de error, etc. por pantalla?

Gracias.

Un Saludo

Carlos G.



FiveWin 25.12 + Harbour 3.2.0dev (r2502110321), BCC 7.7 Windows 11 Home

Posts: 1364
Joined: Wed Jun 21, 2006 12:39 AM
Re: Aplicaciones Multiidioma
Posted: Sun Dec 12, 2010 08:44 PM

Es exactamente lo mismo. definis las cadenas en una Dll y las llamás desde recursos. Hay un blog en donde explican esto. buscalo en el foro.
Saludos

Posts: 1279
Joined: Mon Feb 06, 2006 04:28 PM
Re: Aplicaciones Multiidioma
Posted: Mon Dec 13, 2010 10:02 AM

El blog de Biel es un blog muy interesante que te recomiendo, precisamente ahí hay un interesante artículo sobre aplicaciones multiidioma con fivewin.

http://bielsys.blogspot.com/2008/11/mul ... vewin.html

Espero te sea de utilidad.

Saludos/Regards,

José Murugosa

"Los errores en programación, siempre están entre la silla, el teclado y la IA!!"
Posts: 401
Joined: Tue Jan 05, 2010 02:33 PM
Re: Aplicaciones Multiidioma
Posted: Mon Dec 13, 2010 10:37 AM

on new xharbour you must insert this parameter
/jnamefilelanguage.HIT

and xharbour create this files

then you can use i18n() function to call values

sample :

x,y say osay prompt i18n("me gustaria...")

on main.prg
you must insert

REQUEST HB_Lang_ES
REQUEST HB_CODEPAGE_ESWIN

and then you must insert also

HB_LangSelect("ES")

to select lang tou can add into your application this function/methods

METHOD Idiomas() CLASS tApplication
LOCAL aMat := GetLang(), oBmp
LOCAL oDlg, oLbx, lSeguir := .F.

IF Empty( aMat )
MsgStop( i18n( "No hay idiomas que cargar!" ), oApp:cTitulo )
RETURN NIL
ENDIF

aMat := GetCodes( aMat )

DEFINE DIALOG oDlg FROM 117, 412 TO 430, 832 PIXEL ;
TITLE i18n( "Seleccione el Idioma a utilizar" )

@0.8,0.2 LISTBOX oLbx FIELDS ;
HEADERS i18n( "Codigo" ), i18n( "Descripcion" ) ;
size 203,80 OF oDlg FIELDSIZES 80, 200 UPDATE ;
ON DBLCLICK ( lSeguir := .T., oDlg:END() )

oLbx:nAt := 1
oLbx:bLine := { || { ;
aMat[ oLbx:nAt, 1 ] , ;
aMat[ oLbx:nAt, 2 ] ;
} }

oLbx:bGoTop := { || oLbx:nAt := 1 }
oLbx:bGoBottom := { || oLbx:nAt := Eval( oLbx:bLogicLen ) }
oLbx:bSkip := { | nWant, nOld | nOld := oLbx:nAt, oLbx:nAt += nWant, ;
oLbx:nAt := Max( 1, Min( oLbx:nAt, Eval( oLbx:bLogicLen ) ) ), ;
oLbx:nAt - nOld }
oLbx:bLogicLen := { || Len( aMat ) }
oLbx:SetArray( aMat )
oLbx:lCellStyle := .F.
oLbx:nLineStyle := 3

  @ 120, 75 BUTTON i18n( "&Aceptar" )  OF oDlg  SIZE 50, 12 PIXEL  ACTION ( lSeguir := .T., oDlg:END() )
  @ 120, 142 BUTTON  i18n( "&Cancelar" ) OF oDlg  SIZE 50, 12 PIXEL ACTION ( oDlg:END() )

ACTIVATE DIALOG oDlg CENTERED

IF lSeguir
HB_I18NSetLanguage( aMat[ oLbx:nAt, 1 ] )
fSetLang( aMat[ oLbx:nAt, 1 ],::cFileIni )
ENDIF

RETURN NIL

// -------------------------------------------------------------------------------------------- //
FUNCTION GetCodes( aFiles )
LOCAL aIdiomas := {}, i, aLang
LOCAL cPath := ( CurDrive() + ":\" + CurDir() ) + "\i18n\"
LOCAL cFile

FOR i:= 1 TO Len( aFiles )
cFile := cPath + aFiles[ i ] + ".hil"
aLang := HB_I18nLoadTable( cFile )
AAdd( aIdiomas, { aLang[ 1, 5 ], aLang[ 1, 3 ] } )
NEXT i
RETURN aIdiomas
// -------------------------------------------------------------------------------------------- //

FUNCTION fSetLang( cLang,cFileIni )
LOCAL oIni
INI oIni FILE cFileIni
SET SECTION "Config" ENTRY "Idioma" TO cLang OF oIni
ENDINI
RETURN NIL

FWH .. BC582.. xharbour
Posts: 401
Joined: Tue Jan 05, 2010 02:33 PM
Re: Aplicaciones Multiidioma
Posted: Mon Dec 13, 2010 10:39 AM

then create the file hit you must rename it on xxx.hil

FWH .. BC582.. xharbour
Posts: 1445
Joined: Mon Oct 10, 2005 02:38 PM
Re: Aplicaciones Multiidioma
Posted: Tue Dec 14, 2010 01:50 PM

Gracias a todos por sus respuestas.

Empecé el desarrollo mediante ficheros .INI, dando un valor numérico a cada mensaje, y va de maravilla. Estoy en los 750 literales traducidos y creo que llegaré hasta los 2000.

Ahora estoy intentando prescindir de este valor numérico para ahorrarme errores de duplicidades numéricas (aunque las detecto sin problemas), duplicidades de literales o números sin usar.

Veré como lo dejo al final... aunque esa función de xHarbour i18n() sería interesante ver su código.

Alguien tiene el código de la función i18n() ?

Gracias.

Un Saludo

Carlos G.



FiveWin 25.12 + Harbour 3.2.0dev (r2502110321), BCC 7.7 Windows 11 Home

Posts: 1445
Joined: Mon Oct 10, 2005 02:38 PM
Re: Aplicaciones Multiidioma
Posted: Tue Dec 14, 2010 01:56 PM
MdaSolution wrote:then create the file hit you must rename it on xxx.hil


Podrías poner un trozo de un fichero xxx.hil para ver como guarda la información?

Gracias.

Un Saludo

Carlos G.



FiveWin 25.12 + Harbour 3.2.0dev (r2502110321), BCC 7.7 Windows 11 Home

Posts: 401
Joined: Tue Jan 05, 2010 02:33 PM
Re: Aplicaciones Multiidioma
Posted: Sat Dec 18, 2010 09:40 AM

yes you can...

you can set a language and edit one file from another file
with a listbox control you have at left the file from (sample english) and at right the file to ( sample espana)
then you can save it with es.hil and the you can set every language file you want but before you nust reset the application
to refresh all variables..

the i18n function is on xharbour not on fwh

I rewrite now my TLanguage class because I made some corrections, now often resources dialog but only @ x,y

as soon as I am ready I insert the class here

FWH .. BC582.. xharbour

Continue the discussion