From: Phil D. <we...@pa...> - 2004-09-02 10:28:26
|
Gentlemen, I have been having a play with gettext and have it working - it needs to be enabled on your server.... if its not the system will product only english. The CVS has a couple of strings in the italian messages.po for the purposes I certainly would not vouch for the accuracy of the translations !! However, clearly shows that it is going to work brilliantly.... IF WE have the determination and staying power to convert every string assigment/print statement and echo statement in the whole system. Frankly, I am seriously daunted by the propsect and will not be able to do it on my own. A few points about the conversion ... Page $title = _('Page Title'); should also be encapsulated in the get text function. Single quotes ' are faster than double quotes " - PHP has to parse the contents of double quotes for variable substitutions but doesn't for single quotes. Strings that have variables in the middle and spaces or html tags need to be broken up ideally eg. echo "<P>A long string full of $NumberOfCharacters characters"; would need to be re-written as: echo '<P>' . _('A long string full of') . ' ' . $NumberOfCharacters . ' ' . _('characters'); I think it would be better to avoid having html or trailing spaces in the translation strings. Jessie Peterson made a modification to the DB_query function such that the repetitive use of if (DB_error_no($db) !=0) { ..... is no longer necessary - all you need to do is send DB_query the error message as the 3rd parameter, the 4th parameter is the Debug message and the 5th is whether the query is inside a transaction that should rollback. This might be a good opportunity to tidy up calls to DB_query to use these extra parameters too? This would take quite a bit of code out of the scripts. Some submit buttons have their value checked - clearly the value of a submit button - what is displayed on the face of it - will need to be inside a gettext function call - so too must the comparison string eg. say a submit button named 'Search' is tested to see if it is hit - the value of the button will need to be changed to the local language - assuming the button is to have a local language label.... if ($_POST['Search'] == _('Search Now')){ Steve's approach to "eating the elephant" seemed good - lets break it down to bite sized chunks .... I'll kick off with: AccountGroups.php AgedDebtors.php AgedSuppliers.php Areas.php BOMInquiry.php BOMListing.php Steve - would you have a go at: BOMs.php BankAccounts.php BankMatching.php BankReconciliation.php COGSGLPostings.php CompanyPreferences.php Luca - would you have a go at: ConfirmDispatchControlled_Invoice.php ConfirmDispatch_Invoice.php CreditItemsControlled.php CreditStatus.php Credit_Invoice.php Currencies.php Rom - would you have a go at: CustEDISetup.php CustWhereAlloc.php CustomerBranches.php CustomerInquiry.php CustomerReceipt.php CustomerTransInquiry.php The major worry here is introducing new bugs so please test the scripts individually and thoroughly before emailing me with them. Any other offers to help would be fantastic. Let me know if there are any other ideas or areas of ambiguity. If you need to see how to convert a script look at index.php or UserSettings.php Phil |