4 /* Steve Kitchen/Kaill */
8 include ('includes/session.inc');
10 /* Was the Cancel button pressed the last time through ? */
12 if (isset($_POST['cancel'])) {
14 header ('Location:' . $rootpath . '/Z_poAdmin.php?' . SID
);
19 $title = _('New Language');
21 include('includes/header.inc');
23 $DefaultLanguage = 'en_GB'; // the default language IS English ...
25 /* Your webserver user MUST have read/write access to here,
26 otherwise you'll be wasting your time */
28 $PathToDefault = './locale/' . $DefaultLanguage . '/LC_MESSAGES/messages.po';
30 echo "<BR> <A HREF='" . $rootpath . "/Z_poAdmin.php'>" . _('Back to the translation menu') . "</A>";
31 echo '<BR><BR> ' . _('Utility to create a new language file');
32 echo '<BR> ' . _('Current language is') . ' ' . $_SESSION['Language'];
34 if (isset($_POST['submit']) AND isset($_POST['NewLanguage'])) {
36 if(strlen($_POST['NewLanguage'])<5
37 OR strlen($_POST['NewLanguage'])>5
38 OR substr($_POST['NewLanguage'],2,1)!='_'){
40 prnMsg(_('Languages must be in the format of a two character country code an underscore _ and a two character language code in upper case'),'error');
43 /*Make sure the language characters are in upper case*/
45 $_POST['NewLanguage'] = substr($_POST['NewLanguage'],0,3) . strtoupper(substr($_POST['NewLanguage'],3,2));
49 echo '<FORM METHOD="post" ACTION=' . $_SERVER['PHP_SELF'] . '?' . SID
. '>';
52 /* check for directory existence */
54 if (!file_exists('./locale/' . $_POST['NewLanguage'])) {
55 prnMsg (_('Attempting to create the new language file') . '.....<BR>', 'info', ' ');
56 $Result = mkdir('./locale/' . $_POST['NewLanguage']);
57 $Result = mkdir('./locale/' . $_POST['NewLanguage'] . '/LC_MESSAGES');
59 prnMsg(_('This language cannot be added because it already exists!'),'error');
62 include('includes/footer.inc');
66 $PathToNewLanguage = './locale/' . $_POST['NewLanguage'] . '/LC_MESSAGES/messages.po';
67 $Result = copy($PathToDefault, $PathToNewLanguage);
69 prnMsg (_('Done. You should now change to your newly created language from the user settings link above. Then you can edit the new language file header and use the language module editor to translate the system strings'), 'info');
73 include('includes/footer.inc');
82 prnMsg (_('This utility will create a new language and a new language translation file for it from the system default') . '<BR><BR>' .
83 _('If the language already exists then you cannot recreate it'), 'info', _('PLEASE NOTE'));
85 echo '<FORM METHOD="post" ACTION=' . $_SERVER['PHP_SELF'] . '?' . SID
. '>';
88 echo '<TD>' . _('Full code of the new language in the format en_US') . '</TD>';
89 echo '<TD><INPUT TYPE="text" SIZE="5" NAME="NewLanguage">';
90 echo '</TD></TR></TABLE>';
92 echo '<BR><INPUT TYPE="Submit" NAME="submit" VALUE="' . _('Proceed') . '"> ';
96 include('includes/footer.inc');