Skip to content

Commit

Permalink
autocommit
Browse files Browse the repository at this point in the history
  • Loading branch information
Vivtek committed Apr 13, 2014
1 parent 228786d commit 537d1b8
Show file tree
Hide file tree
Showing 6 changed files with 526 additions and 5 deletions.
Binary file added images/b.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/i.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions recent.html
Expand Up @@ -127,6 +127,9 @@
<td>2012-04-13</td><td><a href="/trados\trados_2007_languages.html">TRADOS 2007 and its language codes</a></td>
</tr>
<tr>
<td>2012-04-13</td><td><a href="/trados\trados_2007_languages_script.html">TRADOS 2007 language code script</a></td>
</tr>
<tr>
<td>2011-01-01</td><td><a href="/blog\blogging_hiatus.html">--blogging hiatus--</a></td>
</tr>
<tr>
Expand Down Expand Up @@ -186,9 +189,6 @@
<tr>
<td>2008-12-26</td><td><a href="/hikingpr\guanica_trek.html">The Great Guanica Accidental Off-Trail Trek of 2008</a></td>
</tr>
<tr>
<td>2008-12-26</td><td><a href="/hikingpr\guanica.html">Bosque Estatal de Guánica / Dry Forest </a></td>
</tr>
</table>

</div></td></td></table>
Expand Down
193 changes: 193 additions & 0 deletions trados/trados2007lang_pl.txt
@@ -0,0 +1,193 @@
use Win32::TieRegistry ( Delimiter=>"/", ArrayValues=>1 );
use Locale::Language;
use strict;
use warnings;

my %languages = (
'00' => 'DV',
'01' => 'CY',
'02' => 'Syriac',
'03' => 'Northern Sotho',
'04' => '--',
'05' => '--',
'06' => '--',
'07' => 'NE',
'08' => '--',
'09' => '--',
'0A' => '--',
'0B' => '--',
'0C' => 'QU',
'0D' => '--',
'0E' => '--',
'0F' => '--',
'10' => 'BN',
'11' => 'PA',
'12' => 'GU',
'13' => 'OR',
'14' => 'ST', # Southern Sotho
'15' => 'SE',
'16' => 'KA',
'17' => 'HI',
'18' => 'AS',
'19' => 'MR',
'1A' => 'SA',
'1B' => 'Konkani',
'1C' => 'TA',
'1D' => 'TE',
'1E' => 'KN',
'1F' => 'ML',
'40' => 'NB',
'41' => 'PL',
'42' => 'PT',
'43' => 'RM',
'44' => 'IT',
'45' => 'JA',
'46' => 'KO',
'47' => 'NL',
'48' => 'SQ',
'49' => 'SV',
'4A' => 'TH',
'4B' => 'TR',
'4C' => 'RO',
'4D' => 'RU',
'4E' => 'HR', # Also Serbian and Bosnian.
'4F' => 'SK',
'50' => 'ZH',
'51' => 'CS',
'52' => 'DA',
'53' => 'DE',
'54' => '--',
'55' => 'AR',
'56' => 'BG',
'57' => 'CA',
'58' => 'FR',
'59' => 'HE',
'5A' => 'HU',
'5B' => 'IS',
'5C' => 'EL',
'5D' => 'EN',
'5E' => 'ES',
'5F' => 'FI',
'60' => 'FO',
'61' => 'MT',
'62' => 'GA',
'63' => 'MS',
'64' => '--',
'65' => 'XH',
'66' => 'ZU',
'67' => 'AF',
'68' => 'UZ',
'69' => 'TT',
'6A' => 'MN',
'6B' => 'GL',
'6C' => 'KK',
'6D' => 'SW',
'6E' => 'TL',
'6F' => 'KY',
'70' => 'SL',
'71' => 'ET',
'72' => 'LV',
'73' => 'LT',
'74' => 'UR',
'75' => 'ID',
'76' => 'UK',
'77' => 'BE',
'78' => 'AZ',
'79' => 'EU',
'7A' => 'Sorbian',
'7B' => 'MK',
'7C' => 'MI',
'7D' => 'FA',
'7E' => 'VI',
'7F' => 'HY',
);


