This package contains the CILogon Service Web Front-end.
This package is compliant with PSR-1, PSR-4 and PSR-12. If you notice compliance oversights, please send a patch via pull request.
The following versions of PHP are supported.
- PHP 8.0
- PHP 8.1
- PHP 8.2
- PHP 8.3
To install:
sudo -i
cd /var/www
git clone https://github.com/cilogon/service.git
ln -s service html
cd /var/www/html
sh README.txt
All text output to the user is wrapped by a gettext() ( shorthand _() )
function call. gettext enables the
text to be displayed in multiple languages by setting the
locale for the
program at runtime. While this is great for the user, it means that the
programmer must update translation files anytime a text string in the code is
changed or added. This is handled by the
gettext_php_to_po.php
script which generates cilogon.po (Portable Object) files (stored in the
locale subdirectory) for all configured languages. Anytime text in this
repository or in the
service-lib repository is updated,
the gettext_php_to_po.php
script must be re-run to generate updated cilogon.po files.
The target languages for translation are configured in the TARGET_LANGS
variable of the gettext_php_to_po.php script as follows;
define('TARGET_LANGS', array('en_US', 've_ZA', 'fr_FR', 'de_DE'));
Language values are 5 character strings consisting of a lower-case language code and an upper-case country code separated by an underscore (_).
en_US must ALWAYS be generated since it is the default. ve_ZA is a "just
for fun" translation that vertically flips the English text (upside down). All
other languages in the list are translated using the AWS Translate
API. Access to
this Translate API requires an authenticated user. For the sake of simplicity,
it is assumed that you are authenticating using aws login with assistance
from the aws-cli-setup repository.
To update the cilogon.po files, do the following:
- Ensure that this repository and the
service-lib repository are cloned
to the same directory, e.g.,
~/serviceand~/service-lib. This step is necessary for PHP Composer to use the latest service-lib code in GitHub. - Ensure the PHP
composercommand is installed. - Log in to AWS from the command line (see aws-cli-setup for help).
- Run
php gettext_php_to_po.php. - Commit any updated
cilogon.pofiles to GitHub, e.g.,locale/en_US/LC_MESSAGES/cilogon.po.
Notes:
- The
cilogon.pofiles are "human readable". These are files that would typically be given to human translators to translate each text string line-by-line. Thegettext_php_to_po.phpscript uses the AWS Translate API to generate the translated files. However, if the resulting translations are "not good", a human could update the "bad" translations by hand. In this case, care would need to be taken when updating/adding text in the future since re-running thegettext_php_to_po.phpscript would overwrite any manually translated strings. - At runtime, the locale is set to one of the available languages. However,
setlocale()requires.mo(machine object) files instead of.pofiles. The associatedcilogon.mofiles are generated by the gettext_po_to_mo.php script which is run during Docker image creation by the cilogon-web-docker repository. - Adding another translated language requires not only adding an entry to the
gettext_php_to_po.phpscript, but also adding the associatedglibc-langpack-LANGpackage in the Dockerfile so the locale is available to the operating system.
The University of Illinois/NCSA Open Source License (NCSA). Please see License File for more information.
