Merge branch 'main/rendor-staging' into main/atys-live
[ryzomcore.git] / web / public_php / login / login_translations.php
blob457915dab25ba246134f43c3455338785c82a325
1 <?php
3 /*
4 * Message tables.
5 * Each msg can contain %0..%n arguments (see also errorMsg()).
6 * %0 contains the error code passed to errorMsg(), even if the text is factorized in another message linked with 'lnk'.
7 */
9 $ErrMsgs = array();
11 // Generic error message
12 define('GENERIC_ERROR_NUM', 1000);
13 $ErrMsgs[1000]['dbg'] = 'Generic login error';
14 $ErrMsgs[1000]['en'] = 'Error';
15 $ErrMsgs[1000]['fr'] = 'Erreur';
16 $ErrMsgs[1000]['de'] = 'Error';
18 // Common public error messages
19 $msgMisconfiguredClient['en'] = 'Your client might be misconfigured, please contact support';
20 $msgMisconfiguredClient['fr'] = 'Il se peut que votre client soit mal configuré, merci de contacter le service client';
21 $msgMisconfiguredClient['de'] = 'Dein Client ist möglicherweise falsch konfiguriert, bitte kontaktiere den Support';
22 $msgOutOfDateClient['en'] = 'This client software is out of date, please visit www.ryzom.com to download a new client';
23 $msgOutOfDateClient['fr'] = 'Ce logiciel client est trop ancien, merci de télécharger un nouveau client sur www.ryzom.com';
24 $msgOutOfDateClient['de'] = 'Die Software ist nicht mehr aktuell bitte geh auf www.ryzom.com und lade dir den neuen Client herunter';
25 $msgLSInMaintenance['en'] = 'The log-in server is in maintenance, please try later';
26 $msgLSInMaintenance['fr'] = 'Le serveur de connexion est en maintenance, merci de réessayer plus tard';
27 $msgLSInMaintenance['de'] = 'Der Login-Server ist wegen Wartungsarbeiten offline, bitte versuch es später nochmal';
28 $msgDBInMaintenance['en'] = 'The database server is in maintenance, please try later';
29 $msgDBInMaintenance['fr'] = 'Le serveur de base de données est en maintenance, merci de réessayer plus tard';
30 $msgDBInMaintenance['de'] = 'Der Datenbank-Server ist wegen Wartungsarbeiten offline, bitte versuch es später nochmal';
31 $msgGameServersClosed['en'] = 'Game servers are currently closed or restricted, please retry later';
32 $msgGameServersClosed['fr'] = 'Les serveurs de jeu sont actuellement fermés ou à accès restreint, merci de réessayer plus tard';
33 $msgGameServersClosed['de'] = 'Die Spiel-Server sind momentan geschlossen oder gesperrt, bitte versuch es später nochmal';
36 * Main account error messages:
38 $ErrMsgs[2001]['dbg'] = '(in %2)';
39 $ErrMsgs[2001]['en'] = 'Invalid account: %1'; // ex 52 and 64
40 $ErrMsgs[2001]['fr'] = 'Compte erroné : %1';
41 $ErrMsgs[2001]['de'] = 'Ungültiger Account: %1';
42 $ErrMsgs[2001]['log'] = false;
44 $ErrMsgs[2002]['en'] = "Your account must be activated first. Please read the email sent to %1.";
45 $ErrMsgs[2002]['fr'] = "Votre compte doit d'abord être activé. Merci de lire l'e-mail envoyé à %1.";
46 $ErrMsgs[2002]['de'] = "Dein Account muss noch aktiviert werden. Bitte befolge die Anweisungen, die wir per Mail an %1 geschickt haben.";
47 $ErrMsgs[2002]['log'] = false;
49 $ErrMsgs[2003]['en'] = "Your account must be activated first. Please read the email that has been sent to you.";
50 $ErrMsgs[2003]['fr'] = "Votre compte doit d'abord être activé. Merci de lire l'e-mail que nous vous avons envoyé.";
51 $ErrMsgs[2003]['de'] = "Dein Account muss noch aktiviert werden. Bitte befolge die Anweisungen, die wir per Mail an Dich geschickt haben.";
52 $ErrMsgs[2003]['log'] = false;
54 $ErrMsgs[2004]['dbg'] = '(in %2)'; // user => ex 56; signup_data => ex 56B
55 $ErrMsgs[2004]['en'] = "Invalid password";
56 $ErrMsgs[2004]['fr'] = "Mot de passe erroné";
57 $ErrMsgs[2004]['de'] = "Falsches Passwort";
58 $ErrMsgs[2004]['log'] = false;
60 // Translated Login Service error messages
61 define('BASE_TRANSLATED_LS_ERROR_NUM', 2100);
63 $ErrMsgs[2101]['dbg'] = '(LS error %1: %2 for userId %3)';
64 $ErrMsgs[2101]['en'] = 'Invalid account'; // ex 1?: 'invalid user'
65 $ErrMsgs[2101]['fr'] = 'Compte erroné';
66 $ErrMsgs[2101]['de'] = 'Ungültiger Account';
68 $ErrMsgs[2102]['dbg'] = '(LS error %1: %2 for userId %3)';
69 $ErrMsgs[2102]['en'] = 'Your account is already in online state, please retry in a few seconds'; // ex 2: 'User already online, please relog'
70 $ErrMsgs[2102]['fr'] = "Votre compte est encore dans l'état en ligne, merci de réessayer dans quelques secondes";
71 $ErrMsgs[2102]['de'] = 'Dein Account ist schon als online gekennzeichnet, bitte versuche es in ein paar Sekunden nochmals';
72 $ErrMsgs[2102]['log'] = false;
74 $ErrMsgs[2103]['dbg'] = '(LS error %1: %2 for userId %3)';
75 $ErrMsgs[2103]['en'] = 'Dual logging with a Privileged account is not permitted; this action has been logged and Gameforge CS has been notified';
76 $ErrMsgs[2103]['fr'] = 'TODO';
77 $ErrMsgs[2103]['de'] = 'TODO';
78 $ErrMsgs[2103]['mail'] = array('duallog@ryzom.com', "Dual Logging with GM account detected",
79 "UserId %3 attempted to log-in while related account (linked through GMId) was in online state (error code %0).\n".
80 "Message from server: %2\n".
81 "This could be a false positive if the user just disconnected without waiting for 30 s, and tried to log-in with their other account.");
83 $ErrMsgs[2104]['dbg'] = '(LS error %1: %2 for userId %3)';
84 $ErrMsgs[2104]['lnk'] = $ErrMsgs[2103];
86 $ErrMsgs[2105]['dbg'] = '(LS error %1: %2 for userId %3)';
87 $ErrMsgs[2105]['lnk'] = $ErrMsgs[2101];
89 $ErrMsgs[2106]['dbg'] = '(LS error %1: %2 for userId %3)';
90 $ErrMsgs[2106]['lnk'] = $msgDBInMaintenance;
94 * Technical error messages:
95 * "visible" error messages (server down, etc.) are localized,
96 * unlike errors that should never occur (ex: bad parameters from client)
98 define('BASE_TECHNICAL_ERROR_NUM', 3000);
100 $ErrMsgs[3001]['dbg'] = 'Failed to find a ring domain record for domainId: %1';
102 $ErrMsgs[3002]['dbg'] = 'Missing cmd';
104 $ErrMsgs[3003]['dbg'] = 'No response from Shard Unifier';
105 $ErrMsgs[3003]['lnk'] = $msgLSInMaintenance;
107 $ErrMsgs[3004]['dbg'] = "Can't connect to the %1 db server host:%2 user:%3";
108 $ErrMsgs[3004]['lnk'] = $msgDBInMaintenance;
110 $ErrMsgs[3005]['dbg'] = "Can't access the %1 database db:%2 host:%3 user:%4 (check privileges)";
111 $ErrMsgs[3005]['lnk'] = $msgDBInMaintenance;
113 $ErrMsgs[3006]['dbg'] = "Can't execute query '%1' on the %2 database db:%3 host:%4 user:%5 error:%6";
114 $ErrMsgs[3006]['lnk'] = $msgDBInMaintenance;
116 $ErrMsgs[3007]['dbg'] = "Can't find domain: %1"; // ex 'x'
117 $ErrMsgs[3007]['lnk'] = $msgMisconfiguredClient;
118 $ErrMsgs[3007]['add'] = 'dbg';
120 $ErrMsgs[3008]['dbg'] = "Login '%1' was created because it was not found in database"; // ex 50
122 $ErrMsgs[3009]['dbg'] = "Can't fetch login '%1' after insertion"; // ex 51
124 $ErrMsgs[3010]['dbg'] = "No permission found, but I need to accept Unknown user, so permission created, please RELOG";
126 $ErrMsgs[3011]['dbg'] = "(client application: %1 domain: %2)"; // ex 53
127 $ErrMsgs[3011]['en'] = "Your account needs a proper subscription to connect";
128 $ErrMsgs[3011]['fr'] = "Votre compte doit avoir un abonnement actif pour se connecter";
129 $ErrMsgs[3011]['de'] = 'Du kannst dich nicht ohne abgeschlossenes Abonemment in deinen Account einloggen';
130 $ErrMsgs[3011]['add'] = 'dbg';
131 $ErrMsgs[3011]['log'] = false;
133 $ErrMsgs[3012]['dbg'] = "No access privilege found for %1, but I need to accept Unknown user, so permission created, RELOG";
135 $ErrMsgs[3013]['dbg'] = "(client application: %1 domain: %2 reqPriv: %3)";
136 $ErrMsgs[3013]['en'] = "You don't have sufficient privilege to connect now, please try later";
137 $ErrMsgs[3013]['fr'] = "Vous n'avez pas les privilèges nécessaires pour vous connecter maintenant, veuillez essayer plus tard";
138 $ErrMsgs[3013]['de'] = 'Du hast nicht die nötigen Rechte um dich jetzt zu verbinden, bitte versuch es später nochmal';
139 $ErrMsgs[3013]['log'] = false;
141 // Translated Ring Session Manager (joinSession) error messages
142 define('BASE_TRANSLATED_RSM_ERROR_NUM', 4000);
144 $ErrMsgs[4001]['dbg'] = 'joinSession error %1: %2 for userId %3';
145 $ErrMsgs[4002]['dbg'] = 'joinSession error %1: %2 for userId %3';
146 $ErrMsgs[4003]['dbg'] = 'joinSession error %1: %2 for userId %3';
147 $ErrMsgs[4004]['dbg'] = 'joinSession error %1: %2 for userId %3';
149 $ErrMsgs[4005]['dbg'] = '(joinSession error %1: %2 for userId %3)';
150 $ErrMsgs[4005]['lnk'] = $msgGameServersClosed;
152 $ErrMsgs[4006]['dbg'] = 'joinSession error %1: %2 for userId %3';
153 $ErrMsgs[4007]['dbg'] = 'joinSession error %1: %2 for userId %3';
154 $ErrMsgs[4008]['dbg'] = 'joinSession error %1: %2 for userId %3';
155 $ErrMsgs[4009]['dbg'] = 'joinSession error %1: %2 for userId %3';
157 $ErrMsgs[4010]['dbg'] = '(joinSession error %1: %2 for userId %3)';
158 $ErrMsgs[4010]['lnk'] = $msgGameServersClosed;
160 $ErrMsgs[4011]['dbg'] = 'joinSession error %1: %2 for userId %3';
161 $ErrMsgs[4012]['dbg'] = 'joinSession error %1: %2 for userId %3';
162 $ErrMsgs[4013]['dbg'] = 'joinSession error %1: %2 for userId %3';
164 $ErrMsgs[4014]['dbg'] = '(joinSession error %1: %2 for userId %3)';
165 $ErrMsgs[4014]['lnk'] = $msgGameServersClosed;
167 $ErrMsgs[4015]['dbg'] = 'joinSession error %1: %2 for userId %3';
168 $ErrMsgs[4016]['dbg'] = 'joinSession error %1: %2 for userId %3';
169 $ErrMsgs[4017]['dbg'] = 'joinSession error %1: %2 for userId %3';
170 $ErrMsgs[4018]['dbg'] = 'joinSession error %1: %2 for userId %3';
171 $ErrMsgs[4019]['dbg'] = 'joinSession error %1: %2 for userId %3';
172 $ErrMsgs[4020]['dbg'] = 'joinSession error %1: %2 for userId %3';
175 $MsgLanguages = array('en');
176 $DisplayDbg = false;
179 * Whenever a language information is known, use this method to refine the language used for error messages.
180 * Accepted values:
181 * 'en', 'fr', 'de', array of this values, or 'all' ('all' will display all versions)
183 function setMsgLanguage($languages='en')
185 global $MsgLanguages;
186 if ($languages == 'all')
188 $MsgLanguages = $languages;
189 return;
191 if (!is_array($languages))
192 $languages = array($languages);
193 foreach ($languages as $index => $lg)
195 switch ($lg)
197 case 'fr':
198 case 'de':;
199 break;
200 default:
201 $languages[$index] = 'en';
204 $MsgLanguages = $languages;
208 * Find the specified error message, and return the first found with the following precedence:
209 * 1. Current language(s) set by setMsgLangage()
210 * 2. English message
211 * 3. Debug message
212 * 4. Generic error
213 * Each language can be found through ['lnk'] if needed
214 * Tags (%1..%n) in the message are replaced by mixed arguments specified after $errNum.
215 * Ex: errorMsg(55, $domainName)
216 * if 'dbg' is found in ['add'] or $DisplayDbg is true, the 'dbg' version is appended to the found version.
218 function errorMsg($errNum=GENERIC_ERROR_NUM) // $mixedArgs
220 // Find specified message using precedence rules
221 global $MsgLanguages;
222 $precedence = array(
223 array($errNum, ($MsgLanguages == 'all') ? array('en', 'fr', 'de') : $MsgLanguages),
224 array($errNum, array('en')),
225 array($errNum, array('dbg')),
226 array(GENERIC_ERROR_NUM, $MsgLanguages),
227 array(GENERIC_ERROR_NUM, array('en')));
228 global $ErrMsgs;
229 $args = func_get_args();
230 $msg = '';
231 foreach ($precedence as $rule)
233 // Find message
234 list($actualErrNum, $languages) = $rule;
235 foreach ($languages as $lg)
237 if (isset($ErrMsgs[$actualErrNum][$lg]) && ($ErrMsgs[$actualErrNum][$lg] != 'TODO'))
238 appendToMsg($msg, $errNum, $ErrMsgs[$actualErrNum][$lg], $args);
239 else if (isset($ErrMsgs[$actualErrNum]['lnk']) && isset($ErrMsgs[$actualErrNum]['lnk'][$lg]) && ($ErrMsgs[$actualErrNum]['lnk'][$lg] != 'TODO'))
240 appendToMsg($msg, $errNum, $ErrMsgs[$actualErrNum]['lnk'][$lg], $args);
243 // Try next rule only if not found
244 if (!empty($msg))
245 break;
248 // Add debug version if needed
249 global $DisplayDbg;
250 $msgHasDebug = in_array('dbg', $languages);
251 $logExtMsg = '';
252 if ((!$msgHasDebug) && isset($ErrMsgs[$actualErrNum]['dbg']))
254 if ($DisplayDbg || (isset($ErrMsgs[$actualErrNum]['add']) && ($ErrMsgs[$actualErrNum]['add'] == 'dbg')))
255 $msg .= '['.$ErrMsgs[$actualErrNum]['dbg']."]\n"; // to result/screen message
256 else
257 $logExtMsg .= '['.$ErrMsgs[$actualErrNum]['dbg'].']'; // to log message
260 // Get mail data if specified
261 $mailData = (isset($ErrMsgs[$actualErrNum]['mail']) ? $ErrMsgs[$actualErrNum]['mail'] :
262 (isset($ErrMsgs[$actualErrNum]['lnk']['mail']) ? $ErrMsgs[$actualErrNum]['lnk']['mail'] :
263 array()));
265 // Apply params if applicable
266 $numArgs = func_num_args();
267 if ($numArgs > 1)
269 for ($i=0; $i!=$numArgs; ++$i) // include $errNum (%0)
271 $msg = str_replace("%$i", $args[$i], $msg);
272 $logExtMsg = str_replace("%$i", $args[$i], $logExtMsg);
273 $mIdx = 0;
274 foreach ($mailData as $field)
276 $mailData[$mIdx] = str_replace("%$i", $args[$i], $field);
277 ++$mIdx;
282 // Log technical errors if possible
283 $logMode = (isset($ErrMsgs[$actualErrNum]['log']) ? $ErrMsgs[$actualErrNum]['log'] :
284 (isset($ErrMsgs[$actualErrNum]['lnk']['log']) ? $ErrMsgs[$actualErrNum]['lnk']['log'] :
285 true));
286 if ($logMode && class_exists('CWwwLog'))
288 $logFile = new CWwwLog();
289 $logFile->logStr(/*$msg.*/$logExtMsg); // message is already logged by ob_callback_r2login()
292 // Send email if specified
293 if (!empty($mailData) && (count($mailData) >= 3))
295 include_once('email/htmlMimeMail.php');
296 $mail = new htmlMimeMail();
297 $mail->setFrom('noreply@ryzom.com');
298 $mail->setSubject($mailData[1]);
299 $mail->setText('Application: '.$_GET['clientApplication'].' - Login: '.$_GET['login']."\n". // display as much info as possible
300 $mailData[2]);
301 $result = $mail->send(array($mailData[0]));
304 return $msg;
307 // Helper for errorMsg()
308 function appendToMsg(&$msg, $errNum, $str, &$args)
310 $msg .= "$str ($errNum)";
311 if (($errNum == GENERIC_ERROR_NUM) && !empty($args))
313 foreach ($args as $arg)
315 $msg .= " [$arg]"; // display all passed args if returning the default generic error
318 $msg .= "\n";
322 if (isset($_GET['export']))
323 exportErrMsgsToTSV();
324 // Utility
325 function exportErrMsgsToTSV()
327 global $ErrMsgs;
328 echo "Num\ten\tfr\tde\tdbg\t\n";
329 foreach ($ErrMsgs as $num => $txtArray)
331 echo $num."\t";
332 foreach (array('en','fr','de','dbg') as $lg)
334 if (isset($txtArray[$lg]))
335 echo $txtArray[$lg];
336 else if (isset($txtArray['lnk'][$lg]))
337 echo $txtArray['lnk'][$lg];
338 echo "\t";
340 echo "\n";