I have found the bug.  I thought I was working with a Spanish laptop, but I now see it is a Brazilian laptop.  The Spanish translator included the "s"s and the Brazilian translator did not.  It all looked like Latin based languages to me, and therefore I could not tell the difference :-)
<br><br>I will go thought the other .po files and ensure they have the right variables.<br><br>Thanks everyone.<br><br><div><span class="gmail_quote">On 1/4/08, <b class="gmail_sendername">Erik Blankinship</b> &lt;<a href="mailto:erikb@mediamods.com">
erikb@mediamods.com</a>&gt; wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Sometimes translators have to include variables in their translations.
<br><br>Most po files have their source strings set up using just %s as the variable name.<br><br>
<div style="margin-left: 40px;"><span style="font-family: courier new,monospace;">&gt;&gt;&gt; test = &quot;hi there %s&quot;</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">&gt;&gt;&gt; test % &#39;erik&#39;</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">&#39;hi there erik&#39;</span></div><br><br>However, the order of those variables might be different in different languages.&nbsp; That is why we set up our strings like this:
<br><span style="font-family: courier new,monospace;"></span><br style="font-family: courier new,monospace;">
<div style="margin-left: 40px;"><span style="font-family: courier new,monospace;">&gt;&gt;&gt; test2 = &quot;hi there %(1)s and %(2)s&quot;</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">

&gt;&gt;&gt; test2 % {&quot;1&quot;:&quot;erik&quot;, &quot;2&quot;:&quot;michael&quot;}</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">&#39;hi there erik and michael&#39;
</span><br></div>

<br>The translators successfully copied these variable place holders into their strings.&nbsp; That was not a problem for the translators.<br><br>The problem is that the variable names in their .po files don&#39;t come through the process of making a .xo package.&nbsp; %(1)s becomes %(1).&nbsp; This causes gettext to break.
<br><br>We just tested using %s for all of our strings, and that works.&nbsp; We can quickly revert to that (hoping the phrases we asked to be translated didn&#39;t require resequencing of variables).&nbsp; <br><br>It seems that there might be a bug in the process that is generating the locale information from the po files.
<div><span class="e" id="q_117474c8293bbe92_1"><br><br><br><div><span class="gmail_quote">On 1/4/08, <b class="gmail_sendername">Walter Bender</b> &lt;<a href="mailto:walter@laptop.org" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
walter@laptop.org</a>&gt; wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
the problem is that your asking the translator to not just translate<br>strings, but also your python code. that won&#39;t work.<br><br>-walter<br><br>On Jan 4, 2008 4:45 PM, Erik Blankinship &lt;<a href="mailto:erikb@mediamods.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">

erikb@mediamods.com</a>&gt; wrote:<br>&gt; Trying to run Record in Spanish is causing a problem.&nbsp;&nbsp;I will outline the<br>&gt; steps which create this problem.&nbsp;&nbsp;Hopefully someone can clarify where the<br>&gt; bug is.<br>&gt;
<br>&gt; In Constants.py, we define the following string:<br>&gt;<br>&gt;&nbsp;&nbsp;#TRANS: photo by photographer, e.g., &quot;Photo by Mary&quot;<br>&gt; istrBy = _(&quot;%(1)s by %(2)s&quot;)<br>&gt;<br>&gt; Which was picked up when we ran python genpot to create 
Record.pot.<br>&gt;<br>&gt; A translator kindly translated Record.pot into Spanish to create es.po:<br>&gt;<br>&gt; #. TRANS: photo by photographer, e.g., &quot;Photo by Mary&quot;<br>&gt; #: constants.py:99<br>&gt; #, python-format
<br>&gt; msgid &quot;%(1)s by %(2)s&quot;<br>&gt; msgstr &quot;%(1)s por %(2)s&quot;<br>&gt;<br>&gt; Then, we created Record-49.xo by running python setup.py dev and python<br>&gt; setup.py dist in the sugar shell.&nbsp;&nbsp;This creates and populates the locale
<br>&gt; directory with lots of files.<br>&gt;<br>&gt; Then we install the program on an xo and run it.<br>&gt;<br>&gt; Then we take a picture, and that process tries to assign metadata to a<br>&gt; datastory entry, but crashes with this stack trace:
<br>&gt;<br>&gt; --&gt; 371&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; recd.title = Constants.istrBy % {&quot;1&quot;:stringType,<br>&gt; &quot;2&quot;:str(recd.recorderName)}<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; recd.title = None<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; global Constants.istrBy = &#39;%(1) por %(2)&#39;
<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;stringType = &#39;Foto&#39;<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; global str = undefined<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;recd.recorderName = u&#39;dude face&#39;<br>&gt; ...<br>&gt;&nbsp;&nbsp;&lt;type &#39;exceptions.ValueError&#39;&gt;: unsupported format character &#39;p&#39; (0x70) at
<br>&gt; index 5<br>&gt;<br>&gt; What is strange is the line Constants.istrBy = &#39;%(1) por %(2)&#39;<br>&gt;<br>&gt; This string appears to have lost its &quot;s&quot; at the end of the (1) and the (2)<br>&gt; (which we can see were included in the 
es.po file above).&nbsp;&nbsp;I am not sure how<br>&gt; this would have happened, but it does seem to make some sense of the error<br>&gt; (the p character being the first thing interpreted after where an s was<br>&gt; expected.<br>

&gt;<br>&gt; Any ideas on where we&#39;re doing something wrong?&nbsp;&nbsp;Thanks.<br>&gt;<br>&gt; Erik<br>&gt; _______________________________________________<br>&gt; Sugar mailing list<br>&gt; <a href="mailto:Sugar@lists.laptop.org" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">

Sugar@lists.laptop.org</a><br>&gt; <a href="http://lists.laptop.org/listinfo/sugar" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">http://lists.laptop.org/listinfo/sugar</a><br>&gt;<br>&gt;<br><br>
<br><br>--<br>Walter Bender<br>One Laptop per Child<br><a href="http://laptop.org" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
http://laptop.org</a><br></blockquote></div><br>
</span></div></blockquote></div><br>