LangDiff
========
Working, but it's an alpha version!


How to update a language file
=============================
1. Determine the version of your old language file (e.g. 7.6)
   - lang files are only changed when first or second version number changes
     (e.g. 7.6 -> 7.7, not 7.6 -> 7.6.1
2. Check whether there is a patch to upgrade your version to current version
   (e.g. eng_7.6_to_7.7.ldiff)
   - If there is no patch available, read 'Create diff file' section.
3. If you have the correct patch, read 'Apply diff file' section and apply 
   the patch.
4. Translate the changed items in the language file (do a search for 'LangDiffUpdate')
   - Remove all properties LangDiffUpdate=Yes from the translated file.   


LangDiff is a tool to make updating language files easier. It has 2 modes:
- Create diff file
- Apply diff file

There are multiple types of changes in the patch file:
- Addition: The element exists in the new version but not in the old version. In this
  case it will be simply added to the language file you are updating. 
- Modification: The element exists in both versions but the properties are different.
  In this case the element properties are deleted from the file you are updating 
  and the correct properties are then inserted.
- Deletion: The element exist only in the old version. It will be simply deleted
  from the file you are updating. 
  
Note:
  Usual duration of creating / applying patch is 1~5 seconds on 2.6 GHz P4 processor. 
  This program is not tested much yet and there may be lockups. Wait for some reasonable
  time before considering the program locked-up.

Note 2:
  SP version 7.7 is the last version that includes the old style change log. Newer
  versions will only include LangDiff patches.  

Apply diff file
===============
You will use this mode when you want to update a language file (e.g. Polish.lng)
to a new version using a patch file available from SP author. Using this mode,
your language file will be updated to the newest version (items will be added, removed
or changed according to the patch file). The added items will be in the same
language as the patch is. 

The patch encoding is the same as the encoding of the language files from which it was 
generated. The encoding field in the patch is not considered.

After the patch is applied, new language file is generated and you can translate
all the added items. These items are marked by LangDiffUpdate property.

For example there will be item 
  <btnAdd LangDiffUpdate="yes" Caption="Add" Hint="Add files" />
You should translate all the properties other than LangDiffUpdate. This property MUST
BE deleted. The resulting line should be like this:
  <btnAdd Caption="translated Add" Hint="translated Add files" />

Doing a quick Ctrl+F you can translate all the changes in substantially less time than 
with the old approach

The order of applying items is:
  1. Deletions
  2. Modifications
  3. Additions


Create diff file
================
This mode is not intended to be used by language file authors, but you may use it 
in these cases
 - You are updating a very old file for which a patch is not available. In this case
   find the English.lng with the same version as your language file and create 
   patch against the current English.lng
 - You want to create a patch in different language. E.g. patches are only available
   in English and you want to create patches in Czech for authors translating from Czech.
   In this case make a patch from appropriate version of Czech.lng against the current 
   Czech.lng. language authors can then use these patches instead. NOTE: It's not a good
   idea to create patches from any non-default language (English and Czech), because
   errors (misinterpretations) may be introduced with increased length of the translation 
   chain.

In this mode a special xml file is created. This is the ldiff file that contains list of
additions, modifications an deletions that should be applied to an old language file.

LDiff file can be generated for any two language files to make a patch for upgrading by 
more than one version.

When generating LDiff file, all elements in the Up-to-date file are checked whether there
is a matching element in the Old version file. If there is a matching element, it's 
properties are checked whether they match. 
 - If the properties match, no item is added to the patch
 - If they don't match, Modification is added
 - If matching element does not exist, Addition is generated.
The Old version file is then checked and all unprocessed elements are added to the
patch as Deletions  

