[Gambas-user] How to write a multilingual application

wig wig at ...1809...
Wed Mar 11 13:07:03 CET 2009


To "M. Cs": Before .lang...

In older versions I read the languages by reading the .po files in de
.lang directory:

PUBLIC SUB ChooseLanguage()

  Dialog.Title = ("Choose a language file")
  Dialog.Path = Application.Path &/ ".lang"
  DEBUG Dialog.Path
  Dialog.Filter = ["*.po", "Language files", "*.mo", "Also Language
files", "*.*", "All files"]
  IF Dialog.OpenFile() THEN
    RETURN
  ELSE
    txbxLanguage.Text = File.BaseName(Dialog.Path)
  ENDIF

END

I should change to Dir(".lang") now ...
And I used MMain to start the application:


PUBLIC SUB Main()

  IF Settings["General/Language"] <> ""
    TRY System.Language = Settings["General/Language"]
  ELSE
    Message.Info("No language set - see Tools, Preferences, General")
  ENDIF
  FMain.Show

END



Where FMain is the real Main screen, which has the right language setting
from that moment on ...

So you can change the language in the interface and it will be active for
new windows, and completely active next program startup.


Wig

-------------------------------------------------

Dir(".lang") should work at least in the most recent version of Gambas 2.
There was a bug in older ones that prevented it from working as expected.

Regards,

-- 
Benoît


> Dear Benoit,
> unfortunatelly that doesn't work with the created package! During the
> development and test-run I could retrieve the list of translations with
> Dir(".lang"), but not with the installed program. I need another method to
> enable forced language switching with the installed package. Could you
> help
> me? In theory I would like to have an installed program, which would
> "know"
> the list of available languages, and let the user choose between them.
> Thanks!
>
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>







More information about the User mailing list