function TForm1.sTextManualF(sOrg: string): string;
// translate a text, which is not in the automate translation process of TFmxObjects
begin
// first check, if the selected language has a mapping
if Lang1.Resources.IndexOf(Lang1.Lang)>=0 then begin
// get the resource stringlist of the current language and get the translation
result := Lang1.LangStr[Lang1.Lang].Values[sOrg];
if result='' then begin
// text not found in mapping - keep original text
result := sOrg;
end;
end
else begin
// language not found: must be the default language
result := sOrg;
end;
end;
Función al inicio del programa para suministrar la traducción a todos los controles visuales:
Procedure TForm1.FormCreate(Sender: TObject);
begin
TranslateText;
end;
Procedure TForm1.TranslateText;
begin
//Main
Text1.Text:= sTextManualF('sOpen');
end;
El control Lang1 permite crear cadenas en múltiples idiomas.
No hay comentarios:
Publicar un comentario