Topic: MessageDlg to be translated

Hi all,

Is it possible to translate the MessageDlg buttons into other language?
I mean, instead of Yes / No to have Ja / Nein as an example?

Thank you.

Best regards,
Alin

PS: I tried with Translate('mbYes','mbJa'); but it doesn't get translated.

Best regards,
Alin

Re: MessageDlg to be translated

Hello m.alin

Try this

Translate('Yes', 'Ja');
    Translate('No', 'Nein');
    Translate('None', 'None');
    Translate('Skip', 'Skip');
    Translate('Close', 'Close');
    Translate('Cancel', 'Cancel');

JB

3 (edited by vovka3003 2023-03-19 20:32:05)

Re: MessageDlg to be translated

const
    // режимы
    mbOkOnly = 0;
    mbOkCancel = 1;
    mbAbortRetryIgnore = 2;
    mbYesNoCancel = 3;
    mbYesNo = 4;
    mbRetryCancel = 5;
    mbCritical = 16;
    mbQuestion = 32;
    mbExclamation = 48;
    mbInformation = 64;

function MessageDialogEx(caption,msg:string; mode:integer):LongInt;
var Sh:variant;
begin
  Sh := CreateOleObject('WScript.Shell');
  result := Sh.Popup(msg, 0, caption, mode);
  Sh := 0;
end;

procedure Form1_Button1_OnClick (Sender: TObject; var Cancel: boolean);
var res:integer;
begin
 case MessageDialogEx('Внимание','Вопрос...',mbYesNo + mbQuestion) of
     mrYes:ShowMessage('Нажата кнопка "ДА"');
     mrNo:ShowMessage('Нажата кнопка "НЕТ"');
 end;
end;

Re: MessageDlg to be translated

jean.brezhonek wrote:

Hello m.alin

Try this

Translate('Yes', 'Ja');
    Translate('No', 'Nein');
    Translate('None', 'None');
    Translate('Skip', 'Skip');
    Translate('Close', 'Close');
    Translate('Cancel', 'Cancel');

JB

Hi jean.brezhonek,

It doesn't get translated sad

Best regards,
Alin

Re: MessageDlg to be translated

vovka3003 wrote:
const
    // режимы
    mbOkOnly = 0;
    mbOkCancel = 1;
    mbAbortRetryIgnore = 2;
    mbYesNoCancel = 3;
    mbYesNo = 4;
    mbRetryCancel = 5;
    mbCritical = 16;
    mbQuestion = 32;
    mbExclamation = 48;
    mbInformation = 64;

function MessageDialogEx(caption,msg:string; mode:integer):LongInt;
var Sh:variant;
begin
  Sh := CreateOleObject('WScript.Shell');
  result := Sh.Popup(msg, 0, caption, mode);
  Sh := 0;
end;

procedure Form1_Button1_OnClick (Sender: TObject; var Cancel: boolean);
var res:integer;
begin
 case MessageDialogEx('Внимание','Вопрос...',mbYesNo + mbQuestion) of
     mrYes:ShowMessage('Нажата кнопка "ДА"');
     mrNo:ShowMessage('Нажата кнопка "НЕТ"');
 end;
end;

Hi vovka3003,

I will try this and let you know.
I thought that this will be easier to get translated smile

thank you.
Alin

Best regards,
Alin

Re: MessageDlg to be translated

m.alin wrote:

I thought that this will be easier to get translated smile

Не получится.

7 (edited by v_pozidis 2023-03-20 14:25:29)

Re: MessageDlg to be translated

