Skip to content

cilogon/service

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CILogon Service Web Front-end

Scrutinizer Code Quality NSF-1547268

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.

Requirements

The following versions of PHP are supported.

  • PHP 8.0
  • PHP 8.1
  • PHP 8.2
  • PHP 8.3

Installation

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

Internationalization Support

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:

  1. Ensure that this repository and the service-lib repository are cloned to the same directory, e.g., ~/service and ~/service-lib. This step is necessary for PHP Composer to use the latest service-lib code in GitHub.
  2. Ensure the PHP composer command is installed.
  3. Log in to AWS from the command line (see aws-cli-setup for help).
  4. Run php gettext_php_to_po.php .
  5. Commit any updated cilogon.po files to GitHub, e.g., locale/en_US/LC_MESSAGES/cilogon.po .

Notes:

  • The cilogon.po files are "human readable". These are files that would typically be given to human translators to translate each text string line-by-line. The gettext_php_to_po.php script 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 the gettext_php_to_po.php script 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 .po files. The associated cilogon.mo files 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.php script, but also adding the associated glibc-langpack-LANG package in the Dockerfile so the locale is available to the operating system.

License

The University of Illinois/NCSA Open Source License (NCSA). Please see License File for more information.

About

CILogon Service Web Front-end

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •