Requirements
- Ruby 1.8.7 (minimum)
- Ruby 1.9.x preferred, is faster, better unicode handling
- On Windows, only 1.8.7 works due to weird issues with REXML parsing


================
xlifflevel.rb
================

Converts an xliff into a leveled, simplified and reduced xliff
 - all file elements are put into a single big file element
 - duplicates are removed
 - a separate file with backreferences to the original file is written
 - Note: all files/strings must be in the same language

ruby xlifflevel.rb in.xliff flat.xliff [backref.db]

================
xliffdiff.rb
================

Diffs two xliff files

ruby xliffdiff.rb old.xliff new.xliff [prefix]

Prints difference in source strings, translations, etc.
If [prefix] is set, will output these files, if added/removed/delta strins were found:
    <prefix>-common.xliff
    <prefix>-removed.xliff
    <prefix>-added.xliff
    <prefix>-translation-delta.xliff
    <prefix>-translation-common.xliff

================
findstrings.rb
================

Finds a batch of strings from an xliff in a "backref" file created by the xlifflevel tool.

================
backref.rb
================

If you want to go through all source strings to check their spelling/english/
whatever, this tool comes handy. Run it on any xliff file, but typically the
diff, and together with the backreferences created from the xliff leveling
it will create a csv file to be imported in Excel/Google spreadsheet etc.

ruby backref.rb diff.xliff backref.db strings.csv

CSV will have these columns: String / Comment / Improved String / Question / Answer / Files

================
filelist.rb
================

Creates a CSV file with links to the files in the svn from an xliff extract.

CSV will have these columns: String / Comment / Files / Locations

================
xliffmerge.rb
================

Merges multiple xliff files into one (single file only).

================
xliffvalidate.rb
================

Analyzes a set of xliff files and looks for conflicting translations, etc.

================
xliffcount.rb
================

Statistics about one xliff file.

================
xliffid.rb
================

Allows to change the IDs used for trans-units in the xliff file.

================
xliff2vlt.rb
================

Converts an xliff file into a vault xml file with sling:message structure.

================
vlt2xliff.rb
================

Converts a vault xml file with sling:message structure into an xliff file.

================
extlang2xliff.rb
================

To make the conversion of ExtJs ext-lang-*.js files into the XLIFF format simpler,
this tool provides help by mixing automatic extraction + manual selection.

Steps to run it (eg. for language "de" = "DE-DE")

1) You need the following files:
- original ext-lang file ext-lang-cq.js (with the CQ.I18n.getMessage() calls)
- the ext-lang file with the translations, eg. ext-lang-de.js
- an XLIFF file that was created from ext-lang-cq.js using the xgettext tool
  + was formatted with xml/html tidy
  + has the <target> elements already inside
  + should have the target language already set to the new one, eg. "DE-DE" (could also be done later)
  
  => example trans-unit XLIFF snippet:
  
            <trans-unit id="1">
                <source><![CDATA[Loading...]]></source>
                <target xml:lang="DE-DE"><![CDATA[Lade Daten...]]></target>
                <context-group name="linenumber">
                    <context context-type="linenumber">26</context>
                </context-group>
            </trans-unit>

The tool will simply replace the CDATA part of the <target> elements  

The XLIFF file won't be overridden, but a new one will be created,
using the last filename given on the command line.

2) Call:

ruby extlang2xliff.rb "ext-lang-cq.js" "ext-lang-de.js" "ext-2.1-DE.xliff" "out.xliff"

The tool has the following options for each source found in the xliff file:

    ENTER = accept translation
    KEY UP/DOWN = choose another translation from ext-lang file
    e = enter custom translation
    s = skip translation (put empty string in xliff)


3) Afterwards verify the "out.xliff" and then copy it over the "ext-2.1-DE.xliff"


For example (for "zh-cn"):

ruby extlang2xliff.rb /kode/cq5-branch-5.1/wcm/content/src/main/content/jcr_root/libs/widgets/cq-widgets.js/files/ext/override/locale/ext-lang-cq.js /kode/cq5-branch-5.1/wcm/content/src/main/content/jcr_root/libs/widgets/cq-widgets.js/files/ext/source/locale/ext-lang-zh_CN.js ../../xliff/extjs-2.1/dummy.xliff out.xliff