Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: MessageDlg button label under WIN



Permlink Replies: 3 - Last Post: Dec 5, 2015 3:58 AM Last Post By: Linden ROTH
Nicolò Blunda

Posts: 23
Registered: 7/20/10
MessageDlg button label under WIN
Click to report abuse...   Click to reply to this thread Reply
  Posted: Dec 3, 2015 10:57 PM
Hello.
In XE5, I translate Button caption of MessageDlg, in FMX.Consts (I change string assignement of SMsgDlgYes, SMsgDlgNo, etc).
If application is compiled for OSX, all works fine, but under WIN, label caption are read from some OS Api (depending of OS Language) and above assignement is not readed.
How can I bypass this "WIN assignement"?
Curiosly, title of MessageDlg box ("Warning", "Information", etc.) is readed from FMX.Consts even for WIN compiled application...

Edited by: Nicolò Blunda on Dec 3, 2015 10:57 PM
Remy Lebeau (Te...


Posts: 9,447
Registered: 12/23/01
Re: MessageDlg button label under WIN [Edit]
Click to report abuse...   Click to reply to this thread Reply
  Posted: Dec 4, 2015 10:06 AM   in response to: Nicolò Blunda in response to: Nicolò Blunda
Nicolò wrote:

In XE5, I translate Button caption of MessageDlg, in FMX.Consts (I
change string assignement of SMsgDlgYes, SMsgDlgNo, etc).

If application is compiled for OSX, all works fine, but under WIN,
label caption are read from some OS Api (depending of OS Language)
and above assignement is not readed.

How can I bypass this "WIN assignement"?

Curiosly, title of MessageDlg box ("Warning", "Information", etc.) is
readed from FMX.Consts even for WIN compiled application...

You seem to have a misunderstanding of how localization works. You are not
supposed to edit FMX.Consts itself. It contains resource strings, not string
literals. You are supposed to add your desired languages to your project,
and then those resource strings get compiled as separate resources for your
executable to use. You can then localize those resources as needed after
they have been compiled. At runtime, your app uses whichever localized resources
match the current locale that your app is running as.

There is a whole section in Embarcadero's documentation on how to localize
applications:

Creating International Applications Index
http://docwiki.embarcadero.com/RADStudio/Seattle/en/Creating_International_Applications_Index

Internationalization and Localization
http://docwiki.embarcadero.com/RADStudio/Seattle/en/Internationalization_and_Localization

--
Remy Lebeau (TeamB)
Nicolò Blunda

Posts: 23
Registered: 7/20/10
Re: MessageDlg button label under WIN [Edit]
Click to report abuse...   Click to reply to this thread Reply
  Posted: Dec 4, 2015 9:01 PM   in response to: Remy Lebeau (Te... in response to: Remy Lebeau (Te...
Remy Lebeau (TeamB) wrote:
Nicolò wrote:

In XE5, I translate Button caption of MessageDlg, in FMX.Consts (I
change string assignement of SMsgDlgYes, SMsgDlgNo, etc).

If application is compiled for OSX, all works fine, but under WIN,
label caption are read from some OS Api (depending of OS Language)
and above assignement is not readed.

How can I bypass this "WIN assignement"?

Curiosly, title of MessageDlg box ("Warning", "Information", etc.) is
readed from FMX.Consts even for WIN compiled application...

You seem to have a misunderstanding of how localization works. You are not
supposed to edit FMX.Consts itself. It contains resource strings, not string
literals. You are supposed to add your desired languages to your project,
and then those resource strings get compiled as separate resources for your
executable to use. You can then localize those resources as needed after
they have been compiled. At runtime, your app uses whichever localized resources
match the current locale that your app is running as.

There is a whole section in Embarcadero's documentation on how to localize
applications:

Creating International Applications Index
http://docwiki.embarcadero.com/RADStudio/Seattle/en/Creating_International_Applications_Index

Internationalization and Localization
http://docwiki.embarcadero.com/RADStudio/Seattle/en/Internationalization_and_Localization

--
Remy Lebeau (TeamB)

Thank you for your answer.
Maybe my approach to "localisation" it is not canonical, but, in very simple way, I have created 2 sections in FMX.Consts, both with {$IFDEF EN} and {$IFDEF IT} compiler directive, in which I write labels and titles strings in english and italian.
Chosing project TAG "EN" or "IT" it is possible to obtain, after compilation, 2 executables/apps with respective national version of label.
With OSX compilation all works fine, and title/label string included from in FMX.Consts are correttly read, but ONLY WIN caption labels are not.

Edited by: Nicolò Blunda on Dec 4, 2015 9:02 PM
Linden ROTH

Posts: 467
Registered: 11/3/11
Re: MessageDlg button label under WIN [Edit]
Click to report abuse...   Click to reply to this thread Reply
  Posted: Dec 5, 2015 3:58 AM   in response to: Nicolò Blunda in response to: Nicolò Blunda
Nicolò Blunda wrote:

Thank you for your answer.
Maybe my approach to "localisation" it is not canonical, but, in very simple way, I have created 2 sections in FMX.Consts, both with {$IFDEF EN} and {$IFDEF IT} compiler directive, in which I write labels and titles strings in english and italian.
Chosing project TAG "EN" or "IT" it is possible to obtain, after compilation, 2 executables/apps with respective national version of label.
With OSX compilation all works fine, and title/label string included from in FMX.Consts are correttly read, but ONLY WIN caption labels are not.

Have a go with mbYesAllNoAllCancel or mbAbortIgnore style buttons ... in XE8 they are the only ones handled in WINDOWS
--
Linden
"Mango" was Cool but "Wasabi" was Hotter but remember it's all in the "source"
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02