Skip to content

Commit

Permalink
Updating translation calls to provide default translations
Browse files Browse the repository at this point in the history
  • Loading branch information
ScopeyNZ committed Jul 4, 2018
1 parent f134ca3 commit 8f0ac9c
Show file tree
Hide file tree
Showing 3 changed files with 93 additions and 32 deletions.
1 change: 0 additions & 1 deletion src/Authenticator/LoginForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,6 @@ protected function getFormActions()
'Label' => _t(
'RealMeLoginForm.ASSERTLOGINBUTTON',
'Share your details with {orgname}',
'',
['orgname' => $service->config()->metadata_organisation_display_name]
)
))->renderWith(self::class . '/RealMeLoginButton');
Expand Down
65 changes: 55 additions & 10 deletions src/RealMeService.php
Original file line number Diff line number Diff line change
Expand Up @@ -1096,43 +1096,88 @@ private function findErrorMessageForCode($errorCode)
break;

case self::ERR_TIMEOUT:
$message = _t('RealMeService.ERROR_TIMEOUT');
$message = _t('RealMeService.ERROR_TIMEOUT', 'Your RealMe session has timed out – please try again.');
break;

case self::ERR_INTERNAL_ERROR:
$message = _t('RealMeService.ERROR_INTERNAL');
$message = _t(
'RealMeService.ERROR_INTERNAL',
'RealMe was unable to process your request due to a RealMe internal error. Please try again. ' .
'If the problem persists, please contact the RealMe Help Desk. From New Zealand dial ' .
'0800 664 774 (toll free), from overseas dial +64 9 357 4468 (overseas call charges apply).'
);
break;

case self::ERR_NO_AVAILABLE_IDP:
$message = _t('RealMeService.ERROR_NOAVAILABLEIDP');
$message = _t(
'RealMeService.ERROR_NOAVAILABLEIDP',
'RealMe reported that the TXT service or the token service is not available. You may try again ' .
'later. If the problem persists, please contact the RealMe Help Desk. From New Zealand dial ' .
'0800 664 774 (toll free), from overseas dial +64 9 357 4468 (overseas call charges apply).'
);
break;

case self::ERR_REQUEST_UNSUPPORTED:
$message = _t('RealMeService.ERROR_REQUESTUNSUPPORTED');
$message = _t(
'RealMeService.ERROR_REQUESTUNSUPPORTED',
'RealMe reported a serious application error with the message \'Request Unsupported\'. Please try' .
' again later. If the problem persists, please contact the RealMe Help Desk. From New Zealand' .
': 0800 664 774 (toll free), from overseas dial +64 9 357 4468 (overseas call charges apply).'
);
break;

case self::ERR_NO_PASSIVE:
$message = _t('RealMeService.ERROR_NOPASSIVE');
$message = _t(
'RealMeService.ERROR_NOPASSIVE',
'RealMe reported a serious application error with the message \'No Passive\'. Please try again ' .
'later. If the problem persists, please contact the RealMe Help Desk. From New Zealand: 0800 ' .
'664 774 (toll free), from overseas dial +64 9 357 4468 (overseas call charges apply).'
);
break;

case self::ERR_REQUEST_DENIED:
$message = _t('RealMeService.ERROR_REQUESTDENIED');
$message = _t(
'RealMeService.ERROR_REQUESTDENIED',
'RealMe reported a serious application error with the message \'Request Denied\'. Please try ' .
'again later. If the problem persists, please contact the RealMe Help Desk. From New Zealand:' .
' 0800 664 774 (toll free), from overseas dial +64 9 357 4468 (overseas call charges apply).'
);
break;

case self::ERR_UNSUPPORTED_BINDING:
$message = _t('RealMeService.ERROR_UNSUPPORTEDBINDING');
$message = _t(
'RealMeService.ERROR_UNSUPPORTEDBINDING',
'RealMe reported a serious application error with the message \'Unsupported Binding\'. Please ' .
'try again later. If the problem persists, please contact the RealMe Help Desk. From New ' .
'Zealand: 0800 664 774 (toll free), from overseas dial +64 9 357 4468 (overseas call charges ' .
'apply).'
);
break;

