Documentation Center

PassoloApp.TranslateText

Returns a list of translations for one string. Depending on MinMatch it looks for pre-translations or fuzzy matches. The function will search through all translation providers as set up in the SDL Passolo options. But, in contrast to the Passolo application this function only uses translation providers that are capable of return synchronous results

Syntax

Expression.TranslateText (Text as String, LanguageFrom as Variant, LanguageTo as Variant, MinMatch as Variant, MaxCount as Variant) as PslTranslations

Expression Required. Object of type PslTransList

Text String, Required. This string will be translated.

LanguageFrom Required. The source language for the translation. Specify the language by its ID (1033 for English(USA)) or by its name ("enu")

LanguageTo Required. The source language for the translation

MinMatch Variant, optional. Specifies the minimum match required. The default value is 100, so that the function searches for pre-translations. A value less then 100 will look for fuzzy matches.

MaxCount Variant, optional. Specifies the maximum number of translations to be returned. The default value ist 10.

Example

Sub Main
    ' Clear the output window
    PSL.OutputWnd(pslOutputWndMessages).Clear

    Dim ts As PslTranslations
    Dim t As PslTranslation

    ' Pretranslation
    PSL.Output("Pre-Translation------------------")
    Set ts = PSL.TranslateText("Resources: ", 1033, 1031, 100)

    For Each t In ts
        PSL.Output t.TransString & " (" & t.Origin & ")"
    Next

    ' Fuzzy Matches
    PSL.Output("Fuzzy Matches-------------------")
    Set ts = PSL.TranslateText("&File", 1033, 1031, 80)

    For Each t In ts
        PSL.Output t.TransString & " (" & t.Origin & ")"
    Next

End Sub