<?php
if( !extension_loaded('gtk')) {
dl( 'php_gtk.' . PHP_SHLIB_SUFFIX);
}
putenv( "LANG=" . 'de_DE'); //required on windows, because setlocale doesn't really work
setlocale( LC_ALL, 'de_DE');
if( !function_exists( 'gettext')) {
//gettext not automatically loaded
if( !@dl( 'php_gettext.' . PHP_SHLIB_SUFFIX)) {
die( 'gettext extension is not available!');
}
}
bindtextdomain( 'testapp', dirname( __FILE__) . '/locale');
textdomain( 'testapp');
$window = &new GtkWindow();
$window->set_default_size( 300, 200);
$window->set_title( _('window title'));
$vbox = &new GtkVBox();
$label = &new GtkLabel( _('Translation test'));
$button = &new GtkButton( gettext('Close window'));
$vbox->pack_start( $label);
$vbox->pack_start( $button);
$window->connect_object('destroy', array('gtk', 'main_quit'));
$button->connect_object( 'clicked', array( 'gtk', 'main_quit'));
$window->add( $vbox);
$window->show_all();
gtk::main();
?>
|