From e431dc96e3d1221295b71baeaa992023ff3ec298 Mon Sep 17 00:00:00 2001 From: Cyril Giraud Date: Wed, 22 Oct 2014 22:14:48 +0200 Subject: [PATCH] Issue #20: Code modification to make some strings translatable. --- htdocs/iSchedule.php | 48 +++++++++++------- htdocs/index.php | 118 ++++++++++++++++++++++++++++--------------- htdocs/setup.php | 39 +++++++------- 3 files changed, 128 insertions(+), 77 deletions(-) diff --git a/htdocs/iSchedule.php b/htdocs/iSchedule.php index d6273f16..1eb94e2b 100644 --- a/htdocs/iSchedule.php +++ b/htdocs/iSchedule.php @@ -8,26 +8,37 @@ include("interactive-page.php"); require_once("AwlQuery.php"); require_once('iSchedule.php'); + +$heading_schedule = translate('iSchedule Configuration'); +$content_sched1 = translate('iSchedule allows caldav servers to communicate directly with each other, bypassing the need to send invitations via email, for scheduled events where attendees are using different servers or providers. Additionally it enables freebusy lookups for remote attendees. Events and ToDos received via iSchedule will show up in the users scheduling inbox.'); +$content_sched2 = translate('The iSchedule configuration requires a few DNS entries. DNS SRV record(s) will need to be created for all domains you wish to accept requests for, these are the domain portion of email address on Principal records in DAViCal examples are listed below for domains found in your database. At least 1 public key must also be published if you wish to send requests from this server.'); + + $page_elements = array(); $page_elements[] = <<iSchedule Configuration -

iSchedule allows caldav servers to communicate directly with each other, bypassing the need to send invitations via email, for scheduled events where attendees are using different servers or providers. Additionally it enables freebusy lookups for remote attendees. Events and ToDos received via iSchedule will show up in the users scheduling inbox. -
  -

-

The iSchedule configuration requires a few DNS entries. DNS SRV record(s) will need to be created for all domains you wish to accept requests for, these are the domain portion of email address on Principal records in DAViCal examples are listed below for domains found in your database. At least 1 public key must also be published if you wish to send requests from this server.

+

$heading_schedule

+

$content_sched1

+


 

+

$content_sched2

EOBODY; -$status = '

Status

'; +$translated_error = translate('ERROR'); +$translated_err1 = translate('scheduling_dkim_domain not set (please check your DAViCal configuration file)'); + +$translated_warning = translate('WARNING'); +$translated_war1 = translate('scheduling_dkim_domain does not match server name (please check your DAViCal configuration file)'); + +$status = '

' . translate('Status') . '

'; if (!isset($c->scheduling_dkim_domain)) { $status .= <<ERROR -

scheduling_dkim_domain not set

+
$translated_error
+

$translated_err1

