Xbrowse- language-translation of button- / screentext

Xbrowse- language-translation of button- / screentext

Postby ukoenig » Tue Aug 20, 2019 12:02 pm

Hello,

I'm working on a solution to translate fields with xBrowse ( character )
to other languages.

The 1. browser shows the fields for different languages
English is the reference and is the first record.
Changing the language I can translate the word in browser 2 ( for the moment )

I remember a sample to edit a record as a xbrowse-fieldlist but couldn't find :(

I must work in 3 browser and cannot use the edit-solution

Image

What I would like to do for easy translation :
to show the english language ( record 1 ) in browser 2
selecting other languages in browser 1 ( records > 1 ) must be shown in browser 3 ( NOT using edit shown in picture above )
and keeps english visible.
That makes it possible to compare a other language with english for translation
It works and I can replace fixed text with vars but I must switch between english and the new language for translation.

I'm just adding a solution to change a fieldsize if needed ( that belongs to the different languages ).

Image

Code: Select all  Expand view

FUNCTION PAGE4( oFld )
LOCAL oData1, oData2, oStru

REDEFINE XBROWSE oData1 ID 910 of oFld:aDialogs[ 4 ] ;
DATASOURCE oLanguage AUTOCOLS AUTOSORT CELL LINES NOBORDER FASTEDIT

REDEFINE XBROWSE  oStru  ID 920 of oFld:aDialogs[ 4 ] ;
DATASOURCE oLanguage:DbStruct() ;
COLUMNS 1,2,3,4, ;
{ |x| If( x == nil, oLanguage:FieldGet( oStru:nArrayAt ), ;
If( oLanguage:Lock(), ( oLanguage:FieldPut( oStru:nArrayAt, x ), oLanguage:UnLock() ), nil ) ) } ;
HEADERS "FldName","Typ","Len","Dec", "FieldValue" ;
COLSIZES 90, 40, 40, 40, 110 ;
JUSTIFY AL_LEFT, AL_CENTER, AL_CENTER, AL_CENTER, AL_LEFT ;
AUTOCOLS CELL LINES NOBORDER FASTEDIT

REDEFINE XBROWSE  oData2  ID 930 of oFld:aDialogs[ 4 ] ;
DATASOURCE oLanguage  // for translation
// ????????????

WITH OBJECT oData1
      :bClrSel      := { || { CLR_BLACK, CLR_HGRAY }}
      :bClrEdits        := { || { CLR_BLACK, CLR_YELLOW }}
      :lColChangeNotify := .t.
      :bChange          := { || oStru:nArrayAt := oData1:SelectedCol():nCreationOrder, oStru:Refresh() }
 
      //
      :nEditTypes       := EDIT_GET
      :bOnChanges    := { || oStru:Refresh() }
END

WITH OBJECT oStru
      :bClrSel      := { || { CLR_BLACK, CLR_HGRAY }}
      :bChange          := { || oData1:SelectCol( oData1:ColPos( oData1:oCol( oStru:nArrayAt ) ), .t. ) }

      :nStretchCol      := 5
      //
      WITH OBJECT :aCols[ 5 ]
         :nEditType := EDIT_GET
         :bClrEdit      := { || { CLR_BLACK, CLR_YELLOW }}
         :bOnChange  := { || oLanguage:Save(), oData1:RefreshCurrent() }
      END
      //
END

WITH OBJECT oData2   // translation
      :bClrSel      := { || { CLR_BLACK, CLR_HGRAY }}
      :bClrEdits        := { || { CLR_BLACK, CLR_YELLOW }}
      :lColChangeNotify := .t.
      // :bChange          :=  ???????
 
      //
      :nEditTypes       := EDIT_GET
      :bOnChanges    := { || oStru:Refresh() }
END

RETURN( NIL )
 


regards
Uwe :?:
Last edited by ukoenig on Thu Aug 22, 2019 2:29 pm, edited 3 times in total.
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: Xbrowse- language-translation of screentext

Postby ukoenig » Thu Aug 22, 2019 10:30 am

The final solution I'm looking for

1. browser : a overview of all languages for selection
2. browser : the structure and the first record ( english as reference )
3. browser : for translation
movements in browser 2 ( english ) should synchronize the fields of browser 1 and 3
a possible fieldsize-change added

the logic works like changing button-text or fieldtitles
because there is not much to translate it is a easy solution.

do we still need a codepage define ?

Image

A translated folderpage
You can translate what ever You like :!:
sample : instead of < Monday > You can define < Mo >
Prompts are symply replaced with vars.
A longer text can be shorten or changing the varsize

Image

regards
Uwe
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 84 guests