case self::ERR_UNKNOWN_PRINCIPAL:
$message = _t('RealMeService.ERROR_UNKNOWNPRINCIPAL');
$message = _t(
'RealMeService.ERROR_UNKNOWNPRINCIPAL',
'You are unable to use RealMe to verify your identity if you do not have a RealMe account. ' .
'Visit the RealMe home page for more information and to create an account.'
);
break;

case self::ERR_NO_AUTHN_CONTEXT:
$message = _t('RealMeService.ERROR_NOAUTHNCONTEXT');
$message = _t(
'RealMeService.ERROR_NOAUTHNCONTEXT',
'RealMe reported a serious application error with the message \'No AuthN Context\'. Please try ' .
'again later. If the problem persists, please contact the RealMe Help Desk. From New Zealand:' .
' 0800 664 774 (toll free), from overseas dial +64 9 357 4468 (overseas call charges apply).'
);
break;

default:
$message = _t('RealMeService.ERROR_GENERAL');
$message = _t(
'RealMeService.ERROR_GENERAL',
'RealMe reported a serious application error. Please try again later. If the problem persists, ' .
'please contact the RealMe Help Desk. From New Zealand: 0800 664 774 (toll free), from ' .
'overseas dial +64 9 357 4468 (overseas call charges apply).'
);
break;
}

