• Show convenient version of this site
  • Deutsch
  • English
Contact
Newsletter
  • Products
    • ALS
      • Across Language Server
        • Translation Management
        • Terminology Management
        • Translation Memory
      • Editions
      • Interfaces
    • ATE
      • Across Translator Edition
      • Editions
      • Download
      • Across Account
    • Elanion
      • Overview
      • Login
  • Solutions
    • Customers
      • Enterprises
      • Language Service Providers
      • Translators
    • Industries
      • E-Commerce & Trade
      • Pharmaceuticals & medicine
      • IT & Software
    • Departments
      • Marketing & E-Commerce
      • Technical Documentation
      • Software User Interfaces
  • Services
    • Hosting
    • Training
    • Consulting
  • Partners
    • Language Service Providers
    • Universities
  • Company
    • Across Systems
    • News
    • Events
    • Career
    • Contact
  • Knowledge
    • Blog
    • Video Library
    • Case Studies
    • White Papers
    • Fact Sheets
    • File Formats
    • Expert Features
  • Support
    • New Functions
    • Online Help
    • FAQ
    • Support Request
    • Updates
Schedule Consultation
  • Online-Help
  • SDK
  • General Information
  • crossTransform
  • crossTransform - examples
  • General Information
    • Connectors
    • LCIDs
    • GUIDs
    • Paragraph states and flags
    • crossTerm Web
    • crossTransform
      • crossTransform - examples
  • Connecting Third-party Systems
    • crossConnect for content systems
      • Requirements
      • Configuration
        • Configuring the connector
        • Job configuration
        • Testing crossConnect
      • Troubleshooting
    • crossConnect for External Editing
      • Purpose and usage
        • Use case - Machine translation
        • Use Case - Review and QA
        • Use case - Machine review
      • Requirements
      • Implementation
        • Across XLIFF format
          • Across-specific Extensions
          • <xliff> Element Attributes
          • <file> Element Extensions
          • <trans-unit> Element Extension
          • Paragraph States
          • Paragraph State Flags
          • <source> and <target> Element Content
          • <bpt> Element Attributes
          • <ph> Element Attributes
          • <x> Element Attributes
          • Across-specific Properties
          • Analysis Results
          • Sample Files
          • Across XLIFF - import, export and segmentation
          • Context information
          • Exporting best matches in Across XLIFF
          • Hyperlinks to XLIFF
        • Secure file handling with C#
        • Secure file handling with JAVA
        • Workflow and vendor configuration
          • Adding workflows to crossAutomate Host Manager
          • Adjusting preset watchfolders
          • The filter rules
          • External editing workflows
        • Sample code - Integrated solution
    • Generic File Connector
      • Process Overview
      • Exchange Folder Structure
      • Package Format
        • Control File
  • Display Texts
    • Solution approaches
    • The Across solution in detail
    • Requirements
    • Integration
    • The display text format
      • Line height vs. line spacing
      • DT-XML format structure
        • DT-XML - Main elements
        • Children of paragraphStyles and characterStyles
        • Children of the sizeInfos element
        • Children of the paragraph element
        • DT-XML v5 example
        • DT-XML v4 example
    • The display text package
      • Creating a display text package
  • APIs
    • APIs - Technology
    • crossTank API v1
      • Requirements
      • Testing the crossTank API installation
      • OData-URLs in Chrome
      • Example
    • crossTank API v2
      • Requirements
      • QuickStart
        • Searching for Translations
        • Creating Translations
      • crossTank API v2 Overview
        • Finding Translations
        • Creating Translations
        • Translation Properties
        • Formatting and Auto-Adjustment of Formatting and Numbers
      • C# Example
    • crossTerm API v1
      • Scenarios of use
        • Example - usage information
        • Example - finding terms
      • Requirements
      • Special Controllers
      • OData-URLs in Chrome
      • crossTerm API with C#
      • crossTerm API with Java
      • crossTerm API with JavaScript
    • crossTerm API v2
      • Requirements
      • QuickStart
        • Authentication Basics
        • First Request Examples
      • crossTerm API v2 Example in C#
        • Used Functions
      • crossTank API, crossTerm API v2 - Authentication
      • crossTerm API v2 - Examples of Use
        • Finding Terms of Entry
        • Searching Terminology via API
    • crossAPI SI
      • Requirements
      • Function Return Types
      • crossAPI SI and Java
        • Example: hot integration
        • Executing the hot integration example
      • List of Objects in crossAPI SI
        • AssignManager
        • Authorization
        • CheckInManager
        • CheckOutManager
        • CrossTankManager
        • CrossTermManager
        • DocumentManager
        • FileManager
        • LanguageJobManager
        • LanguageManager
        • LicenseManager
        • Message
        • ObjectManager - Overview
          • Part 1
          • Part 2
          • Part 3
        • ReportManager
          • ID values for analysis and analysis-result
        • ProjectManager - Overview
          • Part 1
          • Part 2
          • Attribute Information
        • SqlQuery
        • SystemManager
        • TaskManager
        • WanGridManager - Overview
          • Part 1
          • Part 2
      • Sample - transferring checkout files via FileManager
      • Sample - VBS
    • Text Preprocessing API
      • Introduction
      • How to browse the API
      • Sentence splitting
      • Abbreviations

crossTransform - examples

Support for own format

This example shows all steps necessary to create your own crossTransform plugin.

We will create the plugin-xml file, define our own file format and write a little tool that converts from our format to xml.