EOBODY; } elseif ( $c->scheduling_dkim_domain != $_SERVER['SERVER_NAME'] ) { $status .= <<WARNING -

scheduling_dkim_domain does not match server name

+
$translated_warning
+

$translated_war1

EOBODY; } else { @@ -42,30 +53,29 @@ function checkiSchedule () { $s = new iSchedule (); $s->domain = $c->scheduling_dkim_domain; if (!$s->getServer()) - $ret .= '

SRV record missing for '. $s->domain .' or DNS failure, the domain you are going to send events from should have an SRV record

' ; + $ret .= '

' . sprintf(translate('SRV record missing for "%s" or DNS failure, the domain you are going to send events from should have an SRV record'), $s->domain) . '

'; if ($s->remote_server != $c->scheduling_dkim_domain) - $ret .= '

SRV record for '.$s->domain . ' points to wrong domain: ' . $s->remote_server . ' instead of ' . $c->scheduling_dkim_domain .'

'; + $ret .= '

' . sprintf(translate('SRV record for "%s" points to wrong domain: "%s" instead of "%s"'), $s->domain, $s->remote_server, $c->scheduling_dkim_domain) . '

'; $s->remote_server = $c->scheduling_dkim_domain; $s->remote_selector = $c->scheduling_dkim_selector; if (!$s->getTxt()) { if (isset($c->schedule_private_key)) - $ret .= '

TXT record missing for '.$s->remote_selector . '._domainkey.' . $s->domain .' or DNS failure, Private RSA key is configured

' ; + $ret .= '

' . translate('TXT record missing for "%s._domainkey.%s" or DNS failure, Private RSA key is configured', $s->remote_selector, $s->domain) . '

'; else { $keys = generateKeys(); - $config = '

please add the following section to your DAViCal configuration file

$c->schedule_private_key = <<<ENDOFKEY' ."\n";
+      $config = '

' . translate('please add the following section to your DAViCal configuration file') . '

$c->schedule_private_key = <<<ENDOFKEY' . "\n";
       $config .= $keys['private']; //implode ("\n", str_split ( base64_encode ( $keys['private'] ), 64 ));
       $config .= "ENDOFKEY\n
"; - $config .= "
and create a DNS TXT record for " . $c->scheduling_dkim_selector . "._domainkey." . $c->scheduling_dkim_domain ; - $config .= " that contains:
";
-      $config .= "k=rsa; t=s; p=" . preg_replace('/-----(BEGIN|END) PUBLIC KEY-----\n/','',$keys['public']);
+      $config .= "
" . sprintf(translate('and create a DNS TXT record for %s._domainkey.%s that contains:'), $c->scheduling_dkim_selector, $c->scheduling_dkim_domain); + $config .= "
k=rsa; t=s; p=" . preg_replace('/-----(BEGIN|END) PUBLIC KEY-----\n/','',$keys['public']);
       $config .= '

'; $ret .= $config; } } if ( ! $s->parseTxt() ) - $ret .= '

TXT record corrupt for '. $s->remote_selector .'._domainkey.'. $s->domain .' or DNS failure

' ; + $ret .= '

' . sprintf(translate('TXT record corrupt for %s._domainkey.%s or DNS failure'), $s->remote_selector, $s->domain) . '

'; else if ( $ret == '' ) - $ret = '

iSchedule OK

'; + $ret = '

' . translate('iSchedule OK') . '

'; return $ret; } diff --git a/htdocs/index.php b/htdocs/index.php index 782578e1..cfa136ee 100644 --- a/htdocs/index.php +++ b/htdocs/index.php @@ -14,48 +14,84 @@ $session->LoginRequired(); include("interactive-page.php"); include("page-header.php"); +$heading_admin = translate('Administration'); +$content_admin = sprintf(translate('You are logged on as %s (%s)', $session->username, $session->fullname)); + +$heading_functions = translate('Administration Functions'); +$content_func1 = translate('The administration of this application should be fairly simple. You can administer:'); +$content_func2 = translate('Users (or Resources or Groups) and the relationships between them'); +$content_func3 = translate('The types of relationships that are available'); +$content_func4 = translate('There is no ability to view and / or maintain calendars or events from within this administrative interface.'); +$content_func5 = translate('To do that you will need to use a CalDAV capable calendaring application such as Evolution, Sunbird, Thunderbird (with the Lightning extension) or Mulberry.'); + +$heading_principals = translate('Principals: Users, Resources and Groups'); +$content_princ1 = translate('These are the things which may have collections of calendar resources (i.e. calendars).'); +$content_princ2 = sprintf('%s. %s', +$c->base_url, +translate('Here is a list of users (maybe :-)'), +translate("You can click on any user to see the full detail +for that person (or group or resource - but from now we'll just call them users).") +); +$content_princ3 = translate('The primary differences between them are as follows:'); +$content_princ4 = translate('Users will probably have calendars, and are likely to also log on to the system.'); +$content_princ5 = translate('Resources do have calendars, but they will not usually log on.'); +$content_princ6 = translate('Groups provide an intermediate linking to minimise administration overhead. They might not have calendars, and they will not usually log on.'); +$content_princ7 = translate('Users will probably have calendars, and are likely to also log on to the system.'); + +$heading_groups = translate('Groups & Grants'); +$content_grp1 = translate('Grants specify the access rights to a collection or a principal'); +$content_grp2 = translate('Groups allow those granted rights to be assigned to a set of many principals in one action'); +$content_grp3 = translate('Groups may be members of other groups, but complex nesting will hurt system performance'); + +// Translations shared with setup.php +$heading_clients = translate('Configuring Calendar Clients for DAViCal'); +$content_cli1 = translate('The client setup page on the DAViCal website has information on how to configure Evolution, Sunbird, Lightning and Mulberry to use remotely hosted calendars.'); +$content_cli2 = translate('The administrative interface has no facility for viewing or modifying calendar data.'); + +// Translations shared with setup.php +$heading_configure = translate('Configuring DAViCal'); +$content_config1 = translate('If you can read this then things must be mostly working already.'); +$content_config3 = translate('The DAViCal installation page on the DAViCal website has some further information on how to install and configure this application.'); + + echo <<Administration -

You are logged on as $session->username ($session->fullname)

+

$heading_admin

+

$content_admin

+ +

$heading_functions

+

$content_func1

+
    +
  • $content_func2
  • +
  • $content_func3
  • +
+

$content_func4

+

$content_func5

+ +

$heading_principals

+

$content_princ1

+

$content_princ2

+

$content_princ3

+
    +
  • $content_princ4
  • +
  • $content_princ5
  • +
  • $content_princ6
  • +
+ +

$heading_groups

+
    +
  • $content_grp1
  • +
  • $content_grp2
  • +
  • $content_grp3
  • +
+ +

$heading_clients

+

$content_cli1

+

$content_cli2

+ +

$heading_configure

+

$content_config1

+

$content_config3

+ EOBODY; -?> -

Administration Functions

-

The administration of this application should be fairly simple. You can administer:

-
    -
  • Users (or Resources or Groups) and the relationships between them
  • -
  • The types of relationships that are available
  • -
-

There is no ability to view and / or maintain calendars or events from within this administrative interface.

-

To do that you will need to use a CalDAV capable calendaring application such as Evolution, Sunbird, Thunderbird -(with the Lightning extension) or Mulberry.

-

Principals: Users, Resources and Groups

-

These are the things which may have collections of calendar resources (i.e. calendars).

-

Here is a list of users (maybe :-). You can click on any user to see the full detail -for that person (or group or resource - but from now we'll just call them users).

-

The primary differences between them are as follows:

-
    -
  • Users will probably have calendars, and are likely to also log on to the system.
  • -
  • Resources do have calendars, but they will not usually log on.
  • -
  • Groups provide an intermediate linking to minimise administration overhead. They might not have calendars, and they will not usually log on.
  • -
- -

Groups & Grants

-
    -
  • Grants specify the access rights to a collection or a principal
  • -
  • Groups allow those granted rights to be assigned to a set of many principals in one action
  • -
  • Groups may be members of other groups, but complex nesting will hurt system performance
  • -
- -

Configuring Calendar Clients for DAViCal

-

The DAViCal client setup page on sourceforge have information on how -to configure Evolution, Sunbird, Lightning and Mulberry to use remotely hosted calendars.

-

The administrative interface has no facility for viewing or modifying calendar data.

- -

Configuring DAViCal

-

If you can read this then things must be mostly working already.

-

The DAViCal installation page on sourceforge has -some further information on how to install and configure this application.

- -authenticate_hook) && isset($c->authenticate_hook['call']) && $c->authenticate_hook['call'] == 'LDAP_check') { $dependencies[translate('PHP LDAP module available')] = 'check_ldap'; } + + $translated_failure_code = translate('Explanation on DAViCal Wiki'); $dependencies_table = ''; $dep_tpl = ' %s %s - Explanation on DAViCal Wiki + $translated_failure_code '; foreach( $dependencies AS $k => $v ) { @@ -383,25 +385,28 @@ if ( check_database_connection()->GetOK() ) { $site_statistics_table = build_site_statistics(); } catch( Exception $e ) { - $site_statistics_table = "Statistics unavailable"; + $site_statistics_table = translate('Statistics unavailable'); } } else { - $site_statistics_table = "Statistics unavailable"; + $site_statistics_table = translate('Statistics unavailable'); } $heading_php_info = translate('PHP Information'); -$heading_config_clients = translate('Configuring Calendar Clients for DAViCal'); -$davical_client_page = translate('The client setup page on the DAViCal website has information on how to configure Evolution, Sunbird, Lightning and Mulberry to use remotely hosted calendars.'); -$davical_no_calendar_interface = translate('The administrative interface has no facility for viewing or modifying calendar data.'); -$heading_config_davical = translate('Configuring DAViCal'); -$davical_mostly_working = translate ('If you can read this then things must be mostly working already.'); -$davical_configuration_errors = ( $config_warnings == '' ? '' : '

' +// Translations shared with index.php +$heading_clients = translate('Configuring Calendar Clients for DAViCal'); +$content_cli1 = translate('The client setup page on the DAViCal website has information on how to configure Evolution, Sunbird, Lightning and Mulberry to use remotely hosted calendars.'); +$content_cli2 = translate('The administrative interface has no facility for viewing or modifying calendar data.'); + +// Translations shared with index.php +$heading_configure = translate('Configuring DAViCal'); +$content_config1 = translate('If you can read this then things must be mostly working already.'); +$content_config2 = ( $config_warnings == '' ? '' : '

' . translate('Your configuration produced PHP errors which should be corrected') . '

'
              . $config_warnings.'
' ); -$davical_installation_page = translate('The installation page on the DAViCal website has some further information on how to install and configure this application.'); +$content_config3 = translate('The DAViCal installation page on the DAViCal website has some further information on how to install and configure this application.'); echo <<

-

$heading_config_davical

-

$davical_mostly_working

-$davical_configuration_errors -

$davical_installation_page

+

$heading_configure

+

$content_config1

+$content_config2 +

$content_config3

-

$heading_config_clients

-

$davical_client_page

-

$davical_no_calendar_interface

+

$heading_clients

+

$content_cli1

+

$content_cli2

$heading_site_statistics

$site_statistics_table