Copy language and add prefix to each text

We need to create a "dummy language" for testing.

We need it for clarify which texts are translatable and which are not.

How can I copy content of English target to another target (for example Tatar) where all texts in Tatar column would be corresponding copy text from English with prefix (specifically "▲" character).

Example:

Source text: "Fehler"

English translation: "Error"

Tatar translation: "▲Error"

emoji
Parents
  • Thanks  for the code you provided me. It really helped me.

    And this is the solution:

    Sub Main
    	Dim prj As PslProject
    	Set prj = PSL.ActiveProject
    	Dim dstTransList As PslTransList
    	Set dstTransList = PSL.ActiveTransList
    	Dim dstSourceList As PslSourceList
    	Set dstSourceList = prj.SourceLists.Item(2)
    
    	' Get English translation List
    	Dim engTransList As PslTransList
    	For i = 1 To prj.TransLists.Count
    		Set engTransList = prj.TransLists.Item(i)
    		If engTransList.SourceList.ListID = dstSourceList.ListID And engTransList.Language.LangID = 9 Then
    			Exit For
    		End If
    	Next i
    
    	' Populate dummy translation
    	For j = 1 To dstTransList.StringCount
    		Dim dstTransString As PslTransString
    		Set dstTransString = dstTransList.String(j)
    		If dstTransString.State(pslStateReadOnly) = False And dstTransString.State(pslStateHidden) = False And dstTransString.State(pslStateLocked) = False And dstTransString.State(pslStateTranslated) = False Then
    			Dim engTransString As PslTransString
    			Set engTransString = engTransList.String(j)
    			If engTransString.State(pslStateTranslated) Then
    				dstTransString.Text = "▲" + engTransString.Text
    			Else
    				dstTransString.Text = "▼" + dstTransString.Text
    			End If
    			dstTransString.State(pslStateTranslated) = True
    		End If
    	Next j
    
    	dstTransList.Save
    End Sub

    emoji
Reply
  • Thanks  for the code you provided me. It really helped me.

    And this is the solution:

    Sub Main
    	Dim prj As PslProject
    	Set prj = PSL.ActiveProject
    	Dim dstTransList As PslTransList
    	Set dstTransList = PSL.ActiveTransList
    	Dim dstSourceList As PslSourceList
    	Set dstSourceList = prj.SourceLists.Item(2)
    
    	' Get English translation List
    	Dim engTransList As PslTransList
    	For i = 1 To prj.TransLists.Count
    		Set engTransList = prj.TransLists.Item(i)
    		If engTransList.SourceList.ListID = dstSourceList.ListID And engTransList.Language.LangID = 9 Then
    			Exit For
    		End If
    	Next i
    
    	' Populate dummy translation
    	For j = 1 To dstTransList.StringCount
    		Dim dstTransString As PslTransString
    		Set dstTransString = dstTransList.String(j)
    		If dstTransString.State(pslStateReadOnly) = False And dstTransString.State(pslStateHidden) = False And dstTransString.State(pslStateLocked) = False And dstTransString.State(pslStateTranslated) = False Then
    			Dim engTransString As PslTransString
    			Set engTransString = engTransList.String(j)
    			If engTransString.State(pslStateTranslated) Then
    				dstTransString.Text = "▲" + engTransString.Text
    			Else
    				dstTransString.Text = "▼" + dstTransString.Text
    			End If
    			dstTransString.State(pslStateTranslated) = True
    		End If
    	Next j
    
    	dstTransList.Save
    End Sub

    emoji
Children
No Data