Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 2 of 2 total
Thread Multi Language Support
Mon, May 6 2013 8:00 AMPermanent Link

Christian Kaufmann

I need to have my web app in different languages. The initial language
should be choosen based on the browser language/headers. But the user
should be able to change to another (available) language as well.

I suppose, I'm not the first one, who has to do that:

* Detect language: There is the navigator.language property, but this
is missing in WebDOM. Can I just add it there? Or is there a reason,
that it is not there?

* Does somebody have a good pattern to translate forms
(TLabel.Caption, TButton.Caption, and others)?

* How to translate FormatSettings.Translations?
 FormatSettings.Translations.Values['DLG_BTN_CLOSE'] := "Schliessen";
 Or is there a more efficient way?

cu Christian
Tue, May 7 2013 4:25 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Christian,

<< * Detect language: There is the navigator.language property, but this is
missing in WebDOM. Can I just add it there? Or is there a reason, that it is
not there? >>

Yes, you can just add it.  I'll add it on this end, and it should look like
this:

  external TNavigator = class
     public
        { Properties }
        property appCodeName: String read;
        property appName: String read;
        property appVersion: String read;
        property cookieEnabled: Boolean read;
        property language: String read write; // Not supported by IE
        property mimeTypes: TMimeTypeList read;
        property platform: String read;
        property plugins: TMimePluginList read;
        property userAgent: String read;
        property userLanguage: String read write; // IE-only
        { Methods }
        function javaEnabled: Boolean;
     end;

The reason that it's not there is that this property isn't standardized
across all browsers, and I'm basically adding non-standard extensions as
they come up.

<< * How to translate FormatSettings.Translations?
 FormatSettings.Translations.Values['DLG_BTN_CLOSE'] := "Schliessen"; >>

That's the way to do it.  Just do it once in the initialization section of
your main form (or in the main program source), and you'll be all set.

Tim Young
Elevate Software
www.elevatesoft.com
Image