Drupal : Override strings without touching the code

What’s up ?
I was trying to implement the “wall to wall” feature using the guestbook drupal module when i noticed that it will be more funny if the user can see wall instead of ‘guestbook’.

So the question now is how do I change the string without touching the module code ? 😕 (i don’t know if this smiley exists :-))

The vision …
Then i got a vision :-). Promise me that you won’t laugh.

I remembered that when you are using another language in drupal the string displayed is in english only if the language is not enabled or if the string is not translated. Thus if i create a language, enable it, and translate only “guestbook” to “wall” then every where a string should be displayed only guestbook will change to wall and the rest will be in english !!! Isn’t that cool ? My mum said that i’ll be a good drupaler hehehehe (even though she doesn’t know what drupal is :-D).

Don’t worry my mum said also that you can be a good drupaler!

How can you do the same thing ?

1- Enable the “locale” and “Content translation” modules
2- Create a fake language (mine is called fake with the code fk-fake) on /admin/settings/language/add
3- Make the fake language the default one on /admin/settings/language/
4- Search and translate the ‘guestbook’ (or the string you want) on /admin/build/translate/search
5- Be happy.

PS: In case you can’t find the string when searching check if the t() function is used in the module.

2 thoughts on “Drupal : Override strings without touching the code

  1. Hey thak you very much…it helped a lot for me.

  2. Hey check this link http://drupal.org/node/522036. We can do by using string overwrite module. There is a lot of documentation in drupal.org but not organized well.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s