Feb 02

What is the difference between a .po and .pot file?

Here’s a quote from the GNU gettext utilities page:

After preparing the sources, the programmer creates a PO template file. This section explains how to use xgettext for this purpose.

xgettext creates a file named domainname.po. You should then rename it to domainname.pot. (Why doesn’t xgettext create it under the name domainname.pot right away? The answer is: for historical reasons. When xgettext was specified, the distinction between a PO file and PO file template was fuzzy, and the suffix ‘.pot’ wasn’t in use at that time.)

So that’s it. It’s the same file, with a different name. Just thought I’d mention that, considering how much time I pissed off trying to find the answer!

  • Facebook
  • Share/Bookmark
Jan 29

I’m beginning a new effort these days, that of internationalisation and localisation of the php coding I’ve been doing lately.

GNU ‘gettext’ Utilities

These docs for gettext are C-oriented, but the associated tools such as xgettext are easily used by PHP, so let’s not get too excited about the C.
And I’m going to assume you have installed GNU’s gettext on your system.  I’m pretty sure it arrives by default with your ubuntu or other linux installation.  Mac and Windows you’re going to have to find for yourself :-)

Edited:  download GetText for Windows here

There’s also a lot of emacs crap in this doc, which I’m also going to ignore.  We’re going to use tools like poedit, gtranslator for what we need … coming posts.

on my ubuntu 9.10 box the following command installs the php-gettext stuff in /usr/share/php/php-gettext

sudo apt-get install php-gettext

and includes these three files:

  • gettext.inc
  • gettext.php
  • streams.php

I’m not going to deal with the internals of these files here in this post.

What I do is copy these into my working project somewhere, say in a subdirectory named “library”, “lib”, “i18n” … etc. I’m going to call it ./library/i18n just for this.

.po, .pot, .mo files – what are these?

http://www.gnu.org/software/gettext/manual/gettext.html#Files

That’s about all for now, sorry I couldn’t be more helpful in this post.  This is just the setup stuff I’ve done for my new entry into this world of Internationalisation (i18n), Localisation (l10n), and Native Language Support (NLS) — see Concepts.

  • Facebook
  • Share/Bookmark
Jan 22

I had the day wrong – it's not the 22nd of January, it was the 14th of January.  I looked in my journal and realized that the 14th of January, 2008 was the first day I stepped foot in Bulgaria.

That's right.  I remember getting on the plane in Madison, Wisconsin, sometime in the afternoon of January 13th.  22 hours later my flight from Frankfurt Germany landed in Sofia, in a blizzard!
Nedda and Ivan were there to meet me.  We followed a couple of snow plows clear across Bulgaria, until we turned south to Burgas.

So anyway, here we are, here I am.  Tonight Zlatina and I are going to entertain a little, we invited people over from her school, and I invited everybody who had anything to do with my being here.  We'll have a nice social time, with some rosé and white wine chilled on the balcony, some red wine, and stuff like that.

It may be that some of the people won't be able to make it.  Folks here in southeastern Bulgaria are not used to the kind of cold we're having here this past week – many engines won't start.  Deep snow is still all over the place, the roads have been turned into glaciers, and it's hard freezing every night.

But we'll try.  Happy Anniversary Kevin.

Oh, by the way, the forecast for tomorrow calls for more heavy snow.

  • Facebook
  • Share/Bookmark
Jan 20

Picasaweb Gallery Photos

 It started snowing Monday night about 6pm, and continued until tonight (Tuesday) about 8pm.  Heavy snow, in fact all the people I talked to here today in Burgas say it's the heaviest snow they've ever seen here.

I took a nice walk from our new place on Rilska street, down to Bogoridi, to the Sea Garden …. out to the end of the pier, on to the beach … back through the sea garden.  You can see the pictures below in the embedded picasweb link.

What a great day it's been.  It reminds me so much of living in Madison, Wisconsin in the US.  Sure, it's not quite as cold here – just a few degrees below freezing, and it only snows like this once a decade here where it snows like this repeatedly throughout the winter in Wisconsin – but hey, it does remind me of the past three winters I spent in Madison, and I did like the winters there for some weird reason :-)

 

 

  • Facebook
  • Share/Bookmark
Tagged with:
Dec 30

