diff --git a/images/b.png b/images/b.png new file mode 100644 index 0000000..891affd Binary files /dev/null and b/images/b.png differ diff --git a/images/i.png b/images/i.png new file mode 100644 index 0000000..78c4418 Binary files /dev/null and b/images/i.png differ diff --git a/recent.html b/recent.html index 975c62f..243d003 100644 --- a/recent.html +++ b/recent.html @@ -127,6 +127,9 @@ 2012-04-13TRADOS 2007 and its language codes +2012-04-13TRADOS 2007 language code script + + 2011-01-01--blogging hiatus-- @@ -186,9 +189,6 @@ 2008-12-26The Great Guanica Accidental Off-Trail Trek of 2008 - -2008-12-26Bosque Estatal de Guánica / Dry Forest - diff --git a/trados/trados2007lang_pl.txt b/trados/trados2007lang_pl.txt new file mode 100644 index 0000000..735133a --- /dev/null +++ b/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"; + ; + 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"; + ; + exit; +} + +my $idng = $a->[0]; + +DISPLAY: +if (not $idng =~ /{(.*-.*-.*-.*-00)(.*)}/) { + print "Unexpected IDNG value $idng encountered.\n"; + ; + 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 to quit: "; + +READ: +my $line = ; +chomp $line; +exit unless $line; + +my @values = split / /, $line; +if (@values > 5) { + print "Need 1 to 5 values or 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 to quit: "; + goto READ; +} + +$idng = sprintf ("{$prefix%s}", join ('', @values)); +$key->{'Shared/IDNG//'} = [$idng, 1]; +goto DISPLAY; diff --git a/trados/trados_2007_languages.html b/trados/trados_2007_languages.html index 78eda1d..c838f70 100644 --- a/trados/trados_2007_languages.html +++ b/trados/trados_2007_languages.html @@ -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.

-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 over here for your reading pleasure. +The individual parts of the script basically break down as follows:
006-013:This is the table of language values expressed as a hash.
106-124:Here, we find the Registry key and diagnose a few possible problems @@ -232,9 +235,13 @@
191-192:Here, we build the new key and write it, then repeat the process.

+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. +

Going forward

-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. diff --git a/trados/trados_2007_languages_script.html b/trados/trados_2007_languages_script.html new file mode 100644 index 0000000..68a453b --- /dev/null +++ b/trados/trados_2007_languages_script.html @@ -0,0 +1,321 @@ + + +TRADOS 2007 language code script + + + + + + +
+
+ +
TRADOS 2007 language code script
+Here's the full code for the initial prototype script. This is still a +pretty rudimentary presentation - my ultimate goal here is to learn to +write about software, so I'm experimenting a little with the format. +

+This is also available in a plain-text format for download. +

+To use this script, follow the instructions +or wait for the next version, which will be easier to install. +

+

>001 use Win32::TieRegistry ( Delimiter=>"/", ArrayValues=>1 );
+002 use Locale::Language;
+003 use strict;
+004 use warnings;
+005 
+006 my %languages = (
+007   '00' => 'DV',
+008   '01' => 'CY',
+009   '02' => 'Syriac',
+010   '03' => 'Northern Sotho',
+011   '04' => '--',
+012   '05' => '--',
+013   '06' => '--',
+014   '07' => 'NE',
+015   '08' => '--',
+016   '09' => '--',
+017   '0A' => '--',
+018   '0B' => '--',
+019   '0C' => 'QU',
+020   '0D' => '--',
+021   '0E' => '--',
+022   '0F' => '--',
+023   '10' => 'BN',
+024   '11' => 'PA',
+025   '12' => 'GU',
+026   '13' => 'OR',
+027   '14' => 'ST', # Southern Sotho
+028   '15' => 'SE',
+029   '16' => 'KA',
+030   '17' => 'HI',
+031   '18' => 'AS',
+032   '19' => 'MR',
+033   '1A' => 'SA',
+034   '1B' => 'Konkani',
+035   '1C' => 'TA',
+036   '1D' => 'TE',
+037   '1E' => 'KN',
+038   '1F' => 'ML',
+039   '40' => 'NB',
+040   '41' => 'PL',
+041   '42' => 'PT',
+042   '43' => 'RM',
+043   '44' => 'IT',
+044   '45' => 'JA',
+045   '46' => 'KO',
+046   '47' => 'NL',
+047   '48' => 'SQ',
+048   '49' => 'SV',
+049   '4A' => 'TH',
+050   '4B' => 'TR',
+051   '4C' => 'RO',
+052   '4D' => 'RU',
+053   '4E' => 'HR',  # Also Serbian and Bosnian.
+054   '4F' => 'SK',
+055   '50' => 'ZH',
+056   '51' => 'CS',
+057   '52' => 'DA',
+058   '53' => 'DE',
+059   '54' => '--',
+060   '55' => 'AR',
+061   '56' => 'BG',
+062   '57' => 'CA',
+063   '58' => 'FR',
+064   '59' => 'HE',
+065   '5A' => 'HU',
+066   '5B' => 'IS',
+067   '5C' => 'EL',
+068   '5D' => 'EN',
+069   '5E' => 'ES',
+070   '5F' => 'FI',
+071   '60' => 'FO',
+072   '61' => 'MT',
+073   '62' => 'GA',
+074   '63' => 'MS',
+075   '64' => '--',
+076   '65' => 'XH',
+077   '66' => 'ZU',
+078   '67' => 'AF',
+079   '68' => 'UZ',
+080   '69' => 'TT',
+081   '6A' => 'MN',
+082   '6B' => 'GL',
+083   '6C' => 'KK',
+084   '6D' => 'SW',
+085   '6E' => 'TL',
+086   '6F' => 'KY',
+087   '70' => 'SL',
+088   '71' => 'ET',
+089   '72' => 'LV',
+090   '73' => 'LT',
+091   '74' => 'UR',
+092   '75' => 'ID',
+093   '76' => 'UK',
+094   '77' => 'BE',
+095   '78' => 'AZ',
+096   '79' => 'EU',
+097   '7A' => 'Sorbian',
+098   '7B' => 'MK',
+099   '7C' => 'MI',
+100   '7D' => 'FA',
+101   '7E' => 'VI',
+102   '7F' => 'HY',
+103 );
+104   
+105   
+106 my $key_not_found = 0;
+107 my $key = $Registry->{'HKEY_LOCAL_MACHINE/SOFTWARE/Wow6432Node/TRADOS/'} or $key_not_found = 1;
+108 if ($key_not_found) {
+109     $key_not_found = 0;
+110     $key = $Registry->{'HKEY_LOCAL_MACHINE/SOFTWARE/TRADOS/'} or $key_not_found = 1;
+111 }
+112 if ($key_not_found) {
+113     print "TRADOS 2007 does not appear to be installed on your machine (can't find Registry key)\n";
+114     <STDIN>;
+115     exit;
+116 }
+117 
+118 my $a = $key->{'Shared/IDNG//'} or $key_not_found = 1;
+119 
+120 if ($key_not_found) {
+121     print "TRADOS 2007 appears to be installed, but your Registry is configured in an unexpected way.\n";
+122     <STDIN>;
+123     exit;
+124 }
+125 
+126 my $idng = $a->[0];
+127 
+128 DISPLAY:
+129 if (not $idng =~ /{(.*-.*-.*-.*-00)(.*)}/) {
+130     print "Unexpected IDNG value $idng encountered.\n";
+131     <STDIN>;
+132     exit;
+133 }
+134 my ($prefix, $meat) = ($1, $2);
+135 
+136 print "IDNG: $idng\n\n";
+137 my $slot = 0;
+138 foreach my $language (unpack("(A2)*", $meat)) {
+139     my $l = $languages{$language} || "-- ($language)";
+140     my $ln = code2language($l);
+141     $ln = "Croatian/Serbian/Bosnian" if $l eq 'HR';
+142     $l .= " ($ln)" if $ln;
+143     $slot++;
+144     print "$slot: $l\n";
+145 }
+146 print "\n";
+147 print "Enter new values or <Enter> to quit: ";
+148 
+149 READ:
+150 my $line = <STDIN>;
+151 chomp $line;
+152 exit unless $line;
+153 
+154 my @values = split / /, $line;
+155 if (@values > 5) {
+156     print "Need 1 to 5 values or <Enter> to quit: ";
+157     goto READ;
+158 }
+159 
+160 my $problem = 0;
+161 foreach my $s (0, 1, 2, 3, 4) {
+162     
+163     if ($s + 1 > @values or $values[$s] eq '--') {
+164         $values[$s] = '84';  # Standard not-used
+165         next;
+166     }
+167     if ($values[$s] =~ /^[0-9][0-9A-F]$/) {
+168         $values[$s] =~ tr/a-z/A-Z/;
+169         next;
+170     }
+171     my $ln = language2code ($values[$s]);
+172     $values[$s] = $ln if $ln;
+173     $values[$s] =~ tr/a-z/A-Z/;
+174     $values[$s] = 'HR' if $values[$s] eq 'SR' or $values[$s] eq 'BS';
+175     foreach my $n (keys %languages) {
+176         if (lc($languages{$n}) eq lc($values[$s])) {
+177             $values[$s] = $n;
+178             goto NEXTNEXT;
+179         }
+180     }
+181     $problem = 1;
+182     print sprintf("Don't understand value  in slot \n", $values[$s], $s + 1);
+183     NEXTNEXT:
+184 }
+185 
+186 if ($problem) {
+187     print "Need 1 to 5 values or <Enter> to quit: ";
+188     goto READ;
+189 }
+190 
+191 $idng = sprintf ("{$prefix}", join ('', @values));
+192 $key->{'Shared/IDNG//'} = [$idng, 1];
+193 goto DISPLAY;
+
+ +
+ +



+


+ Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.
+
+ + + +