Calling convention: Google_Translate("Text": String, "TargetLanguage": String, ["SourceLanguage": String]): String
Description: Translates one plain text string using Google Cloud Translation. Configure the Google Translate API key in
System settings -> API -> Google -> API Key
before translating nonempty text.
Parameters:
Text = Text to translate. Unicode characters and line breaks are supported.
TargetLanguage = Required Google language code, for example "en", "de" or "hu".
SourceLanguage = Optional Google language code. Omit it or pass an empty string to detect the source language automatically.
Returns: String: translated plain text. Empty input returns an empty string without calling Google or requiring an API key. If any supplied argument is NULL, returns NULL without calling Google.
Availability: Default.
Errors: An invalid argument count, an empty target language, a missing API key, a connection error, a timeout, an HTTP error or an invalid response raises a MathParser error. A failed request does not silently return the original text.
Execution: The function waits for the translation before returning. Each nonempty call sends a separate request to Google and is subject to the project's billing and quota. Avoid calling it repeatedly from formulas that refresh automatically.
Example:
Result := Google_Translate("Machine error", "hu", "en");
Example with automatic source language detection:
Result := Google_Translate("Machine error", "de");
Error handling example:
try
Result := Google_Translate("Machine error", "hu");
except
Result := "Translation failed: " + CIP_GetLastErrorMessage();
end;