1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html401/loose.dtd">
<html>
<!-- Created on September, 3 2008 by texi2html 1.78 -->
<!--
Written by: Lionel Cons <Lionel.Cons@cern.ch> (original author)
Karl Berry <karl@freefriends.org>
Olaf Bachmann <obachman@mathematik.uni-kl.de>
and many others.
Maintained by: Many creative people.
Send bugs and suggestions to <texi2html-bug@nongnu.org>
-->
<head>
<title>BERKELEY LOGO 6.0: 12. Internationalization</title>
<meta name="description" content="BERKELEY LOGO 6.0: 12. Internationalization">
<meta name="keywords" content="BERKELEY LOGO 6.0: 12. Internationalization">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="texi2html 1.78">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style type="text/css">
<!--
a.summary-letter {text-decoration: none}
pre.display {font-family: serif}
pre.format {font-family: serif}
pre.menu-comment {font-family: serif}
pre.menu-preformatted {font-family: serif}
pre.smalldisplay {font-family: serif; font-size: smaller}
pre.smallexample {font-size: smaller}
pre.smallformat {font-family: serif; font-size: smaller}
pre.smalllisp {font-size: smaller}
span.roman {font-family:serif; font-weight:normal;}
span.sansserif {font-family:sans-serif; font-weight:normal;}
ul.toc {list-style: none}
-->
</style>
</head>
<body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
<a name="INTERNATIONALIZATION"></a>
<a name="SEC390"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="usermanual_11.html#SEC389" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="usermanual_13.html#SEC391" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="usermanual_11.html#SEC373" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="usermanual.html#Top" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="usermanual_13.html#SEC391" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="usermanual.html#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="usermanual_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="usermanual_13.html#SEC391" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="usermanual_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<h1 class="chapter"> 12. Internationalization </h1>
<p>Berkeley Logo has limited support for non-English-speaking users.
Alas, there is no Unicode support, and high-bit-on ASCII codes work in
some contexts but not others.
</p>
<p>If you want to translate Berkeley Logo for use with another language,
there are three main things you have to do:
</p>
<table><tr><td> </td><td><pre class="example">1. Primitive names
2. Error (and other) messages
3. Documentation
</pre></td></tr></table>
<p>For primitive names, the easiest thing is to provide a startup file that
defines aliases for the English primitive names, using <code>COPYDEF</code>:
</p>
<table><tr><td> </td><td><pre class="example">COPYDEF "AVANT "FORWARD
</pre></td></tr></table>
<p>This should take care of it, unless your language's name for one primitive
is spelled like the English name of a different primitive. In that case
you have to turn <code>REDEFP</code> on and be sure to copy the non-conflicting name
before overwriting the conflicting one!
</p>
<p>"Primitives" that are actually in the Logo library, of course, can just
be replaced or augmented with native-language-named Logo procedures and
filenames.
</p>
<p>Of course Logo programs will still not look like your native language if
the word order is dramatically different, especially if you don't put
verbs before their objects.
</p>
<p>For error messages, there is a file named ‘<tt>Messages</tt>’ in the
‘<tt>logolib</tt>’ directory with texts of messages, one per line. You can
replace this with a file for your own language. Do not add, delete, or
reorder lines; Logo finds messages by line number. The sequences <code>%p</code>,
<code>%s</code>, and <code>%t</code> in these messages represent variable parts of the
message and should not be translated. (%p <code>PRINT</code>s the variable part,
while %s <code>SHOW</code>s it – that is, the difference is about whether or not
brackets are shown surrounding a list. %t means that the variable part is a C
text string rather than a Logo object.) If you want to change the order of
two variable parts (no reorderable message has more than two), you would for
example replace the line
</p>
<table><tr><td> </td><td><pre class="example">%p doesn't like %s as input
</pre></td></tr></table>
<p>with
</p>
<table><tr><td> </td><td><pre class="example">%+s is a lousy input to %p
</pre></td></tr></table>
<p>The plus sign tells the message printer to reverse the order; you must
reverse the order of %p and %s, if both are used, to match. The plus
sign goes just after the first percent sign in the message, which might
not be at the beginning of the line. The sequence <code>\n</code> in a message
represents a newline; don't be fooled into thinking that the <code>n</code> is part
of the following word.
</p>
<p>Some messages appear twice in the file; this isn't a mistake. The two spaces
before <code>to</code> in <code>I don't know how\ \ to</code> aren't a mistake either.
The message containing just <code>%p</code> is for user-provided error messages in
<code>THROW "ERROR</code>. The message "<code>\ \ in %s\n%s</code>" is the part of all
error messages that indicates where the error occurred if it was inside a
procedure; you might want to change the word <code>in</code> to your language.
<code>%s defined\n</code> is what <code>LOAD</code> prints for each procedure defined
if the variable <code>LOADNOISILY</code> is <code>TRUE</code>.
"<code>to %p\nend\n\n</code>" is what <code>EDIT</code> puts in the temporary file if
you ask to edit a procedure that isn't already defined.
</p>
<p>Also in the ‘<tt>Messages</tt>’ file are lines containing only one word each; the
first of these is the word <code>true</code>. Some of these words are recognized by
Logo in user input; some are generated by Logo; some are both. For example,
the words <code>TRUE</code> and <code>FALSE</code> are recognized as Boolean values by
<code>IF</code> and <code>IFELSE</code>, and are also generated by Logo as outputs from
the primitive predicates such as <code>EQUALP</code>. The word <code>END</code> is
recognized as the end of a procedure definition, and may be generated when
Logo reconstructs a procedure body for <code>PO</code> or <code>EDIT</code>. I've used
capital letters in this paragraph for easier reading, but the words in the
‘<tt>Messages</tt>’ file should be in lower case.
</p>
<p>If you replace these with non-English words, Logo will <em>recognize</em> both the
English names and your alternate names. For example, if you replace the
word <code>true</code> with <code>vrai</code> then Logo will understand both of these:
</p>
<table><tr><td> </td><td><pre class="example">IF "TRUE [PRINT "YES]
IF "VRAI [PRINT "YES]
</pre></td></tr></table>
<p>The variable <code>UseAlternateNames</code> determines whether Logo will
<em>generate</em> other-language names – for example, whether predicate
functions return the other-language alternates for <code>TRUE</code> and
<code>FALSE</code>. This variable is <code>FALSE</code> by default, meaning that the
English words will be generated.
</p>
<p>You might wish to have English-named predicate functions generate English
<code>TRUE</code> and <code>FALSE</code>, while other-language-named predicates generate
the alternate words. This can be done by leaving <code>UseAlternateNames</code>
false, and instead of defining the other-language predicates with
<code>COPYDEF</code>, do it this way:
</p>
<table><tr><td> </td><td><pre class="example">to french.boolean :bool
if equalp :bool "true [output "vrai]
if equalp :bool "false [output "faux]
output :bool ; shouldn't happen
end
to make.french.predicate :french :english :arity
define :french `[[[inputs] ,[:arity]]
[output french.boolean
apply ,[word "" :english] :inputs]]
end
? make.french.predicate "egal? "equal? 2
? pr egal? 3 4
faux
? pr egal? 4 4
vrai
? pr equal? 3 4
false
? pr equal? 4 4
true
</pre></td></tr></table>
<p>The third input to <code>make.french.predicate</code> is the number of inputs that
the predicate expects. This solution isn't quite perfect because the infix
predicates (<code>=</code>, <code><</code>, <code>></code>) will still output in English. If
you want them to generate alternate-language words, set
<code>UseAlternateNames</code> to <code>TRUE</code> instead.
</p>
<p>Some of the words in this section of the ‘<tt>Messages</tt>’ file are names of
Logo primitives (<code>OUTPUT</code>, <code>STOP</code>, <code>GOTO</code>, <code>TAG</code>,
<code>IF</code>, <code>IFELSE</code>, <code>TO</code>, <code>.MACRO</code>). To translate these
names, you must use <code>COPYDEF</code> as described earlier, in addition to
changing the names in ‘<tt>Messages</tt>’. You should be consistent in these two
steps. Don't forget the period in <code>.macro</code>!
</p>
<p>For documentation, there are two kinds: this manual and the help files.
The latter are generated automatically from this manual if you have a
Unix system, so in that case you need only translate this manual,
maintaining the format. (The automatic helpfile generator notices
things like capital letters, tabs, hyphens, and equal signs at the
beginnings of lines.) The program <code>makefile.c</code> may require modification
because a few of the primitive names are special cases (e.g., <code>LOG10</code> is
the only name with digits included).
</p>
<p>If you don't have Unix tools, you can just translate each helpfile
individually. A period in a primitive name is represented as a <code>D</code> in
the filename; there are no files for question marks because the <code>HELP</code>
command looks for the file named after the corresponding primitive
that ends in <code>P</code>.
</p>
<hr size="6">
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="usermanual_11.html#SEC373" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="usermanual_13.html#SEC391" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="usermanual.html#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="usermanual_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="usermanual_13.html#SEC391" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="usermanual_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<p>
<font size="-1">
This document was generated by <em>Brian Harvey</em> on <em>September, 3 2008</em> using <a href="http://www.nongnu.org/texi2html/"><em>texi2html 1.78</em></a>.
</font>
<br>
</p>
</body>
</html>
|