COM-API "Process"-Functions

 

NEW with RC-WinTrans 11.5.4  (March 2021)

"Process" API functions with functionality same as in the command line interface.

This topic is an introduction for this functions.

 

Objects and Functions

 

Application

·

OpenGetProject

Loads a project by file name (.rwtproct or .fsmdb)
Returns a TranslationProject.

 

 

TranslationProject  (Tranalation Project)

·

TranslationStatus

Translation status.
Returns a percent value (0 to 100) of the specified target language data.

·

WriteTargetFile

Writes all (translated) target files in a specified language.

·

UpateDatabase

Updates the translation data of all the source files for a given target language.
 

·

IsUpToDate

Checks if any of the project's source files  has changed.  This check is performed for the data with the specified target language.

 

 

ExFcts   (Extended Functions)

·

TranslationStatus

Translation status.
Returns a percent value (0 to 100) of the specified target language data.

 

·

WriteTargetFile

Writes all or one single (translated) target file in a specified language.
 

·

UpateDatabase

Updates the translation data of a single source file or of all the source files for a given target language.
 

·

IsUpToDate

Checks whether a given source file or any of the project's source files has/have changed.  This check is performed for the data with the specified target language.

 


 

Functions Description

·

OpenGetProject  

IRWTProject*  OpenGetProject ( BSTR projFile, BSTR tgtLang, boolean openProjWindow)

 

DESCRIPTION:

Loads and opens a translation project by a given file name. The project will be initialized for the/a  target language.

PARAMETER:

1. projFile

   File name; the full path of the project file (.rwtproject) or database file (.fsmdb)

2. tgtLang

  Target language; the language code of the target language.

  Can be an empty string to use the/a  target language set as visible for  the GUI.