begin

    // how to translate interface
    Form1.mniFile.Caption := 'File';
    Form1.mniClose.Caption := 'Close';
    Form1.mniOptions.Caption := 'Options';
    Form1.mniSettings.Caption := 'Settings';
    Form1.mniReport.Caption := 'Report designer';
    Form1.mniExportData.Caption := 'Export data';
    Form1.mniImportData.Caption := 'Import data';
    Form1.mniAbout.Caption := 'About';

    frmOptionsdbCore.Caption := 'Options';
    frmOptionsdbCore.TabDatabaseLoc.Caption := 'Database location';
    frmOptionsdbCore.rbAppFolder.Caption := 'Save the database file in the folder with the application.';
    frmOptionsdbCore.rbDBFilename.Caption := 'Specify the filename of the database.';
    frmOptionsdbCore.lbPath.Caption := 'You can also use a network folder (e.d. \\PCNAME\Folder\sqlite.db)';
    frmOptionsdbCore.bCancel.Caption := 'Cancel';
    frmOptionsdbCore.TabSettings.Caption := 'Settings';
    frmOptionsdbCore.GroupBoxSettings.Caption := 'Configuration file (settings.ini)';
    frmOptionsdbCore.rbSettingsIniApp.Caption := 'Save the configuration file in the folder with application.';
    frmOptionsdbCore.rbSettingsIniAppData.Caption := 'Save the configuration file in the folder:'+#13+'%appdata%\My Visual Database Configurations\%projectname%';

    frmdbCoreImport.Caption := 'Import';
    frmdbCoreImport.gbFileAndSettings.Caption := '1. File and settings';
    frmdbCoreImport.lbFile.Caption := 'CSV file name';
    frmdbCoreImport.lbColumnsSeparator.Caption := 'Columns separator';
    frmdbCoreImport.cbSeparator.Items[0] := ', (comma)';
    frmdbCoreImport.cbSeparator.Items[1] := '; (semicolon) ';
    frmdbCoreImport.cbSeparator.Items[2] := '\t (tab)';
    frmdbCoreImport.cbSeparator.Items[3] := 'Custom';
    frmdbCoreImport.cbSeparator.ItemIndex := 0;
    frmdbCoreImport.lbEncoding.Caption := 'Encoding';
    frmdbCoreImport.chbColumnNamesRow.Caption := 'Column name as first row';
    frmdbCoreImport.lbDateFormat.Caption := 'Date format';
    frmdbCoreImport.cbDateFormat.Items[0] := 'SQL format';
    frmdbCoreImport.cbDateFormat.Items[1] := 'Regional format ';
    frmdbCoreImport.lbTimeFormat.Caption := 'Time format';
    frmdbCoreImport.cbTimeFormat.Items[0] := 'SQL format';
    frmdbCoreImport.cbTimeFormat.Items[1] := 'Regional format ';
    frmdbCoreImport.gbData.Caption := '2. Data';
    frmdbCoreImport.lbImportTable.Caption := 'The table for import';
    frmdbCoreImport.lbFieldsAndColumns.Caption := 'Specify field name for every column';
    frmdbCoreImport.lbSqliteWarning.Caption := 'Backup your database before importing.'+#13+'The database may be damaged if you turn off the computer during import.';
    frmdbCoreImport.bImport.Caption := 'Import';


    frmdbCoreExport.Caption := 'Export';
    TdbStringGridEx(frmdbCoreExport.gridTables).Columns[0].Header.Caption := 'Tables';
    TdbStringGridEx(frmdbCoreExport.gridFields).Columns[1].Header.Caption := 'Fields';
    frmdbCoreExport.lbSettings.Caption := 'Settings';
    frmdbCoreExport.chbColumnNamesRow.Caption := 'Column name as first row';
    frmdbCoreExport.lbColumnsSeparator.Caption := 'Columns separator';
    frmdbCoreExport.cbSeparator.Items[0] := ', (comma)';
    frmdbCoreExport.cbSeparator.Items[1] := '; (semicolon) ';
    frmdbCoreExport.cbSeparator.Items[2] := '\t (tab)';
    frmdbCoreExport.cbSeparator.Items[3] := 'Custom';
    frmdbCoreExport.cbSeparator.ItemIndex := 0;
    frmdbCoreExport.lbEndOfLine.Caption := 'End of line';
    frmdbCoreExport.chbEnclosing.Caption := 'Double quotes enclose';
    frmdbCoreExport.lbSQLFilter.Caption := 'SQL filter (WHERE conditions)';
    frmdbCoreExport.bExport.Caption := 'Export to CSV';
    frmdbCoreImportProgress.Caption := 'Importing...';
    frmdbCoreImportProgress.bMore.Caption := 'More details';
    frmdbCoreImportProgress.bCancel.Caption := 'Cancel';


    // how to translate messages and captions
    Translate('Open_report_designer', 'Open report designer');
    Translate('Your_computer_does_not_have_Excel', 'Your computer does not have Excel');
    Translate('Your_computer_does_not_have_LibreOffice', 'Your computer does not have LibreOffice');
    Translate('Your_computer_does_not_have_Excel_or_LibreOffice', 'Your computer does not have Excel or LibreOffice');
    Translate('Entry_to_edit_is_no_selected', 'Entry to edit is no selected');
    Translate('Unable to determine the record ID', 'Unable_to_determine_the_record_ID');
    Translate('Please_select_record_in_grid', 'Please select record in grid');
    Translate('Report_file_not_found', 'Report file not found');
    Translate('Entry_to_be_deleted_is_not_selected', 'Entry to be deleted is not selected');
    Translate('Are_you_sure_you_want_to_delete_the_record', 'Are you sure you want to delete the record');
    Translate('The_database_file_is_not_found', 'The database file is not found');
    Translate('Not_a_number: string', 'Not a number');
    Translate('Are_you_sure_you_want_to_delete_the_image_from_the_database', 'Are you sure you want to delete the image from the database');
    Translate('There_is_no_file_to_save', 'There is no file to save');
    Translate('Do_you_really_want_to_delete_the_file_from_the_database', 'Do you really want to delete the file from the database');
    Translate('Restart_the_program_to_apply_the_settings', 'Restart the program to apply the settings');
    Translate('This_Field_is_required', 'This Field is required');
    Translate('Not_permitted_to_use_ComboBox_for_saving_record', 'Not permitted to use ComboBox for saving record');
    Translate('Saving_or_opening_file_from_database', 'Saving or opening file from database');
    Translate('Select_file_stored_in_database', 'Select file stored in database');
    Translate('Export_image_from_database', 'Export image from database');
    Translate('Open_image_to_save_the_database', 'Open image to save the database');
    Translate('Delete_Image', 'Delete Image');
    Translate('Calculated_field', 'Calculated field');
    Translate('Counter_field', 'Counter field');
    Translate('Open_file', 'Open file');
    Translate('Save_file', 'Save file');
    Translate('Delete_file', 'Delete file');
    Translate('Open_folder_with_file', 'Open folder with file');
    Translate('Clear', 'Clear');
    Translate('Open', 'Open');
    Translate('Component', 'Component');
    Translate('No_data_to_add', 'No data to add');
    Translate('File_not_found', 'File not found');
    Translate('Confirm', 'Confirm');
    Translate('Error', 'Error');
    Translate('Info', 'Info');
    Translate('Set_marker', 'Set marker');
    Translate('Set_marker_at_address', 'Set marker at address');
    Translate('Delete_marker', 'Delete marker');
    Translate('Address', 'Address');
    Translate('Export', 'Export');
    Translate('Import', 'Import');
    Translate('Records_exported', 'Records exported');
    Translate('Records_imported', 'Records imported');
    Translate('Export_is_not_configured_correctly', 'Export is not configured correctly.');
    Translate('Import_is_not_configured_correctly', 'Import is not configured correctly.');
    Translate('Yes', 'Ja');
    Translate('No', 'Nein');
    Translate('None', 'None');
    Translate('Skip', 'Skip');
    Translate('Close', 'Close');
    Translate('Cancel', 'Cancel');
