Skip to content

Month: May 2011

How to put a sound on your website?

I use flash to achieve this. Create a new flash file with AS3. Create two buttons which will be placed one above the other. The stop button instance is called xstop and the play button instance is called xplay.

And this is the code:

//think of the soundchannel as a speaker system and the sound as an mp3 player
var soundChannel:SoundChannel = new SoundChannel();
var sound:Sound = new Sound(new URLRequest("http://www.kavdesign.net/sites/stgeorge/birds1.mp3"));

xstop.addEventListener(MouseEvent.CLICK, clickStop);
xplay.addEventListener(MouseEvent.CLICK, clickPlay);

playMusic();

function clickPlay(evt:MouseEvent) {
	playMusic();
}

function clickStop(evt:MouseEvent) {
		soundChannel.stop();
		soundChannel.removeEventListener(Event.SOUND_COMPLETE, loopMusic);
		xstop.visible = false;
		xplay.visible = true;
}

function playMusic():void
	{
		 soundChannel = sound.play();
		 soundChannel.addEventListener(Event.SOUND_COMPLETE, loopMusic);
		 xstop.visible = true;
		 xplay.visible = false;
	}

function loopMusic(e:Event):void
	{
		 if (soundChannel != null)
		 {
			  soundChannel.removeEventListener(Event.SOUND_COMPLETE, loopMusic);
			  playMusic();
		 }
	}

How to translate the WordPress Thesis Theme

WordPress Thesis Theme is shipped in English language only, but it provides also the strings to translate in a file in PO (GNU Gettext Portable Object) format.
The file is thesis.po and is located in the directory wp-content/themes/thesis of your WordPress installation. The file thesis.mo that you’ll find in the same directory is the same file but in the machine readable format.
To translate the Thesis’s strings in your own language follow these simple steps :

  1. set your preferred language in the file wp-config.php : for Italian, for example, define ('WPLANG', 'it_IT');
    See these instructions WordPress in Your Language for a complete guide.
  2. rename the thesis.po file using your language code (ex for Italian language in will be : it_IT.po)
  3. open the file with the text editor of your choice and translate the strings filling the msgstr value
  4. using the command-line utility msgfmt to create the machine readable file : msgfmt -o it_IT.mo it_IT.po
  5. copy the files it_IT.po, it_IT.mo into the wp-content/themes/thesis directory
  6. In thesis 1.8 or later copy the files it_IT.po, it_IT.mo into the wp-content/themes/thesis_18/lib/languages directory
  7. There may be missing strings, so add them to the .po file with Dreamweaver or notepad and generate the .mo file with poedit.