[support] local.module and filtering strings

Gerhard Killesreiter gerhard at killesreiter.de
Mon Oct 23 22:53:07 UTC 2006


Mohammed Al-shar' wrote:

Hi Mohammed!

> I am building a multi lingual site and is constantly checking the strings that need to be translated in the local.module  
> 
> the problem with this is that whenever I add a new module it adds its strings to the untranslated terms, and local.module display untranslated strings randomly. 
> 
> is there a way to filter strings that belong say to a certain module? or have local.module display strings sorted by module?? 
> 

I think that locale.module is the wrong tool for this job. If you look 
at the contrib cvs repository you will notice that some modules come 
with translations in several languages. The file format we use for 
distribution of such translations is the PO file format used by the GNU 
gettext tool.

We have a script (extractor.php) that extracts the strings that need 
translation from the module file. The script is delivered with the 
Drupal translation templates. You can run it on any module and will get 
a POT template. You can use this template with a PO editor such as PO 
edit to translate all the strings to whatever lannguage you want. And 
then you load a fresh copy and translate to the next language. Then, you 
can upload your translations directly after you installed your module. 
This way you won't see untranslated strings from the start.

To be fair: What I described is an ideal scenario. In reality there are 
some strings which are created dynamically which won't be caught by the 
extractor script. Also, some contributions authors don't use Drupal's 
translation mechanism correctly.

But I think it is a good start.

> the reason why I want to do this, is because there are strings that i am not interested in translating because they are used mainly for administration and the admin of the site, myself, has no problem with English.

In the PO editor you can always chose which strings to translate.

Cheers,
	Gerhard


More information about the support mailing list