From: <rc...@us...> - 2014-06-22 21:30:31
|
Revision: 6772 http://sourceforge.net/p/web-erp/reponame/6772 Author: rchacon Date: 2014-06-22 21:30:22 +0000 (Sun, 22 Jun 2014) Log Message: ----------- Add $ViewTopic, $BookMark and page_title_text to language files maintenance scripts. Add anchor's id for the languages maintenance scripts bookmarks. Modified Paths: -------------- trunk/Z_poAddLanguage.php trunk/Z_poAdmin.php trunk/Z_poEditLangHeader.php trunk/Z_poEditLangModule.php trunk/Z_poEditLangRemaining.php trunk/Z_poRebuildDefault.php trunk/doc/Manual/ManualSpecialUtilities.html Modified: trunk/Z_poAddLanguage.php =================================================================== --- trunk/Z_poAddLanguage.php 2014-06-22 14:45:35 UTC (rev 6771) +++ trunk/Z_poAddLanguage.php 2014-06-22 21:30:22 UTC (rev 6772) @@ -16,21 +16,24 @@ } -$Title = _('New Language'); - +$Title = _('New Language');// _('Add a New Language to the System') +$ViewTopic = "SpecialUtilities"; +$BookMark = "Z_poAddLanguage";// Anchor's id in the manual's html document. include('includes/header.inc'); +echo '<p class="page_title_text"><img alt="" src="' . $RootPath . '/css/' . $Theme . + '/images/maintenance.png" title="' . + _('Add a New Language to the System') . '" />' . ' ' . + _('Add a New Language to the System') . '</p>'; -$DefaultLanguage = 'en_GB'; // the default language IS English ... +/* Your webserver user MUST have read/write access to here, otherwise you'll be wasting your time */ -/* Your webserver user MUST have read/write access to here, - otherwise you'll be wasting your time */ - -$PathToDefault = './locale/' . $DefaultLanguage . '/LC_MESSAGES/messages.po'; - -echo "<br /> <a href='" . $RootPath . "/Z_poAdmin.php'>" . _('Back to the translation menu') . "</a>"; +echo '<br /> <a href="' . $RootPath . '/Z_poAdmin.php">' . _('Back to the translation menu') . '</a>'; echo '<br /><br /> ' . _('Utility to create a new language file'); echo '<br /> ' . _('Current language is') . ' ' . $_SESSION['Language']; +$DefaultLanguage = 'en_GB';// The default language is English-United Kingdom (British English). +$PathToDefault = './locale/' . $DefaultLanguage . '/LC_MESSAGES/messages.po'; + if (isset($_POST['submit']) AND isset($_POST['NewLanguage'])) { if(mb_strlen($_POST['NewLanguage'])<5 @@ -96,4 +99,4 @@ include('includes/footer.inc'); -?> \ No newline at end of file +?> Modified: trunk/Z_poAdmin.php =================================================================== --- trunk/Z_poAdmin.php 2014-06-22 14:45:35 UTC (rev 6771) +++ trunk/Z_poAdmin.php 2014-06-22 21:30:22 UTC (rev 6772) @@ -6,12 +6,16 @@ //$PageSecurity = 15; include ('includes/session.inc'); - -$Title = _('UTILITY PAGE') . ' ' . _('that helps maintain language files'); - +$Title = _('UTILITY PAGE') . ' ' . _('that helps maintain language files');// _('Maintain Language Files') +$ViewTopic = "SpecialUtilities"; +$BookMark = "Z_poAdmin";// Anchor's id in the manual's html document. include('includes/header.inc'); +echo '<p class="page_title_text"><img alt="" src="' . $RootPath . '/css/' . $Theme . + '/images/maintenance.png" title="' . + _('Maintain Language Files') . '" />' . ' ' . + _('Maintain Language Files') . '</p>'; -/* check if we have gettext - we're useless without it ... */ +/* Check if we have gettext - we're useless without it... */ if (!function_exists('gettext')){ prnMsg (_('gettext is not installed on this system') . '. ' . _('You cannot use the language files without it'),'error'); @@ -20,9 +24,7 @@ if (!is_writable('./locale/' . $_SESSION['Language'])) { prnMsg(_('You do not have write access to the required files please contact your system administrator'),'error'); -} -else -{ +} else { echo '<p><a href="' . $RootPath . '/Z_poRebuildDefault.php?' . SID . '">' . _('Rebuild the System Default Language File') . '</a>'; echo '<p><a href="' . $RootPath . '/Z_poAddLanguage.php?' . SID . '">' . _('Add a New Language to the System') . '</a>'; echo '<p><a href="' . $RootPath . '/Z_poEditLangHeader.php?' . SID . '">' . _('Edit a Language File Header') . '</a>'; @@ -33,5 +35,4 @@ } include('includes/footer.inc'); - ?> Modified: trunk/Z_poEditLangHeader.php =================================================================== --- trunk/Z_poEditLangHeader.php 2014-06-22 14:45:35 UTC (rev 6771) +++ trunk/Z_poEditLangHeader.php 2014-06-22 21:30:22 UTC (rev 6772) @@ -1,5 +1,4 @@ <?php - /* $Id$ */ /* Steve Kitchen */ @@ -7,15 +6,18 @@ //$PageSecurity = 15; include ('includes/session.inc'); - -$Title = _('Edit Header'); - +$Title = _('Edit Header');// _('Edit a Language File Header') +$ViewTopic = "SpecialUtilities"; +$BookMark = "Z_poEditLangHeader";// Anchor's id in the manual's html document. include('includes/header.inc'); +echo '<p class="page_title_text"><img alt="" src="' . $RootPath . '/css/' . $Theme . + '/images/maintenance.png" title="' . + _('Edit a Language File Header') . '" />' . ' ' . + _('Edit a Language File Header') . '</p>'; -/* Your webserver user MUST have read/write access to here, - otherwise you'll be wasting your time */ +/* Your webserver user MUST have read/write access to here, otherwise you'll be wasting your time */ -echo "<br /> <a href='" . $RootPath . "/Z_poAdmin.php'>" . _('Back to the translation menu') . "</a>"; +echo '<br /> <a href="' . $RootPath . '/Z_poAdmin.php">' . _('Back to the translation menu') . '</a>'; echo '<br /><br /> ' . _('Utility to edit a language file header'); echo '<br /> ' . _('Current language is') . ' ' . $_SESSION['Language']; Modified: trunk/Z_poEditLangModule.php =================================================================== --- trunk/Z_poEditLangModule.php 2014-06-22 14:45:35 UTC (rev 6771) +++ trunk/Z_poEditLangModule.php 2014-06-22 21:30:22 UTC (rev 6772) @@ -1,5 +1,4 @@ <?php - /* $Id$ */ /* Steve Kitchen */ @@ -9,23 +8,26 @@ //$PageSecurity = 15; include ('includes/session.inc'); - -$Title = _('Edit Module'); - +$Title = _('Edit Module');// _('Edit a Language File Module') +$ViewTopic = "SpecialUtilities"; +$BookMark = "Z_poEditLangModule";// Anchor's id in the manual's html document. include('includes/header.inc'); +echo '<p class="page_title_text"><img alt="" src="' . $RootPath . '/css/' . $Theme . + '/images/maintenance.png" title="' . + _('Edit a Language File Module') . '" />' . ' ' . + _('Edit a Language File Module') . '</p>'; -/* Your webserver user MUST have read/write access to here, - otherwise you'll be wasting your time */ +/* Your webserver user MUST have read/write access to here, otherwise you'll be wasting your time */ -$PathToLanguage = './locale/' . $_SESSION['Language'] . '/LC_MESSAGES/messages.po'; -$PathToNewLanguage = './locale/' . $_SESSION['Language'] . '/LC_MESSAGES/messages.po.new'; - echo '<br /> <a href="' . $RootPath . '/Z_poAdmin.php">' . _('Back to the translation menu') . '</a>'; echo '<br /><br /> ' . _('Utility to edit a language file module'); echo '<br /> ' . _('Current language is') . ' ' . $_SESSION['Language']; echo '<br /><br /> ' . _('To change language click on the user name at the top left, change to language desired and click Modify'); echo '<br /> ' . _('Make sure you have selected the correct language to translate!'); +$PathToLanguage = './locale/' . $_SESSION['Language'] . '/LC_MESSAGES/messages.po'; +$PathToNewLanguage = './locale/' . $_SESSION['Language'] . '/LC_MESSAGES/messages.po.new'; + if (isset($_POST['ReMergePO'])){ /*update the messages.po file with any new strings */ Modified: trunk/Z_poEditLangRemaining.php =================================================================== --- trunk/Z_poEditLangRemaining.php 2014-06-22 14:45:35 UTC (rev 6771) +++ trunk/Z_poEditLangRemaining.php 2014-06-22 21:30:22 UTC (rev 6772) @@ -1,5 +1,4 @@ <?php - /* $Id$ */ /* Steve Kitchen */ @@ -10,22 +9,25 @@ include ('includes/session.inc'); -$Title = _('Edit Remaining Items'); - +$Title = _('Edit Remaining Items');// _('Edit Remaining Strings For This Language') +$ViewTopic = "SpecialUtilities"; +$BookMark = "Z_poEditLangRemaining";// Anchor's id in the manual's html document. include('includes/header.inc'); +echo '<p class="page_title_text"><img alt="" src="' . $RootPath . '/css/' . $Theme . + '/images/maintenance.png" title="' . + _('Edit Remaining Strings For This Language') . '" />' . ' ' . + _('Edit Remaining Strings For This Language') . '</p>'; -/* Your webserver user MUST have read/write access to here, - otherwise you'll be wasting your time */ +/* Your webserver user MUST have read/write access to here, otherwise you'll be wasting your time */ -$PathToLanguage = './locale/' . $_SESSION['Language'] . '/LC_MESSAGES/messages.po'; -$PathToNewLanguage = './locale/' . $_SESSION['Language'] . '/LC_MESSAGES/messages.po.new'; - -echo "<br /> <a href='" . $RootPath . "/Z_poAdmin.php'>" . _('Back to the translation menu') . "</a>"; +echo '<br /> <a href="' . $RootPath . '/Z_poAdmin.php">' . _('Back to the translation menu') . '</a>'; echo '<br /><br /> ' . _('Utility to edit a language file module'); echo '<br /> ' . _('Current language is') . ' ' . $_SESSION['Language']; +$PathToLanguage = './locale/' . $_SESSION['Language'] . '/LC_MESSAGES/messages.po'; +$PathToNewLanguage = './locale/' . $_SESSION['Language'] . '/LC_MESSAGES/messages.po.new'; - $PathToLanguage_mo = mb_substr($PathToLanguage,0,strrpos($PathToLanguage,'.')) . '.mo'; +$PathToLanguage_mo = mb_substr($PathToLanguage,0,strrpos($PathToLanguage,'.')) . '.mo'; /* now read in the language file */ Modified: trunk/Z_poRebuildDefault.php =================================================================== --- trunk/Z_poRebuildDefault.php 2014-06-22 14:45:35 UTC (rev 6771) +++ trunk/Z_poRebuildDefault.php 2014-06-22 21:30:22 UTC (rev 6772) @@ -1,33 +1,42 @@ <?php -/* $Id$*/ +/* $Id$*/ +/* This script runs xgettext on the sources to produce a .pot (Portable Object + Template) file, which contains a list of all the translatable strings + extracted from the sources. The resultant system default language file + (.pot file) is saved in the .../locale/en_GB.utf8/LC_MESSAGES/messages.po + path. Note: Comments (starting with ///) placed directly before strings + thus marked are made available as hints to translators by helper programs. */ /* Steve Kitchen */ //$PageSecurity = 15; include ('includes/session.inc'); +$Title = _('Rebuild');//_('Rebuild the System Default Language File') +$ViewTopic = "SpecialUtilities"; +$BookMark = "Z_poRebuildDefault";// Anchor's id in the manual's html document. +include('includes/header.inc'); +echo '<p class="page_title_text"><img alt="" src="' . $RootPath . '/css/' . $Theme . + '/images/maintenance.png" title="' . + _('Rebuild the System Default Language File') . '" />' . ' ' . + _('Rebuild the System Default Language File') . '</p>'; -$Title = _('Rebuild'); +/* Your webserver user MUST have read/write access to here, otherwise you'll be wasting your time */ -include('includes/header.inc'); +echo '<br /> <a href="' . $RootPath . '/Z_poAdmin.php">' . _('Back to the translation menu') . '</a>'; +echo '<br /><br /> ' . _('Utility page to rebuild the system default language file'); -/* Your webserver user MUST have read/write access to here, - otherwise you'll be wasting your time */ - -$PathToDefault = './locale/en_GB.utf8/LC_MESSAGES/messages.po'; +$PathToDefault = './locale/en_GB.utf8/LC_MESSAGES/messages.po'; $FilesToInclude = '*.php includes/*.inc includes/*.php api/*.php reportwriter/languages/en_US/reports.php'; -$xgettextCmd = 'xgettext --no-wrap --from-code=utf-8 -L php -o ' . $PathToDefault . ' ' . $FilesToInclude; +$xgettextCmd = 'xgettext --no-wrap --from-code=utf-8 -L php -o ' . $PathToDefault . ' ' . $FilesToInclude; -echo "<br /> <a href='" . $RootPath . "/Z_poAdmin.php'>" . _('Back to the translation menu') . "</a>"; -echo '<br /><br /> ' . _('Utility page to rebuild the system default language file'); - if (isset($_POST['submit'])) { echo '<br /><table><tr><td>'; echo '<form method="post" action=' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '?' . SID . '>'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; -/* Run xgettext to recreate the default message.po language file */ + /// Run xgettext to recreate the default message.po language file. prnMsg (_('Rebuilding the default language file ') . '.....<br />', 'info', ' '); @@ -39,8 +48,10 @@ echo '</form>'; echo '</td></tr></table>'; -} else { /* set up the page for editing */ +} else { + /* set up the page for editing */ + echo '<div class="centre">'; echo '<br />'; prnMsg (_('Every new language creates a new translation file from the system default one') . '.<br />' . @@ -58,5 +69,4 @@ } include('includes/footer.inc'); - ?> Modified: trunk/doc/Manual/ManualSpecialUtilities.html =================================================================== --- trunk/doc/Manual/ManualSpecialUtilities.html 2014-06-22 14:45:35 UTC (rev 6771) +++ trunk/doc/Manual/ManualSpecialUtilities.html 2014-06-22 21:30:22 UTC (rev 6772) @@ -29,3 +29,55 @@ <h2>Repost General Ledger from Period</h2> <p>This script Z_RePostGLFromPeriod.php clears the actual data in the table ChartDetails - that contains the movements in each GL account, the movements are then re-calculated by setting all GLTrans to unposted and re-running the posting of all these transactions. This is a desperate measure that should only be undertaken in an extreme situation. Maybe a corrupt database or system crash etc that caused an out of balance trial balance.</p> + +<h2><a id="Z_poAdmin">Maintain Language Files</a></h2> + +<p>We use <b>gettext</b> as the internationalization and localization (i18n) system to write a multilingual program. The most commonly used implementation of gettext is GNU gettext, released by the GNU Project in 1995 as a free software implementation of the system.</p> + +<p>Source code is first modified to use the GNU gettext calls. This is done by wrapping strings that the user will see in the gettext function. To save typing time, and to reduce code clutter, this function is commonly aliased to _, so that the PHP code:</p> + +<div class="centre"> + <pre>echo <b>gettext</b>('<i>Maintain Language Files</i>');</pre> +</div> + +<p>would become:</p> + +<div class="centre"> + <pre>echo <b>_</b>('<i>Maintain Language Files</i>');</pre> +</div> + +<p>Comments (starting with <b>///</b>) placed directly before strings thus marked are made available as hints to translators by helper programs.</p> + +<!-- +To do: Add more information about the translation workflow. e.g. "This script should be run by developers when there are changes in the strings that the user will see." +--> + +<h3><a id="Z_poRebuildDefault">Rebuild the System Default Language File</a></h3> + +<p>This script <b>Z_poRebuildDefault.php</b> runs <b>xgettext</b> on the sources to produce a .pot (<i><b>P</b>ortable <b>O</b>bject <b>T</b>emplate</i>) file, which contains a list of all the translatable strings extracted from the sources. The resultant system default language file (.pot file) is saved in the <b>.../locale/en_GB.utf8/LC_MESSAGES/messages.po</b> path.</p> + +<h3><a id="Z_poAddLanguage">Add a New Language to the System</a></h3> + +<p>This script <b>Z_poAddLanguage.php</b> adds a new language to the system, by creating a new language file (.po file) from the system default language file (.pot file).</p> + +<p>.</p><!-- To do: Add more information about this script. e.g. "This script should be run by developers when..."--> + +<h3><a id="Z_poEditLangHeader">Edit a Language File Header</a></h3> + +<p>.</p><!-- To do: Add more information about this script. e.g. "This script should be run by developers when..."--> + +<h3><a id="Z_poEditLangModule">Edit a Language File Module</a></h3> + +<p>.</p><!-- To do: Add more information about this script. e.g. "This script should be run by developers when..."--> + +<h3><a id="Z_poEditLangRemaining">Edit Remaining Strings For This Language</a></h3> + +<p>.</p><!-- To do: Add more information about this script. e.g. "This script should be run by developers when..."--> + +<h3><a id="Z_poDownloadPoFile">Download messages.po file</a></h3> + +<p>.</p><!-- To do: Add more information about this script. e.g. "This script should be run by developers when..."--> + +<h3><a id="Z_poDownloadMoFile">Download messages.mo file</a></h3> + +<p>.</p><!-- To do: Add more information about this script. e.g. "This script should be run by developers when..."--> |