<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><blockquote type="cite"><div><font class="Apple-style-span" color="#000000"><br></font>On May 11, 2009, at 11:07 PM, Dmitrii Dimandt wrote:<br><br><blockquote type="cite"><br></blockquote><blockquote type="cite">On May 11, 2009, at 10:27 PM, Dmitrii Dimandt wrote:<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><blockquote type="cite">This is a very strange behavior I've observed in gettext.<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">From the tutorial:<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">In order to create the initial PO file, run the Makefile in the directory, that the directories that should be processed, i.e where there are code containing ?TXT macros.<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">And that's all gettext processes — ?TXT macros. Does it mean that I have to only use ?TXT macros and then go through the code and change them to ?TXT2, ?FTXT etc manually?<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">Is there a way to make erlang_gettext process these macros as well?<br></blockquote></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">Ok, I've gotten to the bottom of this. Sort of...<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">?TXT2("other string", "en")<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">turns into something like<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">{call,39,<br></blockquote><blockquote type="cite"> {remote,39,{atom,39,gettext},{atom,39,key2str}},<br></blockquote><blockquote type="cite"> [{string,39,"other string"},{string,39,"en"}]}<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">which somehow doesn't get matched by pt/3 in gettext_compile.erl<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">Weird...<br></blockquote><br></div></blockquote></div><br><div><div><br>Ok. This is an ad-hoc solution that will definitely fail somewhere down the road.<br><br>In gettext_compile.erl find the following function:<br><br>pt([H|T], Opts, Func) when is_tuple(H) -><br> ?debug( "--- 3 --- ~p~n",[H]),<br> [while(size(H), H, Opts, Func) | pt(T, Opts, Func)];<br><br>change it to:<br><br>pt([H|T], Opts, Func) when is_tuple(H) -><br> ?debug( "--- 3 --- ~p~n",[H]),<br><span class="Apple-tab-span" style="white-space: pre; "> </span>case H of<br><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>{call, _, _, _} -><br><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>[pt(H, Opts, Func) | pt(T, Opts, Func)];<br><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>_ -><br><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>[while(size(H), H, Opts, Func) | pt(T, Opts, Func)]<br><span class="Apple-tab-span" style="white-space: pre; "> </span>end;<br><br>This way pt/3 will not miss the function call to key2str/2. Hopefully...</div><br></div></body></html>