Topic: Translate

I want to translate the errormessage "Wrong username/password." I have several translations, but this I can not find. Does anybody know it?

Re: Translate

k.krause wrote:

I want to translate the errormessage "Wrong username/password." I have several translations, but this I can not find. Does anybody know it?

Explain what exactly you need to clarify? The mechanism of localization of the given message?

Визуальное программирование: блог и телеграм-канал.

Re: Translate

Hi sdpc62 and k245,

Thanks for your reaction and sorry my question was not clear.

Normaly the syntax is: Translate ('Wrong_username/password.'), ('Verkeerde naam/wachtwoord');

This does not work for me.

Any tip or solution?

Kind regards, Kees

Re: Translate

Hello,

try this

var
   s: string;
begin
   s := 'Your message';
   Translate('This_Field_is_required', s);

list of items

Open_report_designer
Your_computer_does_not_have_Excel
Entry_to_edit_is_no_selected
Unable_to_determine_the_record_ID
Please_select_record_in_grid
Report_file_not_found
Entry_to_be_deleted_is_not_selected
Are_you_sure_you_want_to_delete_the_record
The_database_file_is_not_found
Not_a_number
Are_you_sure_you_want_to_delete_the_image_from_the_database
There_is_no_file_to_save
Do_you_really_want_to_delete_the_file_from_the_database
Restart_the_program_to_apply_the_settings
This_Field_is_required
Not_permitted_to_use_ComboBox_for_saving_record
Saving_or_opening_file_from_database
Select_file_stored_in_database
Export_image_from_database
Open_image_to_save_the_database
Delete_Image
Calculated_field
Counter_field
Open_file
Save_file
Delete_file
Open_folder_with_file
Clear
Open
Component
No_data_to_add
File_not_found
Confirm
Error
Info
Yes
No

Re: Translate

Hello krause, dbk, K245

Take a good look at the syntax proposed by dbk: remove 2 parentheses
all the messages are not translatable, they have not all been entered in MVD

JB

Re: Translate

Hi All,
As Jean has mentioned, not all of the messages have been made available for translation and unfortunately, the 'Wrong user/password' is one of those.
However, if you still want to use the standard MVD encrypt / decrypt features but do not need the _user roles functionality, it is straightforward to write your own logon form and, as such, you can display any error messages in whatever language you require.
Attached is a quick example;  it is based on just the user passwords rather than user-ids and passwords (just to keep it simple).  I've left the option to decrypt passwords in the script but obviously when you are 'live', you would remove this (as well as the .vdb and .pas files themselves).
Valid passwords are 'keesp', 'derekp' and 'adminp'.
Regards,
Derek.

Post's attachments

Attachment icon encrypt decrypt.zip 564.23 kb, 219 downloads since 2022-06-07 

Re: Translate

Everyone thanks for their reactions. But, as a Dutchman I need the possibility of the _user roles functionality in combination with the possibility to translate everything. It is so frustating and unprofessional to present a partial translated programma to not English users. Is their absolute nobody (in the enviroment of Dmitry) who can add translation possibilties for missing issues?

Re: Translate

Without Dmitry, you can only add a crutch.

https://avatars.githubusercontent.com/u/25460721?v=4

For example, on the authentication form, replace the button click handler, in which you can independently check the validity of the password / login and, in case of a problem, display a message in the desired language. And if everything is OK, then call the old handler.

Визуальное программирование: блог и телеграм-канал.

Re: Translate

Hello K245, thank you so much for your quick answer.

If it is not to much trouble for you, can you please give me a short example of code, for I do not understand your answer.

10 (edited by k245 2022-06-09 12:09:22)

Re: Translate

// локализация сообщения при авторизации.
procedure Login_OnClick( Sender:TObject; var Cancel:boolean );
// обработчик нажатия новой кнопки
var
  tmpMD5: string;
  tmpUsername: string;
  // так как у комбобокса нет имени, то найти его можно только полным перебором компонентов
  function GetCombo: TdbComboBox;
  //
  var
    i: integer;
  begin
    for i := 0 to frmdbCoreLogin.componentCount - 1 do
    begin
      if frmdbCoreLogin.Components[i] is TdbCombobox then
      begin
        Result := TdbCombobox( frmdbCoreLogin.Components[i] );
        exit;
      end;
    end;
  end;
begin
  // в зависимости от режима ввода логин находится в поле ввода
  if frmdbCoreLogin.edLogin.Visible then
    tmpUsername := frmdbCoreLogin.edLogin.Text
  else // или в выпадающем списке
    tmpUsername := GetCombo.Text;
  // вычисляем код, хранящийся в базе
  tmpMD5 := StrToMD5( frmdbCoreLogin.edPassword.Text + tmpUserName );
  // если соотвествующей записи в базе нет, то
  if SQLExecute('SELECT count(*) FROM _user WHERE username = "'+tmpUserName+'" AND password = "'+tmpMD5+'" ') = 0 then
    // выдаем наше локализованное сообщение
    // то, из-за чего весь сыр-бор и состоялся ))))
    MessageBox('Что-то пошло не так...','Ошибка', MB_ICONWARNING + MB_OK )
  else // если все нормально, то
  begin // нажимаем стандартную кнопку логина
   SendMessage( frmdbCoreLogin.bLogin.handle , wm_LButtonDown, 0, 0);
   sleep(100);
   SendMessage( frmdbCoreLogin.bLogin.handle , wm_LButtonUp, 0, 0);
 end;
end;

procedure Init;
var
  tmpLoginButton: TdbButton;
begin
  // создаем новую кнопу
  tmpLoginButton := TdbButton.Create( frmdbCoreLogin );
  tmpLoginButton.Parent := frmdbCoreLogin;
  // размещаем на месте стандартной
  tmpLoginButton.Top := frmdbCoreLogin.bLogin.Top;
  tmpLoginButton.Left := frmdbCoreLogin.bLogin.Left;
  tmpLoginButton.Width := frmdbCoreLogin.bLogin.Width;
  tmpLoginButton.Height := frmdbCoreLogin.bLogin.Height;
  tmpLoginButton.Caption := frmdbCoreLogin.bLogin.Caption;
  tmpLoginButton.Font := frmdbCoreLogin.bLogin.Font;
  // теперь новая кнопка будет срабатывать от Enter
  tmpLoginButton.Default := True;
  // назначаем обработчик
  tmpLoginButton.OnClick := 'Login_OnClick';
  // старую кнопку прячем
  frmdbCoreLogin.bLogin.Visible := False;
end;

begin
  Init;
end.

http://myvisualdatabase.com/forum/misc.php?action=pun_attachment&item=8747&download=0


In Dutch it would be written like this:

...
MessageBox('Verkeerde naam/wachtwoord','Fout', MB_ICONWARNING + MB_OK )
...
Post's attachments

Attachment icon img-2022-06-09-14-56-44.png 13.27 kb, 102 downloads since 2022-06-09 

Визуальное программирование: блог и телеграм-канал.

Re: Translate

Hello K245,

Thank you very mutch

Kees

Post's attachments

Attachment icon Schermafbeelding 2022-06-09 153630.png 29.1 kb, 120 downloads since 2022-06-09 

Re: Translate

Hi Konstantin,
Thanks for this example.  There are some very useful things in it that will also be helpful in other projects.
Regards,
Derek.
.
Привет Константин,
Спасибо за этот пример. В нем есть несколько очень полезных вещей, которые также очень помогут в других проектах.
С уважением,
Derek.