How to translate a drupal module

  1. Download and install the Translation Template Extractor (POTX).
  2. Use POTX to extract from the installed module a .pot template, that is, a file that includes the untranslated strings in english.
  3. Download and install POEdit, the most common string translator.
  4. Use POEdit to create, from the extracted .pot template, the French version of the strings, a file with the .po extension.
  5. Use the locale module to import the new .po file so that the module’s interface appears in french
  6. Create a translations within your the folder of your module, e.g. example/translations
  7. As a base for other translations, place the .pot file (example.pot) which you created in step 2. above within the translations folder. example/translations/example.pot
  8. Place the extracted .po from step 4. there as e.g. fr.po for a french translation, too. example/translations/fr.po

Clever way to manage drupal install files

Since you can only have an implementation of hook_install() per module, it becomes tedious to manage large quantities of code. So I thought of a scheme to manage the code and keep it structured.

So I am dividing the functionality in update functions (implementations of hook_update_N()) and make a call to those functions from the implementation of hook_install().

I also write “downgrade” functions which have the format
/* Implements hook_install(). */
function module_install() {
module_update_7001(); // enables the freetouch theme
module_update_7002(); // creates the article and page content types
module_update_7003(); // creates the free software content type
}

/**
* Implements hook_uninstall().
*/
function module_uninstall() {
module_downgrade_7001(); // restores the theme to bartik
module_downgrade_7002(); // removes the page and article content
module_downgrade_7003();
}

Developing on Drupal with minimal usage of the admin interface

I decided recently to start one Drupal project where changes to the structure of the website are specifically made code-wise. This means that all the content types and every setting will be made by writing code. The admin interface will only be used for adding content to the website. And I am going to document every aspect I learn about Drupal.
The project I am talking about is replace.software. I am going to rewrite the whole website and learn along the way new techniques of approaching Drupal.