end.

http://myvisualdatabase.com/forum/viewt … mp;login=1

Re: MessageDlg to be translated

Hi all


Use MessageBox and the labels on the buttons will be in the language of the system.
It will not be possible to translate MessageDlg.

9 (edited by v_pozidis 2023-03-20 22:41:59)

Re: MessageDlg to be translated

Hi all. I am confused. Translate works fine but trying to translate Yes and No it fails. Any idea? Also can I translate the 'Wrong username/password' in another language  ?

Re: MessageDlg to be translated

v_pozidis wrote:

Translate works fine but trying to translate Yes and No it fails. Any idea?

Это системные диалоги и их нельзя перевести. По крайней мере с помощью MVDb.

Re: MessageDlg to be translated

Hello vovka3003, Also for me the translation of Yes and No work very well: Translate('Yes', 'Ja');  Translate('No', 'Nee').

But when I use the roll based access control also I have many troubles with the translations besides your problem with the translation of 'Wrong username/password'.

Examples: (1) new password confirmation not correct, (2) password cannot be empty, (3) password successfull changed, (4) wrong password.

This is very frustating because I cannot offer a completely translated app to my customers. I hope somebody will come with a solution.

Have a nice day

Re: MessageDlg to be translated

Resourse Hacker in help for builder.dll...

13 (edited by v_pozidis 2023-03-21 14:00:06)

Re: MessageDlg to be translated

If the translate Yes and No works why is it not working in my case in Greek language??
Translate('Yes','Ναι');
Translate('No','Όχι');
Can I fix this problem using Resource Hacker, if yes how?

Re: MessageDlg to be translated

The "yes/no" translation for boolean fields that appear in the table translates perfectly into Greek.
"Yes/No" text in system messages is not translated by standard methods.
This also applies to some other program texts that are displayed in MVD depending on the
regional settings of the system and are not translated using TRANSLATE. In some cases,
you can handle / intercept events and generate error messages yourself, but as a result,
you will have to manually handle events such as writing, deleting, modifying the database,
controlling components, etc.
Whether the Yes/No translation is worth such a result for you is up to you to decide.


There is also a variant Vovka3003. But this decision, in my opinion, is beyond the scope of this forum.

Re: MessageDlg to be translated

A stupid question. If my computer have the regional settings in the German language and in my software that I develop I use the translate function with the following from English to Greek :TRANSLATE ('Confirm','Επιβεβαιωση') will this work or do I have other results on my screen. I cannot test it because my windows are in English.

Re: MessageDlg to be translated

First I will correct my mistake in the previous post.
Regional settings - display format for dates, numbers, money, etc.
In the post should be - Windows display language.
In my experiments with Yes / No, translating with
Translate worked regardless of the Windows display language.
Note: To correctly display text in other languages, you may need to
install additional input languages.

Re: MessageDlg to be translated

Hi all, is there a more in depth list? Because for example "No Record Selected For Editing" or "No Record Selected to Delete" are not there.
I tried for example with "No_Record_Selected_For_Editing" but it doesn't work.
Thank you all.

Re: MessageDlg to be translated

try

Translate('Entry_to_edit_is_no_selected', 'Entry to edit is no selected');

Translate('Entry_to_be_deleted_is_not_selected', 'Entry to be deleted is not selected');

Re: MessageDlg to be translated

Hi sparrow, I had read that string but didn't think it was the same thing. Instead it works. A thousand thanks!

Re: MessageDlg to be translated

Hi,


It all depends on the language of the system. For some languages, their own phrases are substituted, if the language is not defined, then a universal phrase.

Re: MessageDlg to be translated

Ok I understood, thanks sparrow for explanations.