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.
Aplicaciones Multiidioma
Re: Aplicaciones Multiidioma
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
Saludos
- jose_murugosa
- Posts: 1185
- Joined: Mon Feb 06, 2006 4:28 pm
- Location: Uruguay
- Contact:
Re: Aplicaciones Multiidioma
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.
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 y el teclado y la IA!!"
José Murugosa
"Los errores en programación, siempre están entre la silla y el teclado y la IA!!"
- MdaSolution
- Posts: 401
- Joined: Tue Jan 05, 2010 2:33 pm
Re: Aplicaciones Multiidioma
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
/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
- MdaSolution
- Posts: 401
- Joined: Tue Jan 05, 2010 2:33 pm
Re: Aplicaciones Multiidioma
then create the file hit you must rename it on xxx.hil
FWH .. BC582.. xharbour
Re: Aplicaciones Multiidioma
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.
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 24.02 + Harbour 3.2.0dev (r2403071241), BCC 7.7 Windows 10
Carlos G.
FiveWin 24.02 + Harbour 3.2.0dev (r2403071241), BCC 7.7 Windows 10
Re: Aplicaciones Multiidioma
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 24.02 + Harbour 3.2.0dev (r2403071241), BCC 7.7 Windows 10
Carlos G.
FiveWin 24.02 + Harbour 3.2.0dev (r2403071241), BCC 7.7 Windows 10
- MdaSolution
- Posts: 401
- Joined: Tue Jan 05, 2010 2:33 pm
Re: Aplicaciones Multiidioma
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
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