[erlang-questions] erlang-gttext only looking for ?TXT macros?

Torbjorn Tornkvist <>
Tue May 12 12:47:14 CEST 2009


Dmitrii Dimandt wrote:
> This is a very strange behavior I've observed in gettext.
> 
>  From the tutorial:
> 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.
> 
> 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?

Well, the ?TXT macros (and friends) expands into a call to
gettext:key2str/N which then the parse_transform looks for
and uses to extract the string.

All strings are collected into a temporary dets table.
When all files has been processed, the dets table is traveresed
and a PO-file is produced. This PO-file, which contains your
strings in your default language, is then intended to be translated.

The actual processing can be controlled via your Makefiles by setting
up the correct evironment variables, removing the necessarey beam files
and recompile your code.

I guess you are using the jungerl version ?

Perhaps I should upload the version we are using (at Kreditor) to 
github? (I strongly prefer github nowadays)

--Tobbe

> 
> Is there a way to make erlang_gettext process these macros as well?
> 
> BTW. To all those working with erlang_gettext source code. Put this  
> line before to_list functions in gettext_compile module:
> 
> to_list({Module, _Parameters}) -> atom_to_list(Module);
> 
> This will handle parametrised modules declared as
> -module(some_module, [Param])
> 
> 
> 




More information about the erlang-questions mailing list