All files are also available here:
Support for own format

The file format

  • For our example, we choose a simple format: It is an XML format with 4 different tags:
  • The root tag named tst and its child tags:
    • n
    • i
    • l

A file in this format could look like this:

<?xmlversion="1.0"encoding="UTF-8"standalone="no"?><tst><n>normal text</n><n>normal text with <i>inline text</i>.</n>&lt;l>locked text&lt;/l>
  </tst>

Across could surely read this file without crossTransform, but this format has been chosen, because it is easy to process in our little tool. So for this example, we assume, Across couldn't read this file format. To read it, Across needs "normal" instead of "n", "inline" instead of "i", and "locked" instead of "l".

The plugin xml

This file needs to be placed under %ProgramFiles%\across\across\plugin. According to the description of the format, the file looks like this:

<?xmlversion="1.0"encoding="UTF-8"?><plugintype="crossTransform plugin"name="tst crossTransform PlugIn"><docassoending=".tst"formatGUID="{61af5078-5509-4d3e-8739-a46961175402}"description="tst document"template="TST"extGUID="{075C51D9-EEEA-4583-8333-C76B44C27FFF}"/><preprocessingcommand="across SDK\Samples\crossTransform\Support for own format\TST2XML.bat"/><postprocessingcommand="across SDK\Samples\crossTransform\Support for own format\XML2TST.bat"/></plugin>

The Document Template

In the plugin file. a document template is specified, which should be used for this type of document.

  • It is named TST and is very simple:
  • normal is defined as Element - Normal
  • inline is defined as Element - Inline
  • locked is defined as Element - Locked

The tool

This tool is written in C# and is pretty straightforward. First, it determines whether it has been called during pre-processing or during post-processing. To do this, we just have to check the number of supplied parameters. If we have 2 parameters, we are in pre-processing, if we have 3, we are in post-processing.

When in pre-processing, the tool loads the file, replaces all "n" tags with "normal" tags, all "i" tags with "inline" tags and all "l" tags with "locked" tags. When in post-processing, the tools does this vice-versa.

Let's see the code:

staticvoid Main(string[] args){//We need at least 2 arguments!if(args.Length <2)return;// if first argument is /x we are in postprocessing:if(args[0]=="/x"){
      XmlDocument doc =new XmlDocument();
      doc.Load(args[1]);
      XmlNode root = doc.DocumentElement;
      postProcess(ref doc,ref root);
      doc.Save(args[1]);}else{
      XmlDocument doc =new XmlDocument();
      doc.Load(args[0]);
      XmlNode root = doc.DocumentElement;
      preProcess(ref doc,ref root);
      doc.Save(args[1]);}}privatestaticvoid preProcess(ref XmlDocument doc,ref XmlNode xmlElement){for(int i =0; i < xmlElement.ChildNodes.Count; i++){
      XmlNode node = xmlElement.ChildNodes[i];
      XmlNode newNode =null;if(node.Name =="n")
        newNode = doc.CreateElement("normal");elseif(node.Name =="i")
        newNode = doc.CreateElement("inline");elseif(node.Name =="l")
        newNode = doc.CreateElement("locked");elsecontinue;
      newNode.InnerXml = node.InnerXml;
      xmlElement.ReplaceChild(newNode, node);//we need to call it recursivly, to also//preprocess the child tags of the current tag
      preProcess(ref doc,ref newNode);}}privatestaticvoid postProcess(ref XmlDocument doc,ref XmlNode xmlElement){for(int i =0; i < xmlElement.ChildNodes.Count; i++){
     XmlNode node = xmlElement.ChildNodes[i];
     XmlNode newNode =null;if(node.Name =="normal") 
       newNode = doc.CreateElement("n");elseif(node.Name =="inline")
        newNode = doc.CreateElement("i");elseif(node.Name =="locked")
        newNode = doc.CreateElement("l");elsecontinue;
      newNode.InnerXml = node.InnerXml;
      xmlElement.ReplaceChild(newNode, node);//we need to call it recursivly, to also,//postprocess the child tags of the current tag
     postProcess(ref doc,ref newNode);}}

Purge RC

The example Purge RC shows you how to carry out automatic post-processing via crossTransform without pre-processing. During the check-out, useless resources are deleted and country-related replacements are carried out.

You can find all necessary material for this example here:
Purge RC

Carry out the following steps to follow the example:

  1. Enabling crossTransform
  2. Copy the file PurgeRC.xml into the Across plugin folder at %ProgramFiles%\across\across\plugin.
  3. Restart Across.
  1. Checking the RC file
  2. Start the Across Client.
  3. Start the Project Wizard.
  4. Add the file MyResource.rc to the project as Resource Script File (with Purge RC).
  5. Set the target languages to German, Spanish, and Portuguese.
  6. As an option, you can carry out translations if you wish.
  1. Checking out
  2. Start the Check-Out Wizard.
  3. Check out source and/or target files.
  4. After the check-out has taken place, the batch file purgeRC.bat is automatically called. It starts the tool purgeRC.exe, which removes all ICON resources from the RC file. After that, the tool ssr.exe is used to replace an image file for each specific country.
  5. Now compare the original file with the resulting file.
Register for our Newsletter now

Our newsletter provides you with exclusive news about the Across Language Server, often even before the official announcement. The newsletter also provides you with early information on events, webinars, and training sessions.

  • Legal Notice
  • GTC
  • Privacy Statement
  • Cookies
  • info@across.net