News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests

Main Menu

MultiLanguage Dialogs

Started by clamicun, April 02, 2017, 07:56:54 AM

Previous topic - Next topic

clamicun

JJ,
times ago I I downloaded your "DlgMultiLanguage.zip".
Would you have a version in "readable" asm ?
Thanks Mic

jj2007

The trick is the Lg$() macro in connection with a Unicode text file in *.tab format, see attachment.
Lg$() takes as arguments:

Lg$(File:"MultiStrings.tab")  ; File:
Lg$(Language:"EN")  ; the language, format see below
Lg$($MNew)  ; a four letter code, defined in the first column of your tab file.

include \masm32\MasmBasic\MasmBasic.inc      ; download
  Init
  Lg$(File:"MultiStrings.tab")      ; file:"path" loads the multilingual matrix
  For_ ct=0 To 5
      Lg$(Language: Mid$("ENESBRITDEFR", ct*2+1, 2))            ; example: Lg$(Lang:IT) sets Italian
      wPrintLine wLg$(LgTx), ":", CrLf$, Tb$, wLg$(_ASM), CrLf$, Tb$, wLg$("_BEL")      ; Unicode works better
      wPrintLine Tb$, wLg$("_USA"), CrLf$, Tb$, wLg$(_AUS), CrLf$, Tb$, wLg$(_AUT)      ; with many languages
      wPrintLine Tb$, wLg$(@MFile), CrLf$, Tb$, wLg$($MNew), CrLf$, Tb$, wLg$($MOpen)
  Next
  Inkey "ok?"
EndOfCode

clamicun

JJ,
bom dia.
After checking out the prog a couple of hours, I got it.
That is what I was looking for since "decades".
That is genial !
A real perfect way to write dialogboxes in various languages. (and not much writing).
I could not find a better or equally good method in the net (and I searched).
Thank you very much and a nice sunday.
Mic 

jj2007

Glad you liked it :biggrin:

Just checked a very old GfaBasic source of mine, and found 451 occurrences of LG$(). That was a real multilingual application: EN, ES, BR, IT, DE and FR. The strings alone were over 100 kB  8)

Which languages will you use?

LG$("Seb")+gp$/    IF MID$(DV$,45,2)="UA" THEN UsrAct%=CVL(MID$(DV$,47,4)),Update&=CVI(MID$(DV$,51,2))
LG$("tea") 'Download this URL?
LG$("teb") 'Strip & see?
LG$("tec") 'Not a URL
LG$("ted") 'Export web list to clipboard?
LG$("tee") 'Refresh/      AdjDlg
LG$("Fad")+" v v v "
LG$("Maa") 'Create web site
LG$("Gf"+CHR$(98-GapsFilled!))
LG$("Ex7c")/    ENDIF
LG$("Mac")

clamicun

EN, ES, BR, IT, DE and FR
If BR means PT-Br those are exactely the languages I will start with because I know how to tranlate them myself.
It is just a project ... Dozens of dialogboxes ... Would be work for a long time.



hutch--

Multi-lingual usually means storing the data as UNICODE in a variety of places, some park the data in a DLL for each language, other use external data files, whatever rows your boat. You can embed them as resources but you risk making the executable very large if you support many languages.

ragdog

Hello

I think i have see on fearless for a long time a good template written in Masm.
You can ask fearless.

jj2007

Quote from: ragdog on April 04, 2017, 02:22:27 AMI think i have see on fearless for a long time a good template written in Masm.

Google is your friend :P

ragdog

Correct Jochen  :t

But google is not my friend  :biggrin:

hutch--

Have a look at the MASM32 example called "multi_lingual". Its in the unicode_generic directory. It does exactly what the question was asking.

clamicun

Finally I made this multi-language access checker.
Thanks to jj !!!
Thankful for  improvements.

btw. the password is clamicun

jj2007

Works fine :t

I see the *.lng files are empty, but rsrc.rc has the strings. Are you considering both options?

clamicun

jj,
yes, the .lng files are for all messages ... usually messagesboxes ...
The only doubt I still have are the different menus.
But as I said, your idea  is great.

jj2007

Quote from: hutch-- on April 04, 2017, 03:00:16 AM
Have a look at the MASM32 example called "multi_lingual". Its in the unicode_generic directory. It does exactly what the question was asking.

Nice, I hadn't seen that one:

    STRINGTABLE
    BEGIN
        250,  "早上好计算机程序员。\0"
        251,  "おはようのコンピュータのプログラマー。\0"
        252,  "Хороший программист утром.\0"
        253,  "Καλή προγραμματιστής ηλεκτρονικών υπολογιστών πρωί.\0"
        254,  "सुप्रभात कंप्यूटर प्रोग्रामर.\0"
        255,  "Chào buổi sáng lập trình máy tính.\0"
        256,  "დილა მშვიდობისა, კომპიუტერული პროგრამისტი.\0"
        257,  "Добро јутро компјутерски програмер.\0"
        258,  "Բարի լույս ծրագրավորող.\0"
        259,  "안녕하세요 컴퓨터 프로그래머.\0"
    END

The MasmBasic approach is a little bit different in that it uses a tab-delimited spreadsheet, so that you can edit a large amount of strings in an appropriate software like Excel, see attached excerpt.


@MFile&File&Archivo&Documento&Datei&Fichier&Документ文件
$MNew&New&Nuevo&Nuovo&Neu&Nouveau fichier&Новый документ新文件
$MOpen&Open&Abrir&Apri&Öffnen&Ouvrir&Откройте打开

(btw generating tables in SMF is ridiculously complicated; if I find time, I'll add that feature to RichMasm's F11 export)

LordAdef

QuoteThat is genial !

Another Brazilian countryman fellow??
We are quite a bunch in here!