Commit 11878ca6 authored by Nigel McNie's avatar Nigel McNie Committed by Nigel McNie
Browse files

Added a whole bunch of language strings.

Changed the file_content_check script to ignore language strings with
variables in their name.
parent 459741b0
......@@ -55,4 +55,4 @@ $smarty->assign('pluginname', $pluginname);
$smarty->assign('type', $type);
$smarty->display('admin/plugins/pluginconfig.tpl');
?>
\ No newline at end of file
?>
......@@ -94,7 +94,7 @@ function uploadcsv_validate(Form $form, $values) {
}
if ($values['file']['size'] == 0) {
$form->set_error('file', get_string('thisfieldisrequired', 'admin'));
$form->set_error('file', $form->i18n('required'));
return;
}
......@@ -124,7 +124,7 @@ function uploadcsv_validate(Form $form, $values) {
return;
}
if (record_exists('usr', 'username', $username)) {
$form->set_error('file', get_string('uploadcsverroruseralreadyexists', 'admin', $i));
$form->set_error('file', get_string('uploadcsverroruseralreadyexists', 'admin', $i, $username));
return;
}
......
......@@ -27,7 +27,28 @@
defined('INTERNAL') || die();
$string['internal'] = 'Internal';
$string['emailalreadytaken'] = 'This e-mail address has already registered here';
$string['iagreetothetermsandconditions'] = 'I agree to the terms and conditions';
$string['passwordinvalidform'] = 'Your password must be at least six characters long and contain at least one digit and two letters';
$string['registeredemailsubject'] = 'You have registered at %s';
$string['registeredemailmessagetext'] = 'Congratulations!
You have successfully registered an account! Please follow this link to
complete the signup process:
' . get_config('wwwroot') . 'register.php?key=%s';
$string['registeredemailmessagehtml'] = '<p>Congratulations!</p>
<p>You have successfully registered an account! Please follow this link
to complete the signup process:</p>
<p><a href="' . get_config('wwwroot') . 'register.php?key=%s">'
. get_config('wwwroot') . 'register.php?key=%s</a></p>';
$string['registeredok'] = '<p>You have successfully registered. Please check your e-mail account for instructions on how to activate your account</p>';
$string['registrationnosuchkey'] = 'Sorry, there does not seem to be a registration with this key. Perhaps you waited longer than 24 hours to complete your registration? Otherwise, it might be our fault.';
$string['registrationunsuccessful'] = 'Sorry, your registration attempt was unsuccessful. This is our fault, not yours. Please try again later.';
$string['usernamealreadytaken'] = 'Sorry, this username is already taken';
$string['usernameinvalidform'] = 'Your username may only include alphanumeric characters, full stops, underscores and @ symbols. Also, it must be between 3 and 30 characters long.';
$string['youmaynotregisterwithouttandc'] = 'You may not register unless you agree to abide by the terms and conditions';
$string['youmustagreetothetermsandconditions'] = 'You must agree to the <a href="terms.php">terms and conditions</a>';
?>
......@@ -465,7 +465,7 @@ function auth_get_login_form() {
'login_username' => array(
'type' => 'text',
'title' => get_string('username'),
'description' => get_string('usernamedesc'),
'description' => get_string('usernamedescription'),
'help' => get_string('usernamehelp'),
'rules' => array(
'required' => true
......@@ -474,7 +474,7 @@ function auth_get_login_form() {
'login_password' => array(
'type' => 'password',
'title' => get_string('password'),
'description' => get_string('passworddesc'),
'description' => get_string('passworddescription'),
'help' => get_string('passwordhelp'),
'value' => '',
'rules' => array(
......@@ -683,7 +683,7 @@ function auth_submit($values) {
throw new Exception('Could not update the configuration options for the auth method');
}
$db->CompleteTrans();
$SESSION->add_ok_msg(get_string('authconfigurationoptionssaved') . ' ' . get_config_plugin('auth', $values['method'], $key));
$SESSION->add_ok_msg(get_string('authconfigoptionssaved', 'admin'));
}
?>
......@@ -104,14 +104,15 @@ $form = array(
function forgotpass_validate(Form $form, $values) {
// The e-mail address cannot already be in the system
if (!$form->get_error('email') && !($user = get_record('usr', 'email', $values['email']))) {
$form->set_error('email', get_string('emailaddressinvalid'));
$form->set_error('email', get_string('forgotpassnosuchemailaddress'));
return;
}
$authtype = auth_get_authtype_for_institution($user->institution);
safe_require('auth', $authtype, 'lib.php', 'require_once');
$authclass = 'Auth' . ucfirst($authtype);
if (!method_exists($authclass, 'change_password')) {
die_info(get_string('youwannabutyoucantchangepassword'));
die_info(get_string('cantchangepassword'));
}
}
......@@ -120,7 +121,7 @@ function forgotpass_submit($values) {
try {
if (!$user = get_record('usr', 'email', $values['email'])) {
die_info(get_string('emailaddressinvalid'));
die_info(get_string('forgotpassnosuchemailaddress'));
}
......@@ -137,10 +138,10 @@ function forgotpass_submit($values) {
insert_record('usr_password_request', $pwrequest);
}
catch (SQLException $e) {
die_info(get_string('forgotpasswordemailsendunsuccessful'));
die_info(get_string('forgotpassemailsendunsuccessful'));
}
catch (EmailException $e) {
die_info(get_string('forgotpasswordemailsendunsuccessful'));
die_info(get_string('forgotpassemailsendunsuccessful'));
}
// Add a marker in the session to say that the user has registered
......@@ -170,7 +171,7 @@ function forgotpasschange_submit($values) {
$authtype = auth_get_authtype_for_institution($user->institution);
$authclass = 'Auth' . ucfirst($authtype);
safe_require('auth', $authtype, 'lib.php', 'require_once');
safe_require('auth', $authtype);
log_debug($values);
if ($password = call_static_method($authclass, 'change_password', $user->username, $values['password1'])) {
......
......@@ -49,7 +49,7 @@ if (!$SESSION->is_logged_in()) {
'login_username' => array(
'type' => 'text',
'title' => get_string('username'),
'description' => get_string('usernamedesc'),
'description' => get_string('usernamedescription'),
'help' => get_string('usernamehelp'),
'rules' => array(
'required' => true
......@@ -58,7 +58,7 @@ if (!$SESSION->is_logged_in()) {
'login_password' => array(
'type' => 'password',
'title' => get_string('password'),
'description' => get_string('passworddesc'),
'description' => get_string('passworddescription'),
'help' => get_string('passwordhelp'),
'value' => '',
'rules' => array(
......
......@@ -131,16 +131,19 @@ $string['uploadcsverrorinvalidpassword'] = 'Error on line %s of your file: The p
$string['uploadcsverrorinvalidusername'] = 'Error on line %s of your file: The username for this user is not in correct form';
$string['uploadcsverrorincorrectfieldcount'] = 'Line %s of the file does not have the correct number of fields';
$string['uploadcsverrormandatoryfieldnotspecified'] = 'Line %s of the file does not have the required "%s" field';
$string['uploadcsverroruseralreadyexists'] = 'Line %s of the file specifies the username "%s" that already exists';
$string['uploadcsvfile'] = 'Upload CSV File';
$string['uploadcsvfiledescription'] = 'You may use this facility to upload new users via a <acronym title="Comma Separated Values">CSV</acronym> file. Each record in the file must have a username, e-mail address and password.';
// Admin Users
$string['adminusers'] = 'Admin Users';
$string['adminusersdescription'] = 'Here you may choose which users are administrators. Admin users are listed in the right box, and potential administrators are on the left.';
$string['adminusersupdated'] = 'Admin users updated';
// Staff Users
$string['staffusers'] = 'Staff Users';
$string['staffusersdescription'] = 'Here you may choose which users are staff users. Staff users are listed in the right box, and potential staff users are on the left.';
$string['staffusersupdated'] = 'Staff users updated';
// Admin Notifications
$string['adminnotifications'] = 'Admin Notifications';
......@@ -148,4 +151,7 @@ $string['adminnotifications'] = 'Admin Notifications';
// Suspended Users
$string['suspendedusers'] = 'Suspended Users';
// Authentication
$string['authconfigoptionssaved'] = 'Auth configuration has been saved';
?>
......@@ -40,28 +40,31 @@ $string['accountsuspended'] = 'Your account has been suspeneded as of %s. The re
$string['changepassword'] = 'Change Password';
$string['changepasswordinfo'] = 'You are required to change your password before you can proceed.';
$string['confirmpassword'] = 'Confirm password';
$string['cookiesnotenabled'] = 'Your browser does not have cookies enabled, or is blocking cookies from this site. Mahara requires cookies to be enabled before you can log in';
$string['institution'] = 'Institution';
$string['institutiondescription'] = 'Your institution';
$string['loggedoutok'] = 'You have been logged out successfully';
$string['login'] = 'Log In';
$string['loginfailed'] = 'You have not provided the correct credentials to log in. Please check your username and password are correct.';
$string['loginto'] = 'Log in to %s';
$string['newpassword'] = 'New Password';
$string['password'] = 'Password';
$string['passworddesc'] = 'Your password';
$string['passworddescription'] = 'Your password';
$string['passwordhelp'] = 'The password you use to access the system';
$string['passwordnotchanged'] = 'You did not change your password, please choose a new password';
$string['passwordsaved'] = 'Your new password has been saved';
$string['passwordsdonotmatch'] = 'The passwords do not match';
$string['passwordtooeasy'] = 'Your password is too easy! Please choose a harder password';
$string['register'] = 'Register';
$string['sessiontimedout'] = 'Your session has timed out, please enter your login details to continue';
$string['sessiontimedoutpublic'] = 'Your session has timed out. You may <a href="?login">log in</a> to continue browsing';
$string['username'] = 'Username';
$string['usernamedesc'] = 'Your username';
$string['usernamedescription'] = 'Your username';
$string['usernamehelp'] = 'The username you have been given to access this system.';
$string['yournewpassword'] = 'Your new password';
$string['yournewpasswordagain'] = 'Your new password again';
// Registration
$string['usernamedescription'] = 'Your username';
$string['passworddescription'] = 'Your password';
// This stuff is used by registration but might also be used by profile - if a string here isn't it should be moved to auth/internal/lang
$string['password2description'] = 'Your password again';
$string['firstname'] = 'First name';
$string['firstnamedescription'] = 'Your first name';
......@@ -69,25 +72,9 @@ $string['lastname'] = 'Last name';
$string['lastnamedescription'] = 'Your last name';
$string['emailaddress'] = 'Email address';
$string['emailaddressdescription'] = 'Your email address';
$string['iagreetothetermsandconditions'] = 'I agree to the terms and conditions';
$string['youmustagreetothetermsandconditions'] = 'You must agree to the terms and conditions';
$string['register'] = 'Register';
$string['registeredemailsubject'] = 'You have registered at %s';
$string['registeredemailmessagetext'] = 'Congratulations!
You have successfully registered an account! Please follow this link to
complete the signup process:
' . get_config('wwwroot') . 'register.php?key=%s';
$string['registeredemailmessagehtml'] = '<p>Congratulations!</p>
<p>You have successfully registered an account! Please follow this link
to complete the signup process:</p>
<p><a href="' . get_config('wwwroot') . 'register.php?key=%s">'
. get_config('wwwroot') . 'register.php?key=%s</a></p>';
$string['registeredok'] = '<p>You have successfully registered. Please check your e-mail account for instructions on how to activate your account</p>';
$string['registrationnosuchkey'] = 'Sorry, there does not seem to be a registration with this key. Perhaps you waited longer than 24 hours to complete your registration? Otherwise, it might be our fault.';
// Forgot password
$string['cantchangepassword'] = 'Sorry, you are unable to change your password through this interface - please use your institution\'s interface instead';
$string['forgotpassword'] = 'Forgotten your password?';
$string['pwchangerequestsent'] = 'You should receive an e-mail shortly with a link you can use to change the password for your account';
$string['forgotpassemailsubject'] = 'Change password request for %s';
......@@ -124,6 +111,10 @@ $string['forgotpassemailmessagehtml'] = '<p>Dear %s,</p>
<p>Regards, %s Site Administrator</p>
<p><a href="' . get_config('wwwroot') . 'forgotpass.php?key=%s">' . get_config('wwwroot') . 'forgotpass.php?key=%s</a></p>';
$string['forgotpassemailsendunsuccessful'] = 'Sorry, it appears that the e-mail could not be sent successfully. This is our fault, please try again shortly';
$string['forgotpassnosuchemailaddress'] = 'Sorry, this e-mail address does not appear to have an account here';
$string['nosuchpasswordrequest'] = 'No such password request';
$string['passwordchangedok'] = 'Your password was successfully changed';
// Expiry times
$string['noenddate'] = 'No end date';
......
......@@ -85,13 +85,13 @@ function form_renderer_table($builtelement, $rawelement) {
// on the form itself (without the user having to hover over contextual help
if (!empty($rawelement['description'])) {
$result .= "\t<tr>\n\t\t<td colspan=\"2\" class=\"description\">";
$result .= hsc($rawelement['description']);
$result .= $rawelement['description'];
$result .= "</td>\n\t</tr>\n";
}
if (!empty($rawelement['error'])) {
$result .= "\t<tr>\n\t\t<td colspan=\"2\" class=\"errmsg\">";
$result .= hsc($rawelement['error']);
$result .= $rawelement['error'];
}
$result .= "</td>\n\t</tr>\n";
......
......@@ -625,14 +625,14 @@ function safe_require($plugintype, $pluginname, $filename='lib.php', $function='
* @return array of names
*/
function site_content_pages() {
return array('about','home','loggedouthome','privacy','termsandconditions','uploadcopyright');
return array('about', 'home', 'loggedouthome', 'privacy', 'termsandconditions', 'uploadcopyright');
}
function get_site_page_content($pagename) {
if ($pagedata = @get_record('site_content','name',$pagename)) {
if ($pagedata = @get_record('site_content', 'name', $pagename)) {
return $pagedata->content;
}
return get_string('sitecontentnotfound','mahara',get_string($pagename));
return get_string('sitecontentnotfound', 'mahara', get_string($pagename));
}
/**
......@@ -1186,9 +1186,9 @@ function get_random_key() {
function password_validate(Form $form, $values, $user) {
$authtype = auth_get_authtype_for_institution($user->institution);
$authclass = 'Auth' . ucfirst($authtype);
safe_require('auth', $authtype, 'lib.php', 'require_once');
safe_require('auth', $authtype);
if (!$form->get_error('password1') && !call_static_method($authclass, 'is_password_valid', ($values['password1']))) {
$form->set_error('password1', get_string('passwordinvalidform'));
$form->set_error('password1', get_string('passwordinvalidform', "auth.$authtype"));
}
$suckypasswords = array(
......
......@@ -55,12 +55,12 @@ if ($SESSION->is_logged_in()) {
// registered, show them a screen telling them this.
if (!empty($_SESSION['registered'])) {
unset($_SESSION['registered']);
die_info(get_string('registeredok'));
die_info(get_string('registeredok', 'auth.internal'));
}
if (isset($_GET['key'])) {
if (!$registration = get_record('usr_registration', 'key', $_GET['key'])) {
die_info(get_string('registrationnosuchkey'));
die_info(get_string('registrationnosuchkey', 'auth.internal'));
}
// This should show mandatory profile fields, and the optional profile icon thing.
......@@ -151,8 +151,8 @@ else {
$elements['tandc'] = array(
'type' => 'radio',
'title' => get_string('iagreetothetermsandconditions'),
'description' => get_string('youmustagreetothetermsandconditions'),
'title' => get_string('iagreetothetermsandconditions', 'auth.internal'),
'description' => get_string('youmustagreetothetermsandconditions', 'auth.internal'),
'options' => array(
'yes' => get_string('yes'),
'no' => get_string('no')
......@@ -185,14 +185,14 @@ $form = array(
*/
function register_validate(Form $form, $values) {
$institution = $values['institution'];
safe_require('auth', 'internal', 'lib.php', 'require_once');
safe_require('auth', 'internal');
if (!$form->get_error('username') && !AuthInternal::is_username_valid($values['username'])) {
$form->set_error('username', get_string('usernameinvalidform'));
$form->set_error('username', get_string('usernameinvalidform', 'auth.internal'));
}
if (!$form->get_error('username') && record_exists('usr', 'username', $values['username'])) {
$form->set_error('username', get_string('usernamealreadytaken'));
$form->set_error('username', get_string('usernamealreadytaken', 'auth.internal'));
}
password_validate($form, $values, (object)$values);
......@@ -200,23 +200,23 @@ function register_validate(Form $form, $values) {
// First name and last name must contain at least one non whitespace
// character, so that there's something to read
if (!$form->get_error('firstname') && !preg_match('/\S/', $values['firstname'])) {
$form->set_error('firstname', get_string('thisfieldisrequired'));
$form->set_error('firstname', $form->i18n('required'));
}
if (!$form->get_error('lastname') && !preg_match('/\S/', $values['lastname'])) {
$form->set_error('lastname', get_string('thisfieldisrequired'));
$form->set_error('lastname', $form->i18n('required'));
}
// The e-mail address cannot already be in the system
if (!$form->get_error('email')
&& (record_exists('usr', 'email', $values['email'])
|| record_exists('usr_registration', 'email', $values['email']))) {
$form->set_error('email', get_string('emailalreadytaken'));
$form->set_error('email', get_string('emailalreadytaken', 'auth.internal'));
}
// If the user hasn't agreed to the terms and conditions, don't bother
if ($values['tandc'] != 'yes') {
$form->set_error('tandc', get_string('youmustagreetotheterms'));
$form->set_error('tandc', get_string('youmaynotregisterwithouttandc', 'auth.internal'));
}
}
......@@ -226,7 +226,7 @@ function register_submit($values) {
// store password encrypted
// don't die_info, since reloading the page shows the login form.
// instead, redirect to some other page that says this
safe_require('auth', 'internal', 'lib.php', 'require_once');
safe_require('auth', 'internal');
$values['salt'] = substr(md5(rand(1000000, 9999999)), 2, 8);
$values['password'] = AuthInternal::encrypt_password($values['password1'], $values['salt']);
$values['key'] = get_random_key();
......@@ -236,15 +236,15 @@ function register_submit($values) {
$user =(object) $values;
email_user($user, null,
get_string('registeredemailsubject', 'mahara', get_config('sitename')),
get_string('registeredemailmessagetext', 'mahara', $values['key']),
get_string('registeredemailmessagehtml', 'mahara', $values['key'], $values['key']));
get_string('registeredemailsubject', 'auth.internal', get_config('sitename')),
get_string('registeredemailmessagetext', 'auth.internal', $values['key']),
get_string('registeredemailmessagehtml', 'auth.internal', $values['key'], $values['key']));
}
catch (EmailException $e) {
die_info(get_string('registrationunsuccessful'));
die_info(get_string('registrationunsuccessful', 'auth.internal'));
}
catch (SQLException $e) {
die_info(get_string('registrationunsuccessful'));
die_info(get_string('registrationunsuccessful', 'auth.internal'));
}
// Add a marker in the session to say that the user has registered
......
......@@ -130,6 +130,8 @@ sub process {
while ( $file_data =~ m{ get_string\( ['"](.*?)['"] \s* (?: , \s* ['"](.*?)['"] )? .*? \)* }xmg ) {
my ( $tag, $section ) = ( $1, $2 );
next if ( $tag =~ m{ \$ }xms or ( defined $section and $section =~ m{ \$ }xms ) );
$section ||= 'mahara';
unless ( exists $language_strings->{$section}{$tag} ) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment