Target File Names Dialog Box

 

The Target File Names dialog box (see figure below) lets you define a rule specifying a target path and a target file name to be used for all of the project's target files (of a certain type) or for the current target file only.

 

Open this dialog by clicking on the Target file names button at the bottom of the Target Files page (Source and Target Files dialog box).

 

 

Introduction

The path and name of a target file may depend on your specific project and must usually follow the rules of the software development platform with which the software project (source files) were created. For example, the target file path and name of a .NET assembly DLL follows (according to the development platform) different rules than the properties files of a Sun Java project:

 

.NET EXE file  (Chinese Traditional target language)

Source file: C:\MyProject\MyAppl.exe

Target file: C:\MyProject\zh-tw\MyAppl.resources.dll

 

Java properties file  (Chinese Traditional target language)

Source file: C:\MyProject\MyAppl.properties

Target file: C:\MyProject\MyAppl_zh_TW.properties

 

As you can see in the examples above, a .NET target file (assembly DLL) is written to a subdirectory of the executable file where the name of the subdirectory is the locale language code (string) of the target language.  The target file of a Java properties file is usually written to the same directory as the source file, and the name of a Java properties file follows the rule that the target file name is a combination of the name of the source file plus the locale language string of the target language.

 

Since a target file is created using specific rules for the path and file name, these rules must be definable.  This can be done in the Target File Names dialog box.

 

NOTE  –  "Rules per File Type":  By default, a target file rule implemented in RC-WinTrans will be defined for all the files of that particular type within a translation project.  The rule can also be specified for a single target file.

 

 

Figure:  The Target File Names dialog box.

 

Target file path and target file name based on the specified rules.

File type for which the file name and path rule are valid.

The naming rule for the target file path.

The naming rule for the target file name.

Command buttons to select a definition placeholder for the corresponding rule on the left.

Specification of the naming rules as valid for all the target files of the selected file type or for the current target file only.

Additional file info: selected target language, corresponding source file and project path.

Specify an existing VBA macro to return the target file path and name.  See "Calling a VBA Macro" below.

 

 

The two primary fields of the Target File Names dialog box are (1) the Path edit field which defines the target path rule and (2) the File name edit field which defines the rule for the target file name. Placeholders are used (in a rule) in both of these fields to define the target path and name.  A rule can also contain statically-named path names, subfolders, and/or file names.

 

Select and add a placeholder by clicking on the appropriate button (#3 above) to open a local menu with a selection of placeholders.

 

 

Placeholders for Language Code and Path Definitions

The four available language code placeholders can be used to extend the target file name or path. The tables below describes the placeholders that can be used in the path and file name rule definitions.

 

Language Placeholder

Description

Example

<WinLangID>

Windows language ID.

"1028"

<WinLangCode>

Windows language code.

"CHT"

<JavaLangCode>

Java language code.

"zh_TW"

<LangCode>

Language/Region code.

"zh-tw"

 

Path and File Name
Placeholder

Description

Example

<ProjFilePath>

Path of the project definition file also named as the project path.

"C:\MyProject"

<relSourcePath>

Path to the source file relative to the project path.

"JavaFiles\"

<absSourcePath>

Source file path (absolute path).

"C:\MyProject\JavaFiles"

<SrcFileName>

File name of the source file without the file extension.

"MyAppl"

<SrcFileExt>

File extension of the source file.

"properties"

<SrcFileName.Ext>

File name and file extension of the source file.

"MyAppl.properties"

 

 

Calling a VBA Macro to Supply a Target File Name

RC-WinTrans can call a VBA macro ("Target File Name Macro") each time the name of the target file is requested.  For example, the target file name (and path) is requested each time RC-WinTrans creates a translated target file.

 

The VBA macro can be used to return the target file name and target path to be used (ignoring or modifying the defined rules).  This can be useful, for example, when the options for defining the rules in the Target File Names dialog box are insufficient.

 

 

VBA Function Code:

' *******************************************************************

' Method of function name: "GetTargetFileName"

'

' Description:

'  Called by RC-WinTrans if the name and the path of a target file

'  is requied by the system.

'

'  Calling the function can be enable or disabled in the

'  "Target Path Rules" dialog box of RC-WinTrans.

'

' Parameters:

' -----------

'   ProjFileName:  The name of the translation project file  (*.rwtproj".

'                  The project file name can be used to ask for the

'                  translation project object of type "TranslationProject".

'

'   SourceFileName: Full path plus file name of the source file.

'

'   XLIFFDataType:  File type of the source file.

'                   (samples: "ini", "javapropertyresourcebundle", "resx")

'      For the list of file types see the RC-WinTans help topic "File Types".

'

'   TargetLang:     Language code.

'                   (samples:  "de", "en-US" or "ja")

'

'   DefaultName:    The default target file name created by the current

'                   target file name rules.

'

'

'   Return value:   a) Return an empty string to use default target file name

'                      as provided with the parameter "DefaultName".

'

'                   b) Return a target file name to be used.

'

'

' *******************************************************************

Function GetTargetFileName(ProjFileName As String, _

                SourceFileName As String, _

                XLIFFDataType As String, _

                TargetLang As String, _

                DefaultName As String) As String

                

    ' return an empty string to use the default ("DefaultName")

    GetTargetFileName = ""

     

End Function

' *******************************************************************

'  End "GetTargetFileName"

' *******************************************************************

 

Related topics...