Ian's BCX Code

 Adding Languages


Unicode Programming

WinCe Programming

BMFD Programs

Miscellaneous Code

Languages Code


Android programming

Links to other BCX sites

ASCII example files to follow along with

Unicode example files to follow along with

Adding Languages to your Programs


Okay you may realize that part of the menu above is still in English, not the menu part I added, this is due to I have a Windows product in English.

Is it hard to do?

Yes and No
Adding a language is 20% set-up, and that was really easier than I first thought.
10% is making the rc and dll files that do the work.
70% adding the correct translations to your rc files.

The coding part is relatively easy, it does get a little harder if you need Unicode languages, but if you read other pages here that is easy.

The hardest part is getting the correct translations,.
My best advise if you are not fluent in the language is to find a friend or business partner that speaks your target language to verify your translations.
Google Translate does not do a good job.

Where to start?

Figure out what languages you will be targeting.
It doesn't matter if you want 1 or 2000 other languages.
If you think you will need to add other languages other than European then you may need Unicode.

How does this work?

It's 2 parts, the code in your program and a set of language dll's.
These 2 parts are coordinated by using the Control ID found in the BCX program.

1) Code in your program
In BCX each control is assigned an ID number, using ENUM is perfect for this.

Add the Language.inc file to your code

Add the 5 Global variables (see code)

If needed add the unicode translator call (all 1 line of it).

Add the call to find and add all the Language DLL's names to the System menu.
     Add2SysMenu(hOwnerWindow, Folder2Find_Languages_Dlls$)
    'This will set LangIdx

Add all the control ID's and strings to be used to your .rc file.

    65531    "ENGLISH"
    65532    "Language Demo with DLL's"
    65533    "Change Language"       
    1001   "Good morning"
    1002   "BCX is great"
    1003   "Just a Label"
    1004   "END"
    9001    "File"
    9002    "Open"        
    9003    "Save"
    9004    "Exit"   
    1961    "Are you sure"
    1962     "Quit Program!"    

In the example I use ID's 65531 thru 65533 for Language, Program title and Menu text  to "Change Language".

Add the system menu event to your event code
' This is where the change language functions are called
     CASE > (ID_MENUL1-1) AND < (ID_MENUL1+10)
        'Change the language
        LangIdx =  CBCTL-ID_MENUL1
        CALL SetLanguage(Form1, LangIdx, 1, 65535)     'Change every ID to new language
        REFRESH (Form1)

2) Making the DLL's
We make an rc file for the  DLL's for every language we need.
Making the dll files is very easy, add a dummy function for the compiler to process and add your rc file in language if your choice to the dll.
i.e. French.bas,
      rc file is French.rc
      dll file created will be French.dll


Function Dummy$  EXPORT


   65531    "FRANÇAIS"    
   65532    "Demo Langue"
   65533     "Changer de langue"
   1001       "Bonjour"
   1002       "BCX est grand"
   1003       "Juste une étiquette"
   1004       "FIN"
   9001       "Fichier"
   9002       "Ouvrir le fichier"   
   9003       "Enregistrer le fichier"
   9004       "Quitten"
   1961       "Etes-vous sûr?"
   1962       "Quitter programme!"

MessageBox strings & Error codes can be assigned ID numbers not used by the GUI. see item 1961 above

When you change language a function will search each control number and if it is found change the Text according to the language.

If you have questions then ask me on the BCX Yahoo group page