I have a couple of fealty (linux) scripts to ease the pain of keeping language files updated:
To extract tags from a component:
#!/bin/bash
find .../TEMP/com_mycomponent -name "*.php" | xargs grep -o 'COM_MYCOMPONENT_[A-Z0-9\_]\+' | cut -d':' -f2 | sort -u > tags
find .../TEMP/com_mycomponent -name "*.xml" | xargs grep -o 'COM_MYCOMPONENT_[A-Z0-9\_]\+' | cut -d':' -f2 | sort -u >> tags
To check for duplicates, missing tags or content differences:
// Duplicated check
$ini_file = file_get_contents("es-ES.com_mycomponent.ini");
$ini_lines = explode("\n", $ini_file);
$duplicated = array();
foreach ($ini_lines as $line)
{
$parts = explode('=', $line);
if (count($parts) != 2)
{
continue;
}
$k = $parts[0];
$v = $parts[1];
if (array_key_exists($k, $duplicated))
{
echo 'DUPLICATED: ' . $k . '=' . $duplicated[$k] . "\n";
echo 'DUPLICATED: ' . $k . '=' . $v . "\n";
}
else
{
$duplicated[$k] = $v;
}
}
// Parse without sections
$ini_array1 = parse_ini_file("en-GB.com_mycomponent.ini");
$ini_array2 = parse_ini_file("es-ES.com_mycomponent.ini");
$ini_array1k = array_keys($ini_array1);
$ini_array2k = array_keys($ini_array2);
$results = array_diff($ini_array1k, $ini_array2k);
foreach ($results as $result)
{
echo $result . "=\"" . $ini_array1[$result] . "\"\n";
}
if (count($results) == 0)
{
foreach ($ini_array1k as $key)
{
$cpo1 = substr_count($ini_array1[$key], '%');
$cpo2 = substr_count($ini_array2[$key], '%');
$cpe1 = substr_count($ini_array1[$key], '$');
$cpe2 = substr_count($ini_array2[$key], '$');
$cpbo1 = substr_count($ini_array1[$key], '{');
$cpbo2 = substr_count($ini_array2[$key], '{');
$cpbc1 = substr_count($ini_array1[$key], '}');
$cpbc2 = substr_count($ini_array2[$key], '}');
$cpme1 = substr_count($ini_array1[$key], '<');
$cpme2 = substr_count($ini_array2[$key], '<');
$cpma1 = substr_count($ini_array1[$key], '>');
$cpma2 = substr_count($ini_array2[$key], '>');
$cpqqq1 = substr_count($ini_array1[$key], 'QQQ');
$cpqqq2 = substr_count($ini_array2[$key], 'QQQ');
if (($cpo1 != $cpo2) || ($cpe1 != $cpe2) || ($cpbo1 != $cpbo2) || ($cpbc1 != $cpbc2) || ($cpma1 != $cpma2) || ($cpme1 != $cpme2) || ($cpqqq1 != $cpqqq2))
{
echo 'ERROR: ' . $key . "=\"" . $ini_array1[$key] . "\"\n";
echo 'ERROR: ' . $key . "=\"" . $ini_array2[$key] . "\"\n\n";
}
}
}