![]() |
|
Yandex Translate - Baskı Önizleme +- Delphi Can (https://www.delphican.com) +-- Forum: Delphi (https://www.delphican.com/forumdisplay.php?fid=3) +--- Forum: Mobil Platform - FireMonkey (FMX) (https://www.delphican.com/forumdisplay.php?fid=7) +--- Konu Başlığı: Yandex Translate (/showthread.php?tid=2722) Sayfalar:
1
2
|
Cvp: Yandex Translate - SimaWB - 10-10-2018 (10-10-2018, Saat: 17:05)uparlayan Adlı Kullanıcıdan Alıntı: mobTranslate(fParent:TForm;..... yerine mobTranslate(fParent:TComponent;..... Başta verilen kodlar sanırım büyük bir projenin küçük bir kısmı. Yoksa zaten fParent'e hiç ihtiyaç yok o fonksiyonda. fParent yerine nil kullanılabilir. Tabi TXMLDocument'in Owner'ı nil olunca da sıkıntı oluşacaktır ama onun da çözümü var ![]() XmlDoc : IXMLDocument;Kullanılır ve FreeAndNil(XmlDoc) silinir. Yandex Translate - uparlayan - 10-10-2018 Bu da benden olsun, ilk kodu birazcık değiştirdim...
unit rtmTranslator_Yandex_;
interface
uses
System.NetEncoding
, System.SysUtils
, System.StrUtils
, System.Classes
, System.Net.HttpClientComponent
, Xml.XMLDoc
;
type
TrtmTranslatorYandex = class(TComponent)
type
TrtmYandexLangs = ( Azerice, Arnavutca, Amharca, Ingilizce, Arapca, Ermenice, Afrikaca, Baskca, Baskurtca
, Belarusca, Bengalce, Birmanyaca, Bulgarca, Bosnakca, Galce, Macarca, Vietnamca, Haitice
, Galisyaca, Flemenkce, UstMarice, Yunanca, Gurcuce, Gujaratca, Danimarkaca, Ibranice, Eskenazice
, Endonezca, Irlandaca, Italyanca, Izlandaca, Ispanyolca, Kazakca, Kannadaca, Katalanca
, Kirgizca, Cince, Korece, Xhosaca, Kmerce, Laosca, Latince, Letonca, Litvanca, Luksemburgca
, Madagaskarca, Malayaca, Malayalamca, Maltaca, Makedonca, Maorice, Marathice, Marice, Mogolca
, Almanca, Nepalce, Norvecce, Pencapca, Papiamentoca, Farsca, Polonca, Portekizce, Romence
, Rusca, Cebuanoca, Sirpca, Sinhalaca, Slovakca, Slovence, Svahilice, Sundaca, Tacikce
, Taylandca, Tagalogca, Tamilce, Tatarca, Teluguca, Turkce, Udmurtca, Ozbekce, Ukraynaca, Urduca
, Fince, Fransizca, Hintce, Hirvatca, Cekce, Isvecce, Iskocca, Estonca, Esperantoca, Cavaca
, Japonca
); // https://tech.yandex.com/translate/doc/dg/concepts/api-overview-docpage/#api-overview__languages
TrtmYandexLangs_Helper = record helper for TrtmYandexLangs
public
function toString: String;
function toTextList: String;
function toIndex: Integer;
procedure toLang(aLang: String);
end;
private
FOwner : TComponent;
FAPIKey : String;
FNetHTTP : TNetHTTPClient;
FEncoder : TURLEncoding;
FNehir : TMemoryStream;
FXmlDOC : TXMLDocument;
FCevap : TStringList;
FLangSource : TrtmYandexLangs;
FLangTarget : TrtmYandexLangs;
FText : String;
FTextOut : String;
FURL : String;
FResponseCode : Integer;
FResponseText : String;
FOnBeforeTranslate : TNotifyEvent;
FOnAfterTranslate : TNotifyEvent;
FOnMaxText : TNotifyEvent;
FOnDailyLimit : TNotifyEvent;
FOnInvalidKey : TNotifyEvent;
FOnNotSupported : TNotifyEvent;
FOnNotTranslated : TNotifyEvent;
FOnComplete : TNotifyEvent;
FOnBlockedKey : TNotifyEvent;
FOnInvalidParameter : TNotifyEvent;
function GetXMLResult: String;
procedure SetLangSource(const Value: TrtmYandexLangs);
procedure SetLangTarget(const Value: TrtmYandexLangs);
procedure SetText(const Value: String);
procedure SetAPIKey(const Value: String);
protected
procedure TranslateTextOut;
public
constructor Create(aOwner: TComponent); override;
destructor Destroy; override;
function Translate(const aText: String): String;
published
property APIKey : String read FAPIKey write SetAPIKey;
property LangSource : TrtmYandexLangs read FLangSource write SetLangSource;
property LangTarget : TrtmYandexLangs read FLangTarget write SetLangTarget;
property Text : String read FText write SetText;
property TextOut : String read FTextOut;
property URL : String read FURL;
property XMLResult : String read GetXMLResult;
property ResponseCode : Integer read FResponseCode;
property ResponseText : String read FResponseText;
property OnBeforeTranslate : TNotifyEvent read FOnBeforeTranslate write FOnBeforeTranslate;
property OnAfterTranslate : TNotifyEvent read FOnAfterTranslate write FOnAfterTranslate;
property OnComplete : TNotifyEvent read FOnComplete write FOnComplete;
property OnInvalidKey : TNotifyEvent read FOnInvalidKey write FOnInvalidKey;
property OnBlockedKey : TNotifyEvent read FOnBlockedKey write FOnBlockedKey;
property OnDailyLimit : TNotifyEvent read FOnDailyLimit write FOnDailyLimit;
property OnMaxText : TNotifyEvent read FOnMaxText write FOnMaxText;
property OnNotTranslated : TNotifyEvent read FOnNotTranslated write FOnNotTranslated;
property OnNotSupported : TNotifyEvent read FOnNotSupported write FOnNotSupported;
property OnInvalidParameter : TNotifyEvent read FOnInvalidParameter write FOnInvalidParameter;
end;
procedure Register;
implementation
uses
System.TypInfo // TypeInfo
;
procedure Register;
begin
RegisterComponents('Potansif', [TrtmTranslatorYandex]);
end;
{ TrtmTranslatorYandex }
constructor TrtmTranslatorYandex.Create(aOwner: TComponent);
begin
inherited Create(aOwner);
FOwner := aOwner;
FNetHTTP := TNetHTTPClient.Create(Self);
FEncoder := TURLEncoding.Create;
FNehir := TMemoryStream.Create;
FXmlDOC := TXMLDocument.Create(Self);
FCevap := TStringList.Create;
FLangSource := Turkce;
FLangTarget := Ingilizce;
FText := '';
FResponseCode := 0; // Başlangıç değeridir.
end;
destructor TrtmTranslatorYandex.Destroy;
begin
FreeAndNil(FCevap);
FreeAndNil(FXmlDOC);
FreeAndNil(FNehir);
FreeAndNil(FEncoder);
FreeAndNil(FNetHTTP);
inherited Destroy;
end;
function TrtmTranslatorYandex.GetXMLResult: String;
begin
Result := FCevap.Text;
end;
procedure TrtmTranslatorYandex.SetAPIKey(const Value: String);
begin
FAPIKey := Value;
TranslateTextOut;
end;
procedure TrtmTranslatorYandex.SetLangSource(const Value: TrtmYandexLangs);
begin
FLangSource := Value;
TranslateTextOut;
end;
procedure TrtmTranslatorYandex.SetLangTarget(const Value: TrtmYandexLangs);
begin
FLangTarget := Value;
TranslateTextOut;
end;
procedure TrtmTranslatorYandex.SetText(const Value: String);
begin
FText := Value.Trim;
TranslateTextOut;
end;
function TrtmTranslatorYandex.Translate(const aText: String): String;
begin
if Assigned(FOnBeforeTranslate) then FOnBeforeTranslate(Self);
FURL := 'https://translate.yandex.net';
if (FLangSource = FLangTarget) then begin
if (aText.Length >= 10000) then begin
if Assigned(FOnMaxText) then FOnMaxText(Self);
if Assigned(FOnAfterTranslate) then FOnAfterTranslate(Self);
Exit('');
end else Result := aText;
end else
if (FAPIKey.Trim.IsEmpty = False) and (aText.Trim.IsEmpty = False) then begin
if NOT (csDesigning in Self.ComponentState) then begin
if (aText.Length >= 10000) then begin
if Assigned(FOnMaxText) then FOnMaxText(Self);
if Assigned(FOnAfterTranslate) then FOnAfterTranslate(Self);
Exit('');
end;
FURL := Format( 'https://translate.yandex.net/api/v1.5/tr/translate'
+ '?key=%0:s'
+ '&lang=%1:s-%2:s'
+ '&text=%3:s',
[ {0} FAPIKey
, {1} FLangSource.toString
, {2} FLangTarget.toString
, {3} FEncoder.Encode(aText)
]);
FNehir.Clear;
FNetHTTP.Get(FURL, FNehir);
FNehir.Position := 0;
FCevap.LoadFromStream(FNehir);
FXmlDOC.Active := False;
FXmlDOC.XML.Text := UTF8ToWideString(FCevap.Text); // 16 bitlik ascii karakterlerini göstermek içindir...
FXmlDOC.Active := True;
FResponseCode := StrToIntDef(FXMLDoc.DocumentElement.AttributeNodes.FindNode('code').Text, 0);
FResponseText := '';
if (FResponseCode in [0, 200])
then FResponseText := 'Operation completed successfully'
else FResponseText := FXMLDoc.DocumentElement.AttributeNodes.FindNode('message').Text;
Result := IfThen( FXmlDOC.DocumentElement.ChildNodes.Count = 0
, FResponseText
, FXmlDOC.DocumentElement.ChildNodes['text'].Text
);
case FResponseCode of
0..
200: if Assigned(FOnComplete) then FOnComplete(Self);
401: if Assigned(FOnInvalidKey) then FOnInvalidKey(Self);
402: if Assigned(FOnBlockedKey) then FOnBlockedKey(Self);
404: if Assigned(FOnDailyLimit) then FOnDailyLimit(Self);
413: if Assigned(FOnMaxText) then FOnMaxText(Self);
422: if Assigned(FOnNotTranslated) then FOnNotTranslated(Self);
501: if Assigned(FOnNotSupported) then FOnNotSupported(Self);
502: if Assigned(FOnInvalidParameter) then FOnInvalidParameter(Self);
end;
end else begin
Result := 'Sadece Runtime desteklenir.';
end;
end else begin
Result := '';
end;
if Assigned(FOnAfterTranslate) then FOnAfterTranslate(Self);
end;
procedure TrtmTranslatorYandex.TranslateTextOut;
begin
FTextOut := Translate(FText.Trim);
end;
{ TrtmTranslatorYandex.TrtmYandexLangs_Helper }
function TrtmTranslatorYandex.TrtmYandexLangs_Helper.toIndex: Integer;
begin
Result := Ord(Self);
end;
procedure TrtmTranslatorYandex.TrtmYandexLangs_Helper.toLang(aLang: String);
function &in(aAranan: string; aListe: Array of string): Boolean;
var
S: String;
begin
Result := False;
for S in aListe do if (S = aAranan) then Exit(True);
end;
begin
if &in(aLang, ['az', 'Azerice', 'Azerice', 'Azerbaijan']) then Self := Azerice else
if &in(aLang, ['sq', 'Arnavutça', 'Arnavutca', 'Albanian']) then Self := Arnavutca else
if &in(aLang, ['am', 'Amharca', 'Amharca', 'Amharic']) then Self := Amharca else
if &in(aLang, ['en', 'İngilizce', 'Ingilizce', 'English']) then Self := Ingilizce else
if &in(aLang, ['ar', 'Arapça', 'Arapca', 'Arabic']) then Self := Arapca else
if &in(aLang, ['hy', 'Ermenice', 'Ermenice', 'Armenian']) then Self := Ermenice else
if &in(aLang, ['af', 'Afrikaca', 'Afrikaca', 'Afrikaans']) then Self := Afrikaca else
if &in(aLang, ['eu', 'Baskca', 'Baskca', 'Basque']) then Self := Baskca else
if &in(aLang, ['ba', 'Başkurtca', 'Baskurtca', 'Bashkir']) then Self := Baskurtca else
if &in(aLang, ['be', 'Belarusça', 'Belarusca', 'Belarusian']) then Self := Belarusca else
if &in(aLang, ['bn', 'Bengalce', 'Bengalce', 'Bengali']) then Self := Bengalce else
if &in(aLang, ['my', 'Birmanyaca', 'Birmanyaca', 'Burmese']) then Self := Birmanyaca else
if &in(aLang, ['bg', 'Bulgarca', 'Bulgarca', 'Bulgarian']) then Self := Bulgarca else
if &in(aLang, ['bs', 'Boşnakça', 'Bosnakca', 'Bosnian']) then Self := Bosnakca else
if &in(aLang, ['cy', 'Galce', 'Galce', 'Welsh']) then Self := Galce else
if &in(aLang, ['hu', 'Macarca', 'Macarca', 'Hungarian']) then Self := Macarca else
if &in(aLang, ['vi', 'Vietnamca', 'Vietnamca', 'Vietnamese']) then Self := Vietnamca else
if &in(aLang, ['ht', 'Haitice', 'Haitice', 'Haitian']) then Self := Haitice else
if &in(aLang, ['gl', 'Galisyaca', 'Galisyaca', 'Galician']) then Self := Galisyaca else
if &in(aLang, ['nl', 'Flemenkçe', 'Flemenkce', 'Dutch']) then Self := Flemenkce else
if &in(aLang, ['mrj', 'ÜstMarice', 'UstMarice', 'HillMari']) then Self := UstMarice else
if &in(aLang, ['el', 'Yunanca', 'Yunanca', 'Greek']) then Self := Yunanca else
if &in(aLang, ['ka', 'Gürcüce', 'Gurcuce', 'Georgian']) then Self := Gurcuce else
if &in(aLang, ['gu', 'Gujaratca', 'Gujaratca', 'Gujarati']) then Self := Gujaratca else
if &in(aLang, ['da', 'Danimarkaca', 'Danimarkaca', 'Danish']) then Self := Danimarkaca else
if &in(aLang, ['he', 'İbranice', 'Ibranice', 'Hebrew']) then Self := Ibranice else
if &in(aLang, ['yi', 'Eskenazice', 'Eskenazice', 'Yiddish']) then Self := Eskenazice else
if &in(aLang, ['id', 'Endonezca', 'Endonezca', 'Indonesian']) then Self := Endonezca else
if &in(aLang, ['ga', 'İrlandaca', 'Irlandaca', 'Irish']) then Self := Irlandaca else
if &in(aLang, ['it', 'İtalyanca', 'Italyanca', 'Italian']) then Self := Italyanca else
if &in(aLang, ['is', 'İzlandaca', 'Izlandaca', 'Icelandic']) then Self := Izlandaca else
if &in(aLang, ['es', 'İspanyolca', 'Ispanyolca', 'Spanish']) then Self := Ispanyolca else
if &in(aLang, ['kk', 'Kazakca', 'Kazakca', 'Kazakh']) then Self := Kazakca else
if &in(aLang, ['kn', 'Kannadaca', 'Kannadaca', 'Kannada']) then Self := Kannadaca else
if &in(aLang, ['ca', 'Katalanca', 'Katalanca', 'Catalan']) then Self := Katalanca else
if &in(aLang, ['ky', 'Kırgızca', 'Kirgizca', 'Kyrgyz']) then Self := Kirgizca else
if &in(aLang, ['zh', 'Çince', 'Cince', 'Chinese']) then Self := Cince else
if &in(aLang, ['ko', 'Korece', 'Korece', 'Korean']) then Self := Korece else
if &in(aLang, ['xh', 'Xhosaca', 'Xhosaca', 'Xhosa']) then Self := Xhosaca else
if &in(aLang, ['km', 'Kmerce', 'Kmerce', 'Khmer']) then Self := Kmerce else
if &in(aLang, ['lo', 'Laosca', 'Laosca', 'Laotian']) then Self := Laosca else
if &in(aLang, ['la', 'Latince', 'Latince', 'Latin']) then Self := Latince else
if &in(aLang, ['lv', 'Letonca', 'Letonca', 'Latvian']) then Self := Letonca else
if &in(aLang, ['lt', 'Litvanca', 'Litvanca', 'Lithuanian']) then Self := Litvanca else
if &in(aLang, ['lb', 'Lüksemburgca', 'Luksemburgca', 'Luxembourgish']) then Self := Luksemburgca else
if &in(aLang, ['mg', 'Madagaskarca', 'Madagaskarca', 'Malagasy']) then Self := Madagaskarca else
if &in(aLang, ['ms', 'Malayaca', 'Malayaca', 'Malay']) then Self := Malayaca else
if &in(aLang, ['ml', 'Malayalamca', 'Malayalamca', 'Malayalam']) then Self := Malayalamca else
if &in(aLang, ['mt', 'Maltaca', 'Maltaca', 'Maltese']) then Self := Maltaca else
if &in(aLang, ['mk', 'Makedonca', 'Makedonca', 'Macedonian']) then Self := Makedonca else
if &in(aLang, ['mi', 'Maorice', 'Maorice', 'Maori']) then Self := Maorice else
if &in(aLang, ['mr', 'Marathice', 'Marathice', 'Marathi']) then Self := Marathice else
if &in(aLang, ['mhr', 'Marice', 'Marice', 'Mari']) then Self := Marice else
if &in(aLang, ['mn', 'Moğolca', 'Mogolca', 'Mongolian']) then Self := Mogolca else
if &in(aLang, ['de', 'Almanca', 'Almanca', 'German']) then Self := Almanca else
if &in(aLang, ['ne', 'Nepalce', 'Nepalce', 'Nepali']) then Self := Nepalce else
if &in(aLang, ['no', 'Norveççe', 'Norvecce', 'Norwegian']) then Self := Norvecce else
if &in(aLang, ['pa', 'Pencapca', 'Pencapca', 'Punjabi']) then Self := Pencapca else
if &in(aLang, ['pap', 'Papiamentoca', 'Papiamentoca', 'Papiamento']) then Self := Papiamentoca else
if &in(aLang, ['fa', 'Farsça', 'Farsca', 'Persian']) then Self := Farsca else
if &in(aLang, ['pl', 'Polonca', 'Polonca', 'Polish']) then Self := Polonca else
if &in(aLang, ['pt', 'Portekizce', 'Portekizce', 'Portuguese']) then Self := Portekizce else
if &in(aLang, ['ro', 'Romence', 'Romence', 'Romanian']) then Self := Romence else
if &in(aLang, ['ru', 'Rusça', 'Rusca', 'Russian']) then Self := Rusca else
if &in(aLang, ['ceb', 'Cebuanoca', 'Cebuanoca', 'Cebuano']) then Self := Cebuanoca else
if &in(aLang, ['sr', 'Sırpça', 'Sirpca', 'Serbian']) then Self := Sirpca else
if &in(aLang, ['si', 'Sinhalaca', 'Sinhalaca', 'Sinhala']) then Self := Sinhalaca else
if &in(aLang, ['sk', 'Slovakça', 'Slovakca', 'Slovakian']) then Self := Slovakca else
if &in(aLang, ['sl', 'Slovence', 'Slovence', 'Slovenian']) then Self := Slovence else
if &in(aLang, ['sw', 'Svahilice', 'Svahilice', 'Swahili']) then Self := Svahilice else
if &in(aLang, ['su', 'Sundaca', 'Sundaca', 'Sundanese']) then Self := Sundaca else
if &in(aLang, ['tg', 'Tacikçe', 'Tacikce', 'Tajik']) then Self := Tacikce else
if &in(aLang, ['th', 'Taylandca', 'Taylandca', 'Thai']) then Self := Taylandca else
if &in(aLang, ['tl', 'Tagalogca', 'Tagalogca', 'Tagalog']) then Self := Tagalogca else
if &in(aLang, ['ta', 'Tamilce', 'Tamilce', 'Tamil']) then Self := Tamilce else
if &in(aLang, ['tt', 'Tatarca', 'Tatarca', 'Tatar']) then Self := Tatarca else
if &in(aLang, ['te', 'Teluguca', 'Teluguca', 'Telugu']) then Self := Teluguca else
if &in(aLang, ['tr', 'Türkçe', 'Turkce', 'Turkish']) then Self := Turkce else
if &in(aLang, ['udm', 'Udmurtça', 'Udmurtca', 'Udmurt']) then Self := Udmurtca else
if &in(aLang, ['uz', 'Özbekçe', 'Ozbekce', 'Uzbek']) then Self := Ozbekce else
if &in(aLang, ['uk', 'Ukraynaca', 'Ukraynaca', 'Ukrainian']) then Self := Ukraynaca else
if &in(aLang, ['ur', 'Urduca', 'Urduca', 'Urdu']) then Self := Urduca else
if &in(aLang, ['fi', 'Fince', 'Fince', 'Finnish']) then Self := Fince else
if &in(aLang, ['fr', 'Fransızca', 'Fransizca', 'French']) then Self := Fransizca else
if &in(aLang, ['hi', 'Hintçe', 'Hintce', 'Hindi']) then Self := Hintce else
if &in(aLang, ['hr', 'Hırvatca', 'Hirvatca', 'Croatian']) then Self := Hirvatca else
if &in(aLang, ['cs', 'Çekçe', 'Cekce', 'Czech']) then Self := Cekce else
if &in(aLang, ['sv', 'İsveççe', 'Isvecce', 'Swedish']) then Self := Isvecce else
if &in(aLang, ['gd', 'İskoçca', 'Iskocca', 'Scottish']) then Self := Iskocca else
if &in(aLang, ['et', 'Estonca', 'Estonca', 'Estonian']) then Self := Estonca else
if &in(aLang, ['eo', 'Esperantoca', 'Esperantoca', 'Esperanto']) then Self := Esperantoca else
if &in(aLang, ['jv', 'Cavaca', 'Cavaca', 'Javanese']) then Self := Cavaca else
if &in(aLang, ['ja', 'Japonca', 'Japonca', 'Japanese']) then Self := Japonca else
begin
{ Standart else sonu }
Self := Self;
end;
end;
function TrtmTranslatorYandex.TrtmYandexLangs_Helper.toString: String;
begin
case Self of
Azerice : Result := 'az';
Arnavutca : Result := 'sq';
Amharca : Result := 'am';
Ingilizce : Result := 'en';
Arapca : Result := 'ar';
Ermenice : Result := 'hy';
Afrikaca : Result := 'af';
Baskca : Result := 'eu';
Baskurtca : Result := 'ba';
Belarusca : Result := 'be';
Bengalce : Result := 'bn';
Birmanyaca : Result := 'my';
Bulgarca : Result := 'bg';
Bosnakca : Result := 'bs';
Galce : Result := 'cy';
Macarca : Result := 'hu';
Vietnamca : Result := 'vi';
Haitice : Result := 'ht';
Galisyaca : Result := 'gl';
Flemenkce : Result := 'nl';
UstMarice : Result := 'mrj';
Yunanca : Result := 'el';
Gurcuce : Result := 'ka';
Gujaratca : Result := 'gu';
Danimarkaca : Result := 'da';
Ibranice : Result := 'he';
Eskenazice : Result := 'yi';
Endonezca : Result := 'id';
Irlandaca : Result := 'ga';
Italyanca : Result := 'it';
Izlandaca : Result := 'is';
Ispanyolca : Result := 'es';
Kazakca : Result := 'kk';
Kannadaca : Result := 'kn';
Katalanca : Result := 'ca';
Kirgizca : Result := 'ky';
Cince : Result := 'zh';
Korece : Result := 'ko';
Xhosaca : Result := 'xh';
Kmerce : Result := 'km';
Laosca : Result := 'lo';
Latince : Result := 'la';
Letonca : Result := 'lv';
Litvanca : Result := 'lt';
Luksemburgca : Result := 'lb';
Madagaskarca : Result := 'mg';
Malayaca : Result := 'ms';
Malayalamca : Result := 'ml';
Maltaca : Result := 'mt';
Makedonca : Result := 'mk';
Maorice : Result := 'mi';
Marathice : Result := 'mr';
Marice : Result := 'mhr';
Mogolca : Result := 'mn';
Almanca : Result := 'de';
Nepalce : Result := 'ne';
Norvecce : Result := 'no';
Pencapca : Result := 'pa';
Papiamentoca : Result := 'pap';
Farsca : Result := 'fa';
Polonca : Result := 'pl';
Portekizce : Result := 'pt';
Romence : Result := 'ro';
Rusca : Result := 'ru';
Cebuanoca : Result := 'ceb';
Sirpca : Result := 'sr';
Sinhalaca : Result := 'si';
Slovakca : Result := 'sk';
Slovence : Result := 'sl';
Svahilice : Result := 'sw';
Sundaca : Result := 'su';
Tacikce : Result := 'tg';
Taylandca : Result := 'th';
Tagalogca : Result := 'tl';
Tamilce : Result := 'ta';
Tatarca : Result := 'tt';
Teluguca : Result := 'te';
Turkce : Result := 'tr';
Udmurtca : Result := 'udm';
Ozbekce : Result := 'uz';
Ukraynaca : Result := 'uk';
Urduca : Result := 'ur';
Fince : Result := 'fi';
Fransizca : Result := 'fr';
Hintce : Result := 'hi';
Hirvatca : Result := 'hr';
Cekce : Result := 'cs';
Isvecce : Result := 'sv';
Iskocca : Result := 'gd';
Estonca : Result := 'et';
Esperantoca : Result := 'eo';
Cavaca : Result := 'jv';
Japonca : Result := 'ja';
end;
end;
function TrtmTranslatorYandex.TrtmYandexLangs_Helper.toTextList: String;
var
Eleman: TrtmTranslatorYandex.TrtmYandexLangs;
begin
for Eleman := Low (TrtmTranslatorYandex.TrtmYandexLangs)
to High(TrtmTranslatorYandex.TrtmYandexLangs)
do Result := Result
+ GetEnumName( TypeInfo(TrtmTranslatorYandex.TrtmYandexLangs), Ord(Eleman) )
+ #13#10
;
end;
end.
Yandex Translate - witalihakko - 10-10-2018 Bende bir yerlerde böyle birşey yazmıştım ![]() http://www.delphican.com/masaustu-ceviri-uygulamasi-microsoft-yandex-google-kaynak-kodlu.html Cvp: Yandex Translate - narkotik - 11-10-2018 (10-10-2018, Saat: 17:59)uparlayan Adlı Kullanıcıdan Alıntı: Bu da benden olsun, ilk kodu birazcık değiştirdim... Hocam yine çitayı yükseltmişsiniz, elinize sağlık. Kodlarınızdan ekstra olarak Exit(True); kullanımını öğrenmiş oldum. Normalde bir begin end; kapatır açardık.
Cvp: Yandex Translate - edo - 11-10-2018 (10-10-2018, Saat: 17:13)Cyber Adlı Kullanıcıdan Alıntı:(10-10-2018, Saat: 16:53)edo Adlı Kullanıcıdan Alıntı:uses SysUtils, System.Classes, System.Net.HttpClientComponent, Xml.XMLDoc, Forms, StrUtils;şeklinde sorun çıkarmaması lazım. Bu özellik/notasyonun bildiğim kadarıyla geliş amacı zaten Vcl ve Fmx uyumlu kütüphane linklerinde sorun yaşamamak olması lazım. Project>Options>Compiler altına Unit Scope Names diye bir alan var, onu bir incelemenenizi öneririm. Dotted unit names in Delphi Unit_Scope_Names Adding Unit Scope Names for Your Own Components |