3, openProjWindow

    True ("1): Opens the project -- Opens a project window (GUI).
   

RETURN:

Translation project interface IRWTProject*

 

EXAMPLE:
(VBA)

Dim Proj As TranslationProject

Set Proj = RCWinTrans.OpenGetProject("MyProj.rwtproject", "de", False )

 TOP ^

·

TranslationStatus 

1: long  ExFct.TranslationStatus ( BSTR projFile, BSTR Lang )

2: long  ProjectObj.TranslationStatus ( BSTR Lang)

DESCRIPTION:

Verifies the translation (0%-100%) status of all source files contained in a translation project for the specified target language.  A file is considered to be translated when a translation (target text) exists for all text items and the translation status of all items is set to either "translated" or "final."

PARAMETER:

1. projFile

Project file name; the full path to the translation project file (.rwtproject) or the project database file (.fsmdb).

2. Lang

Target language; the language code for the language to be used.

 

RETURN:

 A  value (long) between  "0"- "100" [%].

 

EXAMPLE 1:

(VBA)

Dim lVal As long

lVal =  Application.ExFcts.TranslatonStatus("MyProj.fsmdb", "fr-FR")

 

 

EXAMPLE 2:

(VBA)

Dim Proj As TranslationProject

Set Proj = RCWinTrans.OpenGetProject("MyProj.fsmdb", "", False)

 

Dim lVal As long

lVal =  Proj.TranslatonStatus("fr-FR")

^ TOP ^

·

IsUpToDate  

1: boolean ExFcts.IsUpToDate ( BSTR  projFile, BSTR Lang )

2: boolean ProjectObj.IsUpToDate ( BSTR Lang )

DESCRIPTION:

Checks whether a given source file or any of the project's source files has/have changed.  This check is performed for the data with the specified target language.

PARAMETERS:

1.  projFile

Project file name; the full path to the translation project file (.rwtproject) or  the project database file (.fsmdb).

2.  Lang

Target language; the language code for the target language being used.

RETURN:

"1" = no source file changes
"0" = at least one source file has changed

 

'EXAMPLE 1

(VBA)

Dim bVal As Boolean

bVal =  RCWinTrans.ExFcts.IsUpToDate("MyeProjj.fsmdb", "en-UK")

 

 

EXAMPLE 2

(VBA)

Dim Proj As TranslationProject

Set Proj = RCWinTrans.OpenGetProject("MyProj.fsmdb", "", False)

 

Dim bVal As Boolean

bVal =  RCWinTrans.ExtFcts.IsUpToDate( "en-UK")

^ TOP ^

·

UpdateDatabase  

1: boolean  ExFcts.UpdateDatabase ( BSTR  projFile, BSTR srcFile, BSTR Lang,

                                             BSTR  logFile, boolean forceAll,

                                            VARIANT* nFilesUpdated, VARIANT* nDeletedItems,

                                            VARIANT* nNewItems, VARIANT* nChangedItems )

 

2:  boolean  ProjectObj.UpdateDatabase ( BSTR Lang,

                        VARIANT* nDeletedItems,  VARIANT* nNewItems, VARIANT* nChangedItems )

 

DESCRIPTION:

Updates the translation data of a single source file or of all the source files for the specified target language. Unchanged source files will be skipped (no update).  To force an update for an unchanged source file, use the parameter forceAll (=True)

PARAMETER:

1. projFile

Project file name; the full path to the translation project file (.rwtproject) or  the project database file (.fsmdb).

 

2. srcFile

Source file; the source file name for which translation data will be updated.

The string can be the full path plus the file name, or only the file name.

Note: Use an empty string to apply the data update to all source files.

 

3.  Lang

  Target language; the language code for the target language being used.

 

4.  logFile

  Name of a log file. To writes processing information and results to this file.

 

5. forceAll

   True: Forces a data update for all source files.

    False: Update the data for changed source files only..

 

6.  nFilesUpdated

     Returns the number of files being updated.

    The parameter can be a null pointer.

7.  nDeletedItems

     Returns the number of items being removed.

     The parameter can be a null pointer.

8.  nNewtems

    Returns the number of new items added to the database.

    The parameter can be a null pointer. 

9.  nChangedtems

     Returns the number of items with a changed source text.

     The parameter can be a null pointer.

 

RETURN:

"1" = successful.  Sussessful for al files to be updated

"0" = unsuccessful. Error(s). The data for at least one source file could not be updated.  Use the Error object to check errors and get error message text.

 

 

EXAMPLE (VBA):

Dim b As Boolean

b = RCWinTrans.ExFcts.UpdateDatabase("MyProj.fsmdb","", "ja-JA","",False,Null,Null,Null,Null)

 

If RCWinTrans.Errors.Count > 0 Then

   MsgBox RCWinTrans.Errors.LastError

End If

 

 

 

 

EXAMPLE (VBA):

Dim b As Boolean

Dim nDel As Variant

Dim nNew As Variant

Dim nChanged As Variant

Dim Proj As TranslationProject

 

Set Proj = RCWinTrans.OpenGetProject("MyProj.fsmdb", "ja-JA", False)

b = Proj.UpdateDatabase("ja-JA",nDel, nNew, nChanged )

 

If RCWinTrans.Errors.Count > 0 Then

   MsgBox RCWinTrans.Errors.LastError

End If

 

^ TOP ^

·

WriteTargetFile  

1:  long  ExFcts.WriteTargetFile( BSTR projFile, BSTR srcFile, BSTR tgtFile, BSTR Lang,
                                                                                BSTR logFile,  boolean  forceAll )

2:  long  ProjectObj.WriteTargetFile( BSTR srcFile, BSTR tgtFile, BSTR Lang,
                                                                                BSTR logFile,  boolean  forceAll )

 

DESCRIPTION:

Writes all target files or one single (translated) target file in the specified language. The target file name rule and the target file encoding designated in the project will be used. By default, a target file is written when it is outdated - otherwise it is skipped.

To force all target files to be written anew, use the parameter forceAll (=True).

PARAMETERS:

1. projFile

Project file name; the full path to the  translation project file (.rwtproject) or the project database file (.fsmdb).

 

2. srcFile

Source file; the source file name to write a target file for.

The string can be the full path plus the file name, or only the file name.

Note: Use an empty string to apply to write the target files for all source files.

 

3.tgtFile

Target file; the file name for the (translated) target file.

Options:

 a) use the full path plus the file name;

 b) use only the file name to write to the same location as the source file; or

 c) use an empty string to use the target file name as specified in the translation project.

The parameter is ignored when the 'srcFile' parameter is empty.

 

4. Lang

Target language; the language code for the target language being used.

 

5. logFile

File name; the name of the log file to which processing information is written.

 

6. forceAll

 True:  Forces all target files to be written.

 False: Writes a target file only when the target file doesn't exist or when it is outdated.

 

RETURN:

The number of target files written successfully.

 Note on error(s): The information that a target file could not be written is not returned with the return value. Use the Error object to check if there was an error and if a file could not be written.  

See the example below.

 

 

EXAMPLE 1 (VBA):

--------------------------

Dim nFiles As long

nFiles = RCWinTrans.ExFcts.WriteTargetFile("MyProj.fsmdb","","", "ch-CHS","",True)

 

If RCWinTrans.Errors.Count > 0 Then

   MsgBox RCWinTrans.Errors.LastError

End If

 

 

 

 

EXAMPLE 2 (VBA):

----------------------------

Dim Proj As TranslationProject

Dim nFiles As long

Set Proj = RCWinTrans.OpenGetProject("MyProj.fsmdb", "ch_CHS", False)

nFiles =  Proj..WriteTargetFile("","", "ch-CHS","",True)

 

If RCWinTrans.Errors.Count > 0 Then

   MsgBox RCWinTrans.Errors.LastError

End If

 

 


^ TOP ^