We're staying at the five-star Grand Hotel Dimyat for a few days, here to enjoy some time with Zlatina's family and some old friends, and to generally enjoy the city of Varna for the new year celebrations. 

I guess I have to say that Varna is a prettier city than Burgas, a larger city.  Certainly more attractive than Sofia … in fact it kind of reminds me of Seattle, only without all the rain all the time.  The city puts up lots of christmas lights, keeps them on through the new year.  I hope to go out tomorrow night and take some slow-shutter speed photos to show you.

Well, I ate too much at dinner again, seems it's the time of year for that.  Good night, and have a happy new year of if you can.

Link to Photos from our Varna vacation

  • Facebook
  • Share/Bookmark
Dec 21

We're preparing for a trip to Medven, Bulgaria.  We'll be spending our christmas vacation there, in a bungalow in the mountains.  Hoping for a white christmas :)

Loading...
 
  • Facebook
  • Share/Bookmark
Dec 19

On Dec 11 we had our first snow in Burgas

Picasaweb Photos

  • Facebook
  • Share/Bookmark
Tagged with:
Dec 12

Code Colorer

I used WP-SyntaxHighlighter, I tried some others, but the simplest and most expedient plugin I found for highlighting code in my blogs comes from Dmytro Shteflyuk’s Code Colorer.
Like most of them it’s based on the Geshi Generic Syntax Highlighter … much easier syntax.

I recommend this one for bloggers who wish to include code in their posts.

  • Facebook
  • Share/Bookmark
Tagged with:
Dec 11

I’m learning how to write wordpress plugins, I’ve said that before here in my blog.  One of the ways I’m doing it is by downloading/installing existing plugins I see out there which may be interesting to me – they provide actions and capabilities to do things I want my plugin(s) to do … on a more general scale.

One thing I have noticed – almost all of these plugin authors do NOT use classes in their design.  Their .php files are full of functions, most of the time written without the

if (!function_exists('my_function')) {
  function my_function() {
    // and so on
  }
}

or

if (!function_exists('my_function')) :
  function my_function() {
    // and so on
  }
}
endif;

How do they expect to avoid naming collisions?  If they have to have a function by a certain name which probably exist in some other plugin developer’s file somewhere, then even if they use this !function_exists business they’ll end up getting the other author’s behavior for that function.

Why don’t these people just use classes! I know I’m coming at this from the java world where you have to use classes for everything, and there’s packaging to avoid naming collisions, but still – this seems like an obvious question to me. Do the modern php programmers have no experience with a real class-oriented language?

Here’s a silly example I’m doing. I have a plugin I’m developing to allow Zlatina’s web administrators to deal with their database of students and contacts. It’s called Bcc DBManager.
I created a subdirectory wp-content/plugins/bcc-dbmanager, with a file named bcc-dbmanager.php … duh. I want to hook into the activate_${plugin} (see this link for an explanation of that). Here’s a partial …

<?php
/*
Plugin Name: Bcc DBManager
Description: Blah blah
*/

$bccDBManager = new BCC_DBmanager();
add_action('activate_bcc-dbmanager/bcc-dbmanager.php',                  
         array(&$bccDBManager,'_activate'));

class BCC_DBmanager {  
  function _activate()  {    
    // do stuff    
    $this->very_common_function_name();
    // or this way
    BCC_DBmanager::very_common_function_name();
  }
  ## function with a very common name
 function very_common_function_name() {
    // do stuff
  }
}
?>

How hard is that? I certainly don’t know much about plugin development at this point. But I would have to describe the use of functions rather than class instances and methods as Code Smell.

[Edit] Since I wrote this post I found this link on Nerdaphernalia: Use Classes in your WordPress plugins to increase code portability and reduce name conflicts

  • Facebook
  • Share/Bookmark
Tagged with:
Dec 07

British Cultural Centre

The above is a link to Zlatina’s school, the British Cultural Centre, Burgas.  It’s her english-language school, she teaches children from the age of 4 until they graduate from high school.

I designed the website based on the Education theme from studiopress.  Zlatina wrote all the Bulgarian stuff you see, her son Petko typed it all in.  Stop by for a visit :-)

  • Facebook
  • Share/Bookmark
Tagged with:
preload preload preload