Skip to content

Commit

Permalink
Adding support for localization of navigation/talk selection pages.
Browse files Browse the repository at this point in the history
  • Loading branch information
jmcastagnetto committed May 24, 2005
1 parent d9a06b6 commit 7628257
Show file tree
Hide file tree
Showing 8 changed files with 258 additions and 24 deletions.
8 changes: 8 additions & 0 deletions config.php-dist
Expand Up @@ -12,6 +12,14 @@
$pdf_example_font = "Courier"; $pdf_example_font = "Courier";
$jsKeyboard = true; // enable javascript handling of keyboard events $jsKeyboard = true; // enable javascript handling of keyboard events
$topic_cols = 3; // number of topic columns on front page $topic_cols = 3; // number of topic columns on front page

// language/locale for PRES2 messages, available: en, es
// do not use es_ES or other variation, set the equivalencies
// in the function _init_gettext() in messages.php
define('PRES2_LOCALE', 'en');
define('PRES2_LOCALEDIR', 'locale');
define('PRES2_USE_GETTEXT', false);



// Convert em font sizing to flash font sizes // Convert em font sizing to flash font sizes
function flash_fixsize($ht) { function flash_fixsize($ht) {
Expand Down
47 changes: 23 additions & 24 deletions index.php
Expand Up @@ -5,6 +5,7 @@


require 'config.php'; require 'config.php';
require 'XML_Presentation.php'; require 'XML_Presentation.php';
require_once 'messages.php';


session_start(); session_start();


Expand All @@ -23,8 +24,8 @@
} }


if (!$ps) { if (!$ps) {
echo "Could not find any slides (xml files) in \$presentationDir $presentationDir<BR>"; echo message('SLIDES_NOT_FOUND')." \$presentationDir $presentationDir<BR>";
echo "Please modify config.php<BR>"; echo message('MODIFY_CONFIG')." config.php<BR>";
exit; exit;
} }


Expand Down Expand Up @@ -109,16 +110,15 @@ function change_mode() {
echo "<img src=\"$logo2\" align=\"right\" style=\"float: right;\">"; echo "<img src=\"$logo2\" align=\"right\" style=\"float: right;\">";
} }


echo "<div style=\"font-size: 3em; margin: 0 2.5em 0 0;\">PHP Presentation System</div>"; echo "<div style=\"font-size: 3em; margin: 0 2.5em 0 0;\">".message('PRES2_TITLE')."</div>";


