- modules/fotolab updated imagej to current version & some cod fixes to make it work
[care2x.git] / Care2007 / modules / weberp / Z_poAddLanguage.php
blob47203a4d812b2ec75909373f17a2e5db0d478763
1 <?php
2 /* $Revision: 1.4 $ */
4 /* Steve Kitchen/Kaill */
6 $PageSecurity = 15;
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);
15 exit;
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>&nbsp;<A HREF='" . $rootpath . "/Z_poAdmin.php'>" . _('Back to the translation menu') . "</A>";
31 echo '<BR><BR>&nbsp;' . _('Utility to create a new language file');
32 echo '<BR>&nbsp;' . _('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');
41 } else {
43 /*Make sure the language characters are in upper case*/
45 $_POST['NewLanguage'] = substr($_POST['NewLanguage'],0,3) . strtoupper(substr($_POST['NewLanguage'],3,2));
47 echo '<CENTER>';
48 echo '<BR>';
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');
58 } else {
59 prnMsg(_('This language cannot be added because it already exists!'),'error');
60 echo '</FORM>';
61 echo '</CENTER>';
62 include('includes/footer.inc');
63 exit;
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');
71 echo '</FORM>';
72 echo '</CENTER>';
73 include('includes/footer.inc');
74 exit;
80 echo '<CENTER>';
81 echo '<BR>';
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'));
84 echo '<BR>';
85 echo '<FORM METHOD="post" ACTION=' . $_SERVER['PHP_SELF'] . '?' . SID . '>';
87 echo '<TABLE><TR>';
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') . '">&nbsp;&nbsp;&nbsp;&nbsp;';
93 echo '</FORM>';
94 echo '</CENTER>';
96 include('includes/footer.inc');