How to do pretranslation, using a macro

Hello,

at the moment, I'm trying to create a macro for Passolo 2022, which I can start to run a pretranslation of my untranslated strings.

Unfortunately, I don't know, how to get this done.
I've tried to use

Dim Translation As PslTranslations
Dim t As PslTranslation
If TranslationList.IsDeleted = False And TranslationList.Language.LangID = PSL.GetLangID(Right(project.Name, 2), pslCodeISO) Then
	For x = 1 To TranslationList.StringCount - 1
		If TranslationList.String(x).State(pslStateTranslated) = False Then
			PSL.Output(TranslationList.Title & ", String-Nummer: " & TranslationList.String(x).Number & ", String-ID: " & TranslationList.String(x).ID & ", String-Text: " & TranslationList.String(x).Text)
			TranslationList.String(x).Text = PSL.TranslateText(TranslationList.String(x).SourceText, 1031, 1033, 100)
			logMessage = Chr(9) & Chr(9) & "Translist-Titel: '" & TranslationList.Title & "', String Nummer: " & TranslationList.String(x).Number & ", ID: '" & TranslationList.String(s).ID & "', String-Text: '" & TranslationList.String(s).Text & "', Sprach-Code: '" & TranslationList.String(s).TransList.Language.LangID & "', Quellstring: '" & TranslationList.String(x).SourceText & "',  Übersetzung: '" & TranslationList.String(x).Text & "'"
			WriteLog(logMessage, pretranslationLog)
		End If
	Next
End If
as well as
Dim Translation As PslTranslations
Dim t As PslTranslation
If TranslationList.IsDeleted = False And TranslationList.Language.LangID = PSL.GetLangID(Right(project.Name, 2), pslCodeISO) Then
	For x = 1 To TranslationList.StringCount - 1
		If TranslationList.String(x).State(pslStateTranslated) = False Then
			PSL.Output(TranslationList.Title & ", String-Nummer: " & TranslationList.String(x).Number & ", String-ID: " & TranslationList.String(x).ID & ", String-Text: " & TranslationList.String(x).Text)
			Set Translation = PSL.TranslateText(TranslationList.String(x).SourceText, 1031, 1033, 100)
			logMessage = Chr(9) & Chr(9) & "Translist-Titel: '" & TranslationList.Title & "', String Nummer: " & TranslationList.String(x).Number & ", ID: '" & TranslationList.String(s).ID & "', String-Text: '" & TranslationList.String(s).Text & "', Sprach-Code: '" & TranslationList.String(s).TransList.Language.LangID & "', Quellstring: '" & TranslationList.String(x).SourceText & "',  Übersetzung: '" & TranslationList.String(x).Text & "'"
			WriteLog(logMessage, pretranslationLog)
		End If
	Next
End If
but neither worked.

What do I have to do or what to I have to use instead, to get my pretranslation done by a macro?

Thank you very much in advance for your hints and your support.

Kind regards and have a great day.

Nils

emoji
Parents
  • Hi again,

    I think, I've found a "solution" but I'm not sure, if it's really a solution. So I'm looking forward for your suggestions, tipps, tricks and hints.

    I've changed my code to

    If TranslationList.IsDeleted = False And TranslationList.Language.LangID = PSL.GetLangID(Right(project.Name, 2), pslCodeISO) Then
    	TranslationList.AutoTranslate(pslAll, False, True, pslMultiTakeFirst)
    End If

    And one additional question: What's the difference between ".TranslateText" and ".Autotranslate"; beside the fact that the first is a method of PSL, where the second is a method of TransList?

    Thank you very much in advance for further informations.

    Best regards

    Nils

    emoji
Reply
  • Hi again,

    I think, I've found a "solution" but I'm not sure, if it's really a solution. So I'm looking forward for your suggestions, tipps, tricks and hints.

    I've changed my code to

    If TranslationList.IsDeleted = False And TranslationList.Language.LangID = PSL.GetLangID(Right(project.Name, 2), pslCodeISO) Then
    	TranslationList.AutoTranslate(pslAll, False, True, pslMultiTakeFirst)
    End If

    And one additional question: What's the difference between ".TranslateText" and ".Autotranslate"; beside the fact that the first is a method of PSL, where the second is a method of TransList?

    Thank you very much in advance for further informations.

    Best regards

    Nils

    emoji
Children