PslTransList.StringCount
Returns the number of strings in this list. If the list is still closed, it will be opened.
Syntax
Expression.StringCount (optional Type as VARIANT) as Long
Expression Object of type PslTransList
Type Can be one of the following values:
- pslIndex (default, Value = 0): The total number of (undeleted) strings will be returned.
- pslIndexDeleted (Value = 4): The total number of deleted strings in the recycle bin will be returned.
- pslDisplay (Value = 1): The number of displayed strings will be returned. This value is supported for backward compatibility only. See the note below.
- pslSelection (Value = 2): The number of selected strings will be returned. This value is supported for backward compatibility only. See the note below.
The following values use the stored counters in the project. The string list does not need to be loaded, which makes the call much faster.
- pslTotal (Value = 100): Returns the total number of strings. Same as pslIndex
- pslToTranslate (Value = 101): Returns that number of strings that need to be translated. This is pslTotal minus empty strings and strings that don't need to be translated, e.g. hidden or read-only strings.
- pslTranslated (Value = 102): Returns that number of strings that are translated, including pre-translated and for-review strings (green, blue, black).
- pslForReview (Value = 103): Returns that number of strings that are pre-translated or marked for-review (green, blue).
- pslUntranslated (Value = 104): Returns that number of strings that are not translated (red).
- pslValidated (Value = 105): Returns that number of strings that are translated and validated (black).
Example
Sub main
' Creates a glossary from the current translation list
Dim trn As PslTransList
Set trn = PSL.ActiveTransList
If trn Is Nothing Then Exit Sub
stringcount = trn.StringCount
Open "c:\MyGlossary.txt" For Output As #1
Print #1,trn.SourceList.LangID;Chr(9);trn.Language.LangID
codepage1 = trn.SourceList.Option(pslOptionActualCodepage)
codepage2 = trn.Language.Option(pslOptionActualCodepage)
For i = 1 To stringcount
Dim t As PslTransString
Set t = trn.String(i)
If t.State(pslStateTranslated) Then
Dim s1 As String
s1 = PSL.ConvertUnicode2ASCII(t.SourceText, codepage1)
s2 = PSL.ConvertUnicode2ASCII(t.Text, codepage2)
Print #1,s1;Chr(9);s2
End If
Next i
End Sub