Expand Down
59 changes: 38 additions & 21 deletions src/Task/RealMeSetupTask.php
Original file line number Diff line number Diff line change
Expand Up @@ -256,8 +256,8 @@ private function validateEntityID($forEnv)
if (is_null($entityId)) {
$this->errors[] = _t(
self::class . '.ERR_CONFIG_NO_ENTITYID',
'No entityID specified for environment \'{env}\'. Specify this in your YML configuration, see the' .
' module documentation for more details',
'No entityID specified for environment \'{env}\'. Specify this in your YML configuration, see the ' .
'module documentation for more details',
array('env' => $forEnv)
);
}
Expand All @@ -268,8 +268,7 @@ private function validateEntityID($forEnv)
$this->errors[] = _t(
self::class . '.ERR_CONFIG_ENTITYID',
'The Entity ID (\'{entityId}\') must be https, not be \'localhost\', and must contain a valid ' .
'service name and privacy realm e.g. https://my-realme-integration.govt.nz/p-realm/s-name',
'',
'service name and privacy realm e.g. https://my-realme-integration.govt.nz/p-realm/s-name',
array(
'entityId' => $entityId
)
Expand All @@ -285,8 +284,7 @@ private function validateEntityID($forEnv)
$this->errors[] = _t(
self::class . '.ERR_CONFIG_ENTITYID',
'The Entity ID (\'{entityId}\') must be https, not be \'localhost\', and must contain a valid ' .
'service name and privacy realm e.g. https://my-realme-integration.govt.nz/p-realm/s-name',
'',
'service name and privacy realm e.g. https://my-realme-integration.govt.nz/p-realm/s-name',
array(
'entityId' => $entityId
)
Expand All @@ -307,8 +305,7 @@ private function validateEntityID($forEnv)
$this->errors[] = _t(
self::class . '.ERR_CONFIG_ENTITYID_SERVICE_NAME',
'The service name \'{serviceName}\' must be a maximum of 20 characters and not blank for entityID ' .
'\'{entityId}\'',
'',
'\'{entityId}\'',
array(
'serviceName' => $serviceName,
'entityId' => $entityId
Expand All @@ -322,7 +319,6 @@ private function validateEntityID($forEnv)
$this->errors[] = _t(
self::class . '.ERR_CONFIG_ENTITYID_PRIVACY_REALM',
'The privacy realm \'{privacyRealm}\' must not be blank for entityID \'{entityId}\'',
'',
array(
'privacyRealm' => $privacyRealm,
'entityId' => $entityId
Expand All @@ -344,7 +340,7 @@ private function validateAuthNContext()
$this->errors[] = _t(
self::class . '.ERR_CONFIG_NO_AUTHNCONTEXT',
'No AuthnContext specified for environment \'{env}\'. Specify this in your YML configuration, ' .
'see the module documentation for more details',
'see the module documentation for more details',
array('env' => $env)
);
}
Expand Down Expand Up @@ -398,12 +394,15 @@ private function validateRealMeEnvironments($forEnv)
private function validateDirectoryStructure()
{
if (is_null($this->service->getCertDir())) {
$this->errors[] = _t(self::class . '.ERR_CERT_DIR_MISSING');
$this->errors[] = _t(
self::class . '.ERR_CERT_DIR_MISSING',
'No certificate dir is specified. Define the REALME_CERT_DIR environment variable in your .env file'
);
} elseif (!$this->isReadable($this->service->getCertDir())) {
$this->errors[] = _t(
self::class . '.ERR_CERT_DIR_NOT_READABLE',
'',
'',
'Certificate dir specified (\'{dir}\') must be created and be readable. Ensure permissions are set ' .
'correctly and the directory is absolute',
array('dir' => $this->service->getCertDir())
);
}
Expand All @@ -415,20 +414,37 @@ private function validateDirectoryStructure()
private function validateMetadata()
{
if (is_null($this->service->getMetadataOrganisationName())) {
$this->errors[] = _t(self::class . '.ERR_CONFIG_NO_ORGANISATION_NAME');
$this->errors[] = _t(
self::class . '.ERR_CONFIG_NO_ORGANISATION_NAME',
'No organisation name is specified in YML configuration. Ensure the \'metadata_organisation_name\' ' .
'value is defined in your YML configuration'
);
}

if (is_null($this->service->getMetadataOrganisationDisplayName())) {
$this->errors[] = _t(self::class . '.ERR_CONFIG_NO_ORGANISATION_DISPLAY_NAME');
$this->errors[] = _t(
self::class . '.ERR_CONFIG_NO_ORGANISATION_DISPLAY_NAME',
'No organisation display name is specified in YML configuration. Ensure the ' .
'\'metadata_organisation_display_name\' value is defined in your YML configuration'
);
}

if (is_null($this->service->getMetadataOrganisationUrl())) {
$this->errors[] = _t(self::class . '.ERR_CONFIG_NO_ORGANISATION_URL');
$this->errors[] = _t(
self::class . '.ERR_CONFIG_NO_ORGANISATION_URL',
'No organisation URL is specified in YML configuration. Ensure the \'metadata_organisation_url\' ' .
'value is defined in your YML configuration'
);
}

$contact = $this->service->getMetadataContactSupport();
if (is_null($contact['company']) || is_null($contact['firstNames']) || is_null($contact['surname'])) {
$this->errors[] = _t(self::class . '.ERR_CONFIG_NO_SUPPORT_CONTACT');
$this->errors[] = _t(
self::class . '.ERR_CONFIG_NO_SUPPORT_CONTACT',
'Support contact detail is missing from YML configuration. Ensure the following values are defined ' .
'in the YML configuration: metadata_contact_support_company, metadata_contact_support_firstnames,' .
' metadata_contact_support_surname'
);
}
}

Expand All @@ -441,8 +457,8 @@ private function validateCertificates()
if (is_null($signingCertFile) || !$this->isReadable($signingCertFile)) {
$this->errors[] = _t(
self::class . '.ERR_CERT_NO_SIGNING_CERT',
'',
'',
'No SAML signing PEM certificate defined, or the file can\'t be read. Define the {const} environment ' .
'variable in your .env file, and ensure the file exists in the certificate directory',
array(
'const' => 'REALME_SIGNING_CERT_FILENAME'
)
Expand All @@ -451,8 +467,9 @@ private function validateCertificates()
// Signing cert exists, but doesn't include BEGIN/END CERTIFICATE lines, or doesn't contain the cert
$this->errors[] = _t(
self::class . '.ERR_CERT_SIGNING_CERT_CONTENT',
'',
'',
'The file specified for the signing certificate ({file}) does not contain a valid certificate ' .
'(beginning with -----BEGIN CERTIFICATE-----). Check this file to ensure it contains the ' .
'certificate and private key',
array('file' => $this->service->getSigningCertPath())
);
}
Expand Down

0 comments on commit 8f0ac9c

Please sign in to comment.