MOBILE-3213 lang: Use a variable to determine minimum version
parent
1137a1dd8f
commit
6e5f8319e4
|
@ -1620,8 +1620,8 @@
|
|||
"core.h5p.originator": "h5p",
|
||||
"core.h5p.pd": "h5p",
|
||||
"core.h5p.pddl": "h5p",
|
||||
"core.h5p.play": "local_moodlemobileapp",
|
||||
"core.h5p.pdm": "h5p",
|
||||
"core.h5p.play": "local_moodlemobileapp",
|
||||
"core.h5p.resizescript": "h5p",
|
||||
"core.h5p.resubmitScores": "h5p",
|
||||
"core.h5p.reuse": "h5p",
|
||||
|
|
|
@ -1328,7 +1328,7 @@
|
|||
"core.back": "Back",
|
||||
"core.block.blocks": "Blocks",
|
||||
"core.cancel": "Cancel",
|
||||
"core.cannotconnect": "Cannot connect: Verify that you have correctly typed the URL and that your site uses Moodle 3.1 or later.",
|
||||
"core.cannotconnect": "Cannot connect: Verify that you have correctly typed the URL and that your site uses Moodle {{$a}} or later.",
|
||||
"core.cannotdownloadfiles": "File downloading is disabled. Please contact your site administrator.",
|
||||
"core.captureaudio": "Record audio",
|
||||
"core.capturedimage": "Taken picture.",
|
||||
|
@ -1670,7 +1670,6 @@
|
|||
"core.login.changepasswordinstructions": "You cannot change your password in the app. Please click the following button to open the site in a web browser to change your password. Take into account you need to close the browser after changing the password as you will not be redirected to the app.",
|
||||
"core.login.changepasswordlogoutinstructions": "If you prefer to change site or log out, please click the following button:",
|
||||
"core.login.changepasswordreconnectinstructions": "Click the following button to reconnect to the site. (Take into account that if you didn't change your password successfully, you would return to the previous screen).",
|
||||
"core.login.checksiteversion": "Check that your site uses Moodle 3.1 or later.",
|
||||
"core.login.confirmdeletesite": "Are you sure you want to delete the site {{sitename}}?",
|
||||
"core.login.connect": "Connect!",
|
||||
"core.login.connecttomoodle": "Connect to Moodle",
|
||||
|
@ -1700,7 +1699,7 @@
|
|||
"core.login.invalidaccount": "Please check your login details or ask your site administrator to check the site configuration.",
|
||||
"core.login.invaliddate": "Invalid date",
|
||||
"core.login.invalidemail": "Invalid email address",
|
||||
"core.login.invalidmoodleversion": "<p>Invalid Moodle site version. The Moodle app only supports Moodle systems 3.1 onwards.</p>\n<p>You can contact your site administrators and ask them to update their Moodle system.</p>\n<p>\"Site Administrators\" are the people who manages the Moodle at your school/university/company or learning organisation. If you don't know how to contact them, please contact your teachers/trainers.</p>",
|
||||
"core.login.invalidmoodleversion": "<p>Invalid Moodle site version. The Moodle app only supports Moodle systems {{$a}} onwards.</p>\n<p>You can contact your site administrators and ask them to update their Moodle system.</p>\n<p>\"Site Administrators\" are the people who manages the Moodle at your school/university/company or learning organisation. If you don't know how to contact them, please contact your teachers/trainers.</p>",
|
||||
"core.login.invalidsite": "The site URL is invalid.",
|
||||
"core.login.invalidtime": "Invalid time",
|
||||
"core.login.invalidurl": "Invalid URL specified",
|
||||
|
|
|
@ -212,6 +212,7 @@ export class CoreSite {
|
|||
3.6: 2018120300,
|
||||
3.7: 2019052000
|
||||
};
|
||||
static MINIMUM_MOODLE_VERSION = 3.1;
|
||||
|
||||
// Possible cache update frequencies.
|
||||
protected UPDATE_FREQUENCIES = [
|
||||
|
@ -657,7 +658,8 @@ export class CoreSite {
|
|||
const promise = this.getFromCache(method, data, preSets, false, originalData).catch(() => {
|
||||
if (preSets.forceOffline) {
|
||||
// Don't call the WS, just fail.
|
||||
return Promise.reject(this.wsProvider.createFakeWSError('core.cannotconnect', true));
|
||||
return Promise.reject(this.wsProvider.createFakeWSError('core.cannotconnect', true,
|
||||
{$a: CoreSite.MINIMUM_MOODLE_VERSION}));
|
||||
}
|
||||
|
||||
// Call the WS.
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
"auth_email": "Email-based self-registration",
|
||||
"authenticating": "Authenticating",
|
||||
"cancel": "Cancel",
|
||||
"checksiteversion": "Check that your site uses Moodle 3.1 or later.",
|
||||
"changepassword": "Change password",
|
||||
"changepasswordbutton": "Open the change password page",
|
||||
"changepasswordhelp": "If you have problems changing your password, please contact your site administrator. \"Site Administrators\" are the people who manages the Moodle at your school/university/company or learning organisation. If you don't know how to contact them, please contact your teachers/trainers.",
|
||||
|
@ -38,7 +37,7 @@
|
|||
"invalidaccount": "Please check your login details or ask your site administrator to check the site configuration.",
|
||||
"invaliddate": "Invalid date",
|
||||
"invalidemail": "Invalid email address",
|
||||
"invalidmoodleversion": "<p>Invalid Moodle site version. The Moodle app only supports Moodle systems 3.1 onwards.</p>\n<p>You can contact your site administrators and ask them to update their Moodle system.</p>\n<p>\"Site Administrators\" are the people who manages the Moodle at your school/university/company or learning organisation. If you don't know how to contact them, please contact your teachers/trainers.</p>",
|
||||
"invalidmoodleversion": "<p>Invalid Moodle site version. The Moodle app only supports Moodle systems {{$a}} onwards.</p>\n<p>You can contact your site administrators and ask them to update their Moodle system.</p>\n<p>\"Site Administrators\" are the people who manages the Moodle at your school/university/company or learning organisation. If you don't know how to contact them, please contact your teachers/trainers.</p>",
|
||||
"invalidsite": "The site URL is invalid.",
|
||||
"invalidtime": "Invalid time",
|
||||
"invalidurl": "Invalid URL specified",
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
"areyousure": "Are you sure?",
|
||||
"back": "Back",
|
||||
"cancel": "Cancel",
|
||||
"cannotconnect": "Cannot connect: Verify that you have correctly typed the URL and that your site uses Moodle 3.1 or later.",
|
||||
"cannotconnect": "Cannot connect: Verify that you have correctly typed the URL and that your site uses Moodle {{$a}} or later.",
|
||||
"cannotdownloadfiles": "File downloading is disabled. Please contact your site administrator.",
|
||||
"captureaudio": "Record audio",
|
||||
"capturedimage": "Taken picture.",
|
||||
|
|
|
@ -371,7 +371,7 @@ export class CoreSitesProvider {
|
|||
} else if (this.textUtils.getErrorMessageFromError(secondError)) {
|
||||
return Promise.reject(secondError);
|
||||
} else {
|
||||
return this.translate.instant('core.cannotconnect');
|
||||
return this.translate.instant('core.cannotconnect', {$a: CoreSite.MINIMUM_MOODLE_VERSION});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
@ -463,7 +463,8 @@ export class CoreSitesProvider {
|
|||
error.error = this.translate.instant('core.login.sitehasredirect');
|
||||
} else {
|
||||
// We can't be sure if there is a redirect or not. Display cannot connect error.
|
||||
error.error = this.translate.instant('core.cannotconnect');
|
||||
error.error = this.translate.instant('core.cannotconnect',
|
||||
{$a: CoreSite.MINIMUM_MOODLE_VERSION});
|
||||
}
|
||||
|
||||
return Promise.reject(error);
|
||||
|
@ -508,7 +509,7 @@ export class CoreSitesProvider {
|
|||
return this.http.post(siteUrl + '/login/token.php', {}).timeout(this.wsProvider.getRequestTimeout()).toPromise()
|
||||
.catch(() => {
|
||||
// Default error messages are kinda bad, return our own message.
|
||||
return Promise.reject({error: this.translate.instant('core.cannotconnect')});
|
||||
return Promise.reject({error: this.translate.instant('core.cannotconnect', {$a: CoreSite.MINIMUM_MOODLE_VERSION})});
|
||||
}).then((data: any) => {
|
||||
|
||||
if (data.errorcode && (data.errorcode == 'enablewsdescription' || data.errorcode == 'requirecorrectaccess')) {
|
||||
|
@ -550,7 +551,7 @@ export class CoreSitesProvider {
|
|||
|
||||
return promise.then((data: any): any => {
|
||||
if (typeof data == 'undefined') {
|
||||
return Promise.reject(this.translate.instant('core.cannotconnect'));
|
||||
return Promise.reject(this.translate.instant('core.cannotconnect', {$a: CoreSite.MINIMUM_MOODLE_VERSION}));
|
||||
} else {
|
||||
if (typeof data.token != 'undefined') {
|
||||
return { token: data.token, siteUrl: siteUrl, privateToken: data.privatetoken };
|
||||
|
@ -582,7 +583,7 @@ export class CoreSitesProvider {
|
|||
}
|
||||
}
|
||||
}, () => {
|
||||
return Promise.reject(this.translate.instant('core.cannotconnect'));
|
||||
return Promise.reject(this.translate.instant('core.cannotconnect', {$a: CoreSite.MINIMUM_MOODLE_VERSION}));
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -676,7 +677,8 @@ export class CoreSitesProvider {
|
|||
*/
|
||||
protected treatInvalidAppVersion(result: number, siteUrl: string, siteId?: string): Promise<any> {
|
||||
let errorCode,
|
||||
errorKey;
|
||||
errorKey,
|
||||
translateParams;
|
||||
|
||||
switch (result) {
|
||||
case this.MOODLE_APP:
|
||||
|
@ -690,6 +692,7 @@ export class CoreSitesProvider {
|
|||
default:
|
||||
errorCode = 'invalidmoodleversion';
|
||||
errorKey = 'core.login.invalidmoodleversion';
|
||||
translateParams = {$a: CoreSite.MINIMUM_MOODLE_VERSION};
|
||||
}
|
||||
|
||||
let promise;
|
||||
|
@ -702,7 +705,7 @@ export class CoreSitesProvider {
|
|||
|
||||
return promise.then(() => {
|
||||
return Promise.reject({
|
||||
error: this.translate.instant(errorKey),
|
||||
error: this.translate.instant(errorKey, translateParams),
|
||||
errorcode: errorCode,
|
||||
loggedout: true
|
||||
});
|
||||
|
@ -757,7 +760,7 @@ export class CoreSitesProvider {
|
|||
}
|
||||
|
||||
const version31 = 2016052300,
|
||||
release31 = '3.1';
|
||||
release31 = CoreSite.MINIMUM_MOODLE_VERSION;
|
||||
|
||||
// Try to validate by version.
|
||||
if (info.version) {
|
||||
|
|
|
@ -315,11 +315,12 @@ export class CoreWSProvider {
|
|||
*
|
||||
* @param message The message to include in the error.
|
||||
* @param needsTranslate If the message needs to be translated.
|
||||
* @param translateParams Translation params, if needed.
|
||||
* @return Fake WS error.
|
||||
*/
|
||||
createFakeWSError(message: string, needsTranslate?: boolean): CoreWSError {
|
||||
createFakeWSError(message: string, needsTranslate?: boolean, translateParams?: {}): CoreWSError {
|
||||
if (needsTranslate) {
|
||||
message = this.translate.instant(message);
|
||||
message = this.translate.instant(message, translateParams);
|
||||
}
|
||||
|
||||
return {
|
||||
|
|
Loading…
Reference in New Issue