echo '</div></div>'; echo '</div></div>';
?> ?>
<br /><br /><br /><br /><br /><br /> <br /><br /><br /><br /><br /><br />
<div class="shadow" style="margin: 1em 4em 0.8em 3em;"> <div class="shadow" style="margin: 1em 4em 0.8em 3em;">
<div class="output" style="font-size: 1.8em; margin: -0.5em 0 0 -0.5em;"> <div class="output" style="font-size: 1.8em; margin: -0.5em 0 0 -0.5em;">
<?php if(!isset($topic)){ ?> <?php if(!isset($topic)){ ?>
<p> Welcome to the PHP Presentation System. Here we list all of the available presentation categories stored <p><?php echo message('WELCOME_MSG'); ?></p>
within this system.</p>
<?php <?php
ksort($topics); ksort($topics);
print('<table width="100%"><tr>'."\n"); print('<table width="100%"><tr>'."\n");
Expand All @@ -144,51 +144,50 @@ function change_mode() {
$_SESSION['selected_display_mode'] = $display_mode; $_SESSION['selected_display_mode'] = $display_mode;
?> ?>
<form name="modes_form" action="<?php echo $_SERVER['PHP_SELF']?>" method="POST"> <form name="modes_form" action="<?php echo $_SERVER['PHP_SELF']?>" method="POST">
<p>Please select a display mode: <p><?php echo message('SELECT_MODE'); ?>
<select name="modes" onChange="change_mode()"> <select name="modes" onChange="change_mode()">
<option value="html" <?php echo ($display_mode=='html')?'SELECTED':''?>>Fancy HTML (Best with Mozilla)</option> <option value="html" <?php echo ($display_mode=='html')?'SELECTED':''?>><?php echo message('OPT_FANCYHTML'); ?></option>
<option value="plainhtml" <?php echo ($display_mode=='plainhtml')?'SELECTED':''?>>Plain HTML</option> <option value="plainhtml" <?php echo ($display_mode=='plainhtml')?'SELECTED':''?>><?php echo message('OPT_PLAINHTML'); ?></option>
<option value="flash" <?php echo ($display_mode=='flash')?'SELECTED':''?>>Flash 5 (navbar only)</option> <option value="flash" <?php echo ($display_mode=='flash')?'SELECTED':''?>><?php echo message('OPT_FLASH'); ?></option>
<option value="pdfus" <?php echo ($display_mode=='pdfus')?'SELECTED':''?>>PDF (US-Letter)</option> <option value="pdfus" <?php echo ($display_mode=='pdfus')?'SELECTED':''?>><?php echo message('OPT_PDFLETTER'); ?></option>
<option value="pdfusl" <?php echo ($display_mode=='pdfusl')?'SELECTED':''?>>PDF (US-Legal)</option> <option value="pdfusl" <?php echo ($display_mode=='pdfusl')?'SELECTED':''?>><?php echo message('OPT_PDFLEGAL'); ?></option>
<option value="pdfa4" <?php echo ($display_mode=='pdfa4')?'SELECTED':''?>>PDF (A4)</option> <option value="pdfa4" <?php echo ($display_mode=='pdfa4')?'SELECTED':''?>><?php echo message('OPT_PDFA4'); ?></option>
</select> </select>
<br /> <br />
Show Speaker Notes: <input type="checkbox" name="speaker" <?php echo ($form_speaker=='true')?'checked':''?> onChange="change_mode()"> <?php echo message('SHOW_NOTES'); ?> <input type="checkbox" name="speaker" <?php echo ($form_speaker=='true')?'checked':''?> onChange="change_mode()">
</p> </p>
</form> </form>
<?php <?php
switch($display_mode) { switch($display_mode) {
case 'html': case 'html':
if($jsKeyboard) { if($jsKeyboard) {
echo "<p>Keyboard controls are available: <br />\n". echo "<p>".nl2br(message('HTML_KEYBOARD_CONTROLS'))."</p>\n";
" &lt;cursor-left&gt; previous slide<br />\n".
" &lt;cursor-right&gt; next slide<br />\n".
" also use &lt;cursor-right&gt; to step through animated slides.</p>\n";
} else { } else {
echo "<p>Keyboard controls disabled</p>\n"; echo "<p>".message('HTML_NO_KEYBOARD_CONTROLS')."</p>\n";
break; break;
} }
break; break;


case 'flash': case 'flash':
echo "<p>Keyboard controls available: <br />\n". echo "<p>".nl2br(message('FLASH_KEYBOARD_CONTROLS'))."</p>\n";
" &lt;Space&gt; or &lt;Enter&gt; next slide<br />\n".
" &lt;Backspace&gt; previous slide<br />\n";
break; break;


case 'pdfus': case 'pdfus':
case 'pdfusl': case 'pdfusl':
case 'pdfa4': case 'pdfa4':
if (!extension_loaded("pdf")) { if (!extension_loaded("pdf")) {
echo "<p>The PDF extension is not loaded, so this format is not available here.</p>"; echo "<p>".message('NO_PDF_EXTENSION')."</p>\n";
} }
break; break;
} }
?> ?>
<p>The available presentations are... (most recent first)</p> <p><?php echo message('AVAILABLE_PRESENTATIONS'); ?></p>
<table align="center" class="index"> <table align="center" class="index">
<tr><th>Title</th><th>Date</th><th>Location</th><th>Speaker</th><th>Slides</th></tr> <tr><th><?php echo message('PRES_TITLE'); ?></th>
<th><?php echo message('PRES_DATE'); ?></th>
<th><?php echo message('PRES_LOCATION'); ?></th>
<th><?php echo message('PRES_SPEAKER'); ?></th>
<th><?php echo message('PRES_SLIDES'); ?></th></tr>
<?php <?php
$prnum = sizeof($pr); $prnum = sizeof($pr);


Expand Down
Binary file added locale/en/LC_MESSAGES/pres2.mo
Binary file not shown.
32 changes: 32 additions & 0 deletions locale/en/LC_MESSAGES/pres2.php
@@ -0,0 +1,32 @@
<?php
// en_US
$messages = array(
'SLIDES_NOT_FOUND' => 'Could not find any slides (xml files) in',
'MODIFY_CONFIG' => 'Please modify',
'PRES2_TITLE' => 'PHP Presentation System',
'WELCOME_MSG' => 'Welcome to the PHP Presentation System. Here we list all of the available presentation categories stored within this system.',
'SELECT_MODE' => 'Please select a display mode:',
'OPT_FANCYHTML' => 'Fancy HTML (Best with Mozilla)',
'OPT_PLAINHTML' => 'Plain HTML',
'OPT_FLASH' => 'Flash 5 (navbar only)',
'OPT_PDFLETTER' => 'PDF (US-Letter)',
'OPT_PDFLEGAL' => 'PDF (US-Legal)',
'OPT_PDFA4' => 'PDF (A4)',
'SHOW_NOTES' => 'Show Speaker Notes:',
'HTML_KEYBOARD_CONTROLS' => "Keyboard controls are available:\n".
" &lt;cursor-left&gt; previous slide\n".
" &lt;cursor-right&gt; next slide\n".
" also use &lt;cursor-right&gt; to step through animated slides.",
'HTML_NO_KEYBOARD_CONTROLS' => 'Keyboard controls disabled',
'FLASH_KEYBOARD_CONTROLS' => "Keyboard controls available:\n".
" &lt;Space&gt; or &lt;Enter&gt; next slide\n".
" &lt;Backspace&gt; previous slide",
'NO_PDF_EXTENSION' => 'The PDF extension is not loaded, so this format is not available here.',
'AVAILABLE_PRESENTATIONS' => 'The available presentations are... (most recent first)',
'PRES_TITLE' => 'Title',
'PRES_DATE' => 'Date',
'PRES_LOCATION' => 'Location',
'PRES_SPEAKER' => 'Speaker',
'PRES_SLIDES' => 'Slides',
);
?>
82 changes: 82 additions & 0 deletions locale/en/LC_MESSAGES/pres2.po
@@ -0,0 +1,82 @@
# English message strings for PRES2
# Copyright (C) PHP
# Jesus M. Castagnetto <jmcastagnetto@php.net>, 2005.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: 1.0\n"
"POT-Creation-Date: 2005-05-07 23:21-0500\n"
"PO-Revision-Date: 2005-05-07 23:26-0500\n"
"Last-Translator: Jesus M. Castagnetto <jmcastagnetto@php.net>\n"
"Language-Team:\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=ASCII\n"
"Content-Transfer-Encoding: 8bit\n"

msgid "SLIDES_NOT_FOUND"
msgstr "Could not find any slides (xml files) in"

msgid "MODIFY_CONFIG"
msgstr "Please modify"

msgid "PRES2_TITLE"
msgstr "PHP Presentation System"

msgid "WELCOME_MSG"
msgstr "Welcome to the PHP Presentation System. Here we list all of the available presentation categories stored within this system."

msgid "SELECT_MODE"
msgstr "Please select a display mode:"

msgid "OPT_FANCYHTML"
msgstr "Fancy HTML (Best with Mozilla)"

msgid "OPT_PLAINHTML"
msgstr "Plain HTML"

msgid "OPT_FLASH"
msgstr "Flash 5 (navbar only)"

msgid "OPT_PDFLETTER"
msgstr "PDF (US-Letter)"

msgid "OPT_PDFLEGAL"
msgstr "PDF (US-Legal)"

msgid "OPT_PDFA4"
msgstr "PDF (A4)"

msgid "SHOW_NOTES"
msgstr "Show Speaker Notes:"

msgid "HTML_KEYBOARD_CONTROLS"
msgstr "Keyboard controls are available:\n&lt;cursor-left&gt; previous slide\n&lt;cursor-right&gt; next slide\nalso use &lt;cursor-right&gt; to step through animated slides."

msgid "HTML_NO_KEYBOARD_CONTROLS"
msgstr "Keyboard controls disabled"

msgid "FLASH_KEYBOARD_CONTROLS"
msgstr "Keyboard controls available:\n&lt;Space&gt; or &lt;Enter&gt; next slide\n&lt;Backspace&gt; previous slide"

msgid "NO_PDF_EXTENSION"
msgstr "The PDF extension is not loaded, so this format is not available here."

msgid "AVAILABLE_PRESENTATIONS"
msgstr "The available presentations are... (most recent first)"

msgid "PRES_TITLE"
msgstr "Title"

msgid "PRES_DATE"
msgstr "Date"

msgid "PRES_LOCATION"
msgstr "Location"

msgid "PRES_SPEAKER"
msgstr "Speaker"

msgid "PRES_SLIDES"
msgstr "Slides"

Binary file added locale/es/LC_MESSAGES/pres2.mo
Binary file not shown.
32 changes: 32 additions & 0 deletions locale/es/LC_MESSAGES/pres2.php
@@ -0,0 +1,32 @@
<?php
// es_PE
$messages = array(
'SLIDES_NOT_FOUND' => 'No pude encontrar diapositivas (archivos xml) en',
'MODIFY_CONFIG' => 'Por favor modifique',
'PRES2_TITLE' => 'Sistema de Presentaciones de PHP',
'WELCOME_MSG' => 'Bienvenido al Sistema de Presentaciones de PHP. Aqui listamos todas las categorias de presentaciones disponibles en nuestro sistema.',
'SELECT_MODE' => 'Por favor seleccione un modo de exhibici&oacute;n:',
'OPT_FANCYHTML' => 'HTML Din&aacute;mico (Mejor con Mozilla)',
'OPT_PLAINHTML' => 'HTML Simple',
'OPT_FLASH' => 'Flash 5 (barra de navegaci&oacute;n solamente)',
'OPT_PDFLETTER' => 'PDF (Tama&ntilde;o carta, US)',
'OPT_PDFLEGAL' => 'PDF (Tama&ntilde;o oficio, US)',
'OPT_PDFA4' => 'PDF (Tama&ntilde;o A4)',
'SHOW_NOTES' => 'Mostrar las Notas de Presentador:',
'HTML_KEYBOARD_CONTROLS' => "Controles de teclado disponibles:\n".
" &lt;flecha-izquierda&gt; diapositiva previa\n".
" &lt;flecha-derecha&gt; diapositiva siguiente\n".
" tambi&eacute;n use &lt;flecha-derecha&gt; para activar diapositivas animadas.",
'HTML_NO_KEYBOARD_CONTROLS' => 'Controles de teclado no disponibles.',
'FLASH_KEYBOARD_CONTROLS' => "Controles de teclado disponibles:\n".
" &lt;Barra de espacio&gt; or &lt;Tecla de retorno&gt; diapositiva siguiente\n".
" &lt;Tecla de retroceso&gt; diapositiva previa",
'NO_PDF_EXTENSION' => 'La extensi&ooacute;n de PDF no esta cargada, de manera que este formato no esta disponible aqui.',
'AVAILABLE_PRESENTATIONS' => 'Las presentaciones disponibles son... (la m&aacute;s reciente primera)',
'PRES_TITLE' => 'T&iacute;tulo',
'PRES_DATE' => 'Fecha',
'PRES_LOCATION' => 'Locaci&oacute;n',
'PRES_SPEAKER' => 'Presentador',
'PRES_SLIDES' => 'Diapositivas',
);
?>
81 changes: 81 additions & 0 deletions locale/es/LC_MESSAGES/pres2.po
@@ -0,0 +1,81 @@
# Spanish translation of PRES2
# Copyright (C) PHP
# Jesus M. Castagnetto <jmcastagnetto@php.net>, 2005.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: 1.0\n"
"POT-Creation-Date: 2005-05-07 23:21-0500\n"
"PO-Revision-Date: 2005-05-07 23:26-0500\n"
"Last-Translator: Jesus M. Castagnetto <jmcastagnetto@php.net>\n"
"Language-Team:\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=ASCII\n"
"Content-Transfer-Encoding: 8bit\n"

msgid "SLIDES_NOT_FOUND"
msgstr"No pude encontrar diapositivas (archivos xml) en"

msgid "MODIFY_CONFIG"
msgstr"Por favor modifique"

msgid "PRES2_TITLE"
msgstr"Sistema de Presentaciones de PHP"

msgid "WELCOME_MSG"
msgstr"Bienvenido al Sistema de Presentaciones de PHP. Aqui listamos todas las categorias de presentaciones disponibles en nuestro sistema."

msgid "SELECT_MODE"
msgstr"Por favor seleccione un modo de exhibici&oacute;n:"

msgid "OPT_FANCYHTML"
msgstr"HTML Din&aacute;mico (Mejor con Mozilla)"

msgid "OPT_PLAINHTML"
msgstr"HTML Simple"

msgid "OPT_FLASH"
msgstr"Flash 5 (barra de navegaci&oacute;n solamente)"

msgid "OPT_PDFLETTER"
msgstr"PDF (Tama&ntilde;o carta, US)"

msgid "OPT_PDFLEGAL"
msgstr"PDF (Tama&ntilde;o oficio, US)"

msgid "OPT_PDFA4"
msgstr"PDF (Tama&ntilde;o A4)"

msgid "SHOW_NOTES"
msgstr"Mostrar las Notas de Presentador:"

msgid "HTML_KEYBOARD_CONTROLS"
msgstr"Controles de teclado disponibles:\n&lt;flecha-izquierda&gt; diapositiva previa\n&lt;flecha-derecha&gt; diapositiva siguiente\ntambi&eacute;n use &lt;flecha-derecha&gt; para activar diapositivas animadas."

msgid "HTML_NO_KEYBOARD_CONTROLS"
msgstr"Controles de teclado no disponibles."

msgid "FLASH_KEYBOARD_CONTROLS"
msgstr"Controles de teclado disponibles:\n&lt;Barra de espacio&gt; or &lt;Tecla de retorno&gt; diapositiva siguiente\n&lt;Tecla de retroceso&gt; diapositiva previa"

msgid "NO_PDF_EXTENSION"
msgstr"La extensi&ooacute;n de PDF no esta cargada, de manera que este formato no esta disponible aqui."

msgid "AVAILABLE_PRESENTATIONS"
msgstr"Las presentaciones disponibles son... (la m&aacute;s reciente primera)"

msgid "PRES_TITLE"
msgstr"T&iacute;tulo"

msgid "PRES_DATE"
msgstr"Fecha"

msgid "PRES_LOCATION"
msgstr"Locaci&oacute;n"

msgid "PRES_SPEAKER"
msgstr"Presentador"

msgid "PRES_SLIDES"
msgstr"Diapositivas"

0 comments on commit 7628257

Please sign in to comment.