my $key_not_found = 0;
my $key = $Registry->{'HKEY_LOCAL_MACHINE/SOFTWARE/Wow6432Node/TRADOS/'} or $key_not_found = 1;
if ($key_not_found) {
$key_not_found = 0;
$key = $Registry->{'HKEY_LOCAL_MACHINE/SOFTWARE/TRADOS/'} or $key_not_found = 1;
}
if ($key_not_found) {
print "TRADOS 2007 does not appear to be installed on your machine (can't find Registry key)\n";
<STDIN>;
exit;
}

my $a = $key->{'Shared/IDNG//'} or $key_not_found = 1;

if ($key_not_found) {
print "TRADOS 2007 appears to be installed, but your Registry is configured in an unexpected way.\n";
<STDIN>;
exit;
}

my $idng = $a->[0];

DISPLAY:
if (not $idng =~ /{(.*-.*-.*-.*-00)(.*)}/) {
print "Unexpected IDNG value $idng encountered.\n";
<STDIN>;
exit;
}
my ($prefix, $meat) = ($1, $2);

print "IDNG: $idng\n\n";
my $slot = 0;
foreach my $language (unpack("(A2)*", $meat)) {
my $l = $languages{$language} || "-- ($language)";
my $ln = code2language($l);
$ln = "Croatian/Serbian/Bosnian" if $l eq 'HR';
$l .= " ($ln)" if $ln;
$slot++;
print "$slot: $l\n";
}
print "\n";
print "Enter new values or <Enter> to quit: ";

READ:
my $line = <STDIN>;
chomp $line;
exit unless $line;

my @values = split / /, $line;
if (@values > 5) {
print "Need 1 to 5 values or <Enter> to quit: ";
goto READ;
}

my $problem = 0;
foreach my $s (0, 1, 2, 3, 4) {

if ($s + 1 > @values or $values[$s] eq '--') {
$values[$s] = '84'; # Standard not-used
next;
}
if ($values[$s] =~ /^[0-9][0-9A-F]$/) {
$values[$s] =~ tr/a-z/A-Z/;
next;
}
my $ln = language2code ($values[$s]);
$values[$s] = $ln if $ln;
$values[$s] =~ tr/a-z/A-Z/;
$values[$s] = 'HR' if $values[$s] eq 'SR' or $values[$s] eq 'BS';
foreach my $n (keys %languages) {
if (lc($languages{$n}) eq lc($values[$s])) {
$values[$s] = $n;
goto NEXTNEXT;
}
}
$problem = 1;
print sprintf("Don't understand value %s in slot %s\n", $values[$s], $s + 1);
NEXTNEXT:
}

if ($problem) {
print "Need 1 to 5 values or <Enter> to quit: ";
goto READ;
}

$idng = sprintf ("{$prefix%s}", join ('', @values));
$key->{'Shared/IDNG//'} = [$idng, 1];
goto DISPLAY;
11 changes: 9 additions & 2 deletions trados/trados_2007_languages.html
Expand Up @@ -219,7 +219,10 @@
you can immediately restart TRADOS Workbench to use the new settings. You can leave the utility running
if you want to make other changes later.
</p><p>
The individual parts of the script are basically the following:
Thanks to the inclusion of the language code table, the script is a couple
hundred lines long and therefore ungainly to include on this page,
so I've put it <a href="trados_2007_languages_script.html">over here</a> for your reading pleasure.
The individual parts of the script basically break down as follows:
<table>
<tr><td valign="top" class="linenum"><tt>006-013:</tt></td><td>This is the table of language values expressed as a hash.</td></tr>
<tr><td valign="top" class="linenum"><tt>106-124:</tt></td><td>Here, we find the Registry key and diagnose a few possible problems
Expand All @@ -232,9 +235,13 @@
<tr><td valign="top" class="linenum"><tt>191-192:</tt></td><td>Here, we build the new key and write it, then repeat the process.</td></tr>
</table>
</p><p>
I'll probably be improving this presentation style; I'm trying to learn how to write effectively
about code, but there isn't much source material out there to emulate. If you know of any,
please feel free to get in touch.
</p><p>
<div class="title">Going forward</div>
</p><p>
Going forward, I'd obviously first like to pull all the language code functionality out into a nice
Soon, I'd obviously first like to pull all the language code functionality out into a nice
module, then rewrite the script to use the module. And since modules can install scripts that act as
system commands, you won't even need the script - just type something like "ttxl" and this utility would
pop up.
Expand Down

0 comments on commit 537d1b8

Please sign in to comment.