From 03f1614856b3b5d2400c784bb398d51496609d28 Mon Sep 17 00:00:00 2001 From: Dani Palou Date: Fri, 8 Dec 2017 15:53:27 +0100 Subject: [PATCH] MOBILE-2253 core: Use core prefix instead of mm in lang strings --- gulpfile.js | 8 +-- src/classes/site.ts | 30 +++++----- src/components/iframe/iframe.ts | 2 +- src/components/input-errors/input-errors.ts | 22 ++++---- src/components/loading/loading.ts | 4 +- src/components/mark-required/mark-required.ts | 4 +- src/components/show-password/show-password.ts | 2 +- .../login/pages/credentials/credentials.html | 16 +++--- .../login/pages/credentials/credentials.ts | 8 +-- .../pages/email-signup/email-signup.html | 56 +++++++++---------- .../login/pages/email-signup/email-signup.ts | 28 +++++----- .../forgotten-password.html | 14 ++--- .../forgotten-password/forgotten-password.ts | 6 +- src/core/login/pages/reconnect/reconnect.html | 16 +++--- src/core/login/pages/reconnect/reconnect.ts | 6 +- .../login/pages/site-error/site-error.html | 18 +++--- src/core/login/pages/site-help/site-help.html | 6 +- .../login/pages/site-policy/site-policy.html | 10 ++-- .../login/pages/site-policy/site-policy.ts | 2 +- src/core/login/pages/site/site.html | 16 +++--- src/core/login/pages/site/site.ts | 4 +- src/core/login/pages/sites/sites.html | 10 ++-- src/core/login/pages/sites/sites.ts | 4 +- src/core/login/providers/helper.ts | 20 +++---- src/core/viewer/pages/text/text.html | 2 +- src/directives/format-text.ts | 6 +- src/pipes/date-day-or-time.ts | 6 +- src/pipes/format-date.ts | 6 +- src/providers/groups.ts | 2 +- src/providers/sites.ts | 24 ++++---- src/providers/utils/dom.ts | 30 +++++----- src/providers/utils/mimetype.ts | 4 +- src/providers/utils/text.ts | 6 +- src/providers/utils/time.ts | 12 ++-- src/providers/utils/utils.ts | 46 +++++++-------- src/providers/ws.ts | 40 ++++++------- 36 files changed, 248 insertions(+), 248 deletions(-) diff --git a/gulpfile.js b/gulpfile.js index edf9cfa8d..2296ffaa8 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -62,13 +62,13 @@ function treatMergedData(data) { if (filepath.indexOf('lang/') === 0 || filepath.indexOf('core/lang') === 0) { - addProperties(merged, data[filepath], 'mm.core.'); + addProperties(merged, data[filepath], 'core.'); } else if (filepath.indexOf('core/') === 0) { var componentName = filepath.replace('core/', ''); componentName = componentName.substr(0, componentName.indexOf('/')); - addProperties(merged, data[filepath], 'mm.'+componentName+'.'); + addProperties(merged, data[filepath], 'core.'+componentName+'.'); } else if (filepath.indexOf('addons') === 0) { @@ -86,11 +86,11 @@ function treatMergedData(data) { } else if (filepath.indexOf('assets/countries') === 0) { - addProperties(merged, data[filepath], 'mm.core.country-'); + addProperties(merged, data[filepath], 'core.country-'); } else if (filepath.indexOf('assets/mimetypes') === 0) { - addProperties(merged, data[filepath], 'mm.core.mimetype-'); + addProperties(merged, data[filepath], 'core.mimetype-'); } } diff --git a/src/classes/site.ts b/src/classes/site.ts index d2ae143ec..9a2673b75 100644 --- a/src/classes/site.ts +++ b/src/classes/site.ts @@ -441,7 +441,7 @@ export class CoreSite { method = compatibilityMethod; } else { this.logger.error(`WS function '${method}' is not available, even in compatibility mode.`); - return Promise.reject(this.wsProvider.createFakeWSError('mm.core.wsfunctionnotavailable', true)); + return Promise.reject(this.wsProvider.createFakeWSError('core.wsfunctionnotavailable', true)); } } @@ -455,7 +455,7 @@ export class CoreSite { if (wsPreSets.cleanUnicode && this.textUtils.hasUnicodeData(data)) { // Data will be cleaned, notify the user. - this.domUtils.showToast('mm.core.unicodenotsupported', true, 3000); + this.domUtils.showToast('core.unicodenotsupported', true, 3000); } else { // No need to clean data in this call. wsPreSets.cleanUnicode = false; @@ -470,7 +470,7 @@ export class CoreSite { data = this.wsProvider.convertValuesToString(data, wsPreSets.cleanUnicode); } catch (e) { // Empty cleaned text found. - return Promise.reject(this.wsProvider.createFakeWSError('mm.core.unicodenotsupportedcleanerror', true)); + return Promise.reject(this.wsProvider.createFakeWSError('core.unicodenotsupportedcleanerror', true)); } return this.getFromCache(method, data, preSets).catch(() => { @@ -499,26 +499,26 @@ export class CoreSite { // Session expired, trigger event. this.eventsProvider.trigger(CoreEventsProvider.SESSION_EXPIRED, {siteId: this.id}); // Change error message. We'll try to get data from cache. - error.message = this.translate.instant('mm.core.lostconnection'); + error.message = this.translate.instant('core.lostconnection'); } else if (error.errorcode === 'userdeleted') { // User deleted, trigger event. this.eventsProvider.trigger(CoreEventsProvider.USER_DELETED, {siteId: this.id, params: data}); - error.message = this.translate.instant('mm.core.userdeleted'); + error.message = this.translate.instant('core.userdeleted'); return Promise.reject(error); } else if (error.errorcode === 'forcepasswordchangenotice') { // Password Change Forced, trigger event. this.eventsProvider.trigger(CoreEventsProvider.PASSWORD_CHANGE_FORCED, {siteId: this.id}); - error.message = this.translate.instant('mm.core.forcepasswordchangenotice'); + error.message = this.translate.instant('core.forcepasswordchangenotice'); return Promise.reject(error); } else if (error.errorcode === 'usernotfullysetup') { // User not fully setup, trigger event. this.eventsProvider.trigger(CoreEventsProvider.USER_NOT_FULLY_SETUP, {siteId: this.id}); - error.message = this.translate.instant('mm.core.usernotfullysetup'); + error.message = this.translate.instant('core.usernotfullysetup'); return Promise.reject(error); } else if (error.errorcode === 'sitepolicynotagreed') { // Site policy not agreed, trigger event. this.eventsProvider.trigger(CoreEventsProvider.SITE_POLICY_NOT_AGREED, {siteId: this.id}); - error.message = this.translate.instant('mm.core.sitepolicynotagreederror'); + error.message = this.translate.instant('core.sitepolicynotagreederror'); return Promise.reject(error); } else if (error.errorcode === 'dmlwriteexception' && this.textUtils.hasUnicodeData(data)) { if (!this.cleanUnicode) { @@ -527,7 +527,7 @@ export class CoreSite { return this.request(method, data, preSets); } // This should not happen. - error.message = this.translate.instant('mm.core.unicodenotsupported'); + error.message = this.translate.instant('core.unicodenotsupported'); return Promise.reject(error); } else if (typeof preSets.emergencyCache !== 'undefined' && !preSets.emergencyCache) { this.logger.debug(`WS call '${method}' failed. Emergency cache is forbidden, rejecting.`); @@ -887,7 +887,7 @@ export class CoreSite { } } else if (typeof data == 'undefined' || typeof data.code == 'undefined') { // local_mobile returned something we didn't expect. Let's assume it's not installed. - return {code: 0, warning: 'mm.login.localmobileunexpectedresponse'}; + return {code: 0, warning: 'core.login.localmobileunexpectedresponse'}; } const code = parseInt(data.code, 10); @@ -895,18 +895,18 @@ export class CoreSite { switch (code) { case 1: // Site in maintenance mode. - return Promise.reject(this.translate.instant('mm.login.siteinmaintenance')); + return Promise.reject(this.translate.instant('core.login.siteinmaintenance')); case 2: // Web services not enabled. - return Promise.reject(this.translate.instant('mm.login.webservicesnotenabled')); + return Promise.reject(this.translate.instant('core.login.webservicesnotenabled')); case 3: // Extended service not enabled, but the official is enabled. return {code: 0}; case 4: // Neither extended or official services enabled. - return Promise.reject(this.translate.instant('mm.login.mobileservicesnotenabled')); + return Promise.reject(this.translate.instant('core.login.mobileservicesnotenabled')); default: - return Promise.reject(this.translate.instant('mm.core.unexpectederror')); + return Promise.reject(this.translate.instant('core.unexpectederror')); } } else { return {code: code, service: service, coresupported: !!data.coresupported}; @@ -1054,7 +1054,7 @@ export class CoreSite { } if (alertMessage) { - let alert = this.domUtils.showAlert('mm.core.notice', alertMessage, null, 3000); + let alert = this.domUtils.showAlert('core.notice', alertMessage, null, 3000); alert.onDidDismiss(() => { if (inApp) { resolve(this.utils.openInApp(url, options)); diff --git a/src/components/iframe/iframe.ts b/src/components/iframe/iframe.ts index 6658ffa31..0513bf4c0 100644 --- a/src/components/iframe/iframe.ts +++ b/src/components/iframe/iframe.ts @@ -70,7 +70,7 @@ export class CoreIframeComponent implements OnInit { iframe.addEventListener('error', () => { this.loading = false; - this.domUtils.showErrorModal('mm.core.errorloadingcontent', true); + this.domUtils.showErrorModal('core.errorloadingcontent', true); }); setTimeout(() => { diff --git a/src/components/input-errors/input-errors.ts b/src/components/input-errors/input-errors.ts index 1e40cbee0..4ff9e833d 100644 --- a/src/components/input-errors/input-errors.ts +++ b/src/components/input-errors/input-errors.ts @@ -33,7 +33,7 @@ import { TranslateService } from '@ngx-translate/core'; * Example usage: * * - * {{ 'mm.login.username' | translate }} + * {{ 'core.login.username' | translate }} * * * @@ -64,13 +64,13 @@ export class CoreInputErrorsComponent implements OnInit { protected initErrorMessages() { this.errorMessages = this.errorMessages || {}; - this.errorMessages.required = this.errorMessages.required || this.translate.instant('mm.core.required'); - this.errorMessages.email = this.errorMessages.email || this.translate.instant('mm.login.invalidemail'); - this.errorMessages.date = this.errorMessages.date || this.translate.instant('mm.login.invaliddate'); - this.errorMessages.datetime = this.errorMessages.datetime || this.translate.instant('mm.login.invaliddate'); - this.errorMessages.datetimelocal = this.errorMessages.datetimelocal || this.translate.instant('mm.login.invaliddate'); - this.errorMessages.time = this.errorMessages.time || this.translate.instant('mm.login.invalidtime'); - this.errorMessages.url = this.errorMessages.url || this.translate.instant('mm.login.invalidurl'); + this.errorMessages.required = this.errorMessages.required || this.translate.instant('core.required'); + this.errorMessages.email = this.errorMessages.email || this.translate.instant('core.login.invalidemail'); + this.errorMessages.date = this.errorMessages.date || this.translate.instant('core.login.invaliddate'); + this.errorMessages.datetime = this.errorMessages.datetime || this.translate.instant('core.login.invaliddate'); + this.errorMessages.datetimelocal = this.errorMessages.datetimelocal || this.translate.instant('core.login.invaliddate'); + this.errorMessages.time = this.errorMessages.time || this.translate.instant('core.login.invalidtime'); + this.errorMessages.url = this.errorMessages.url || this.translate.instant('core.login.invalidurl'); // @todo: Check how to handle min/max errors once we have a test case to use. Also, review previous errors. // ['min', 'max'].forEach((type) => { @@ -81,13 +81,13 @@ export class CoreInputErrorsComponent implements OnInit { // if (input.type == 'date' || input.type == 'datetime' || input.type == 'datetime-local') { // var date = moment(value); // if (date.isValid()) { - // value = moment(value).format($translate.instant('mm.core.dfdaymonthyear')); + // value = moment(value).format($translate.instant('core.dfdaymonthyear')); // } // } - // scope.errorMessages[type] = $translate.instant('mm.login.invalidvalue' + type, {$a: value}); + // scope.errorMessages[type] = $translate.instant('core.login.invalidvalue' + type, {$a: value}); // } else { - // scope.errorMessages[type] = $translate.instant('mm.login.profileinvaliddata'); + // scope.errorMessages[type] = $translate.instant('core.login.profileinvaliddata'); // } // } // }); diff --git a/src/components/loading/loading.ts b/src/components/loading/loading.ts index 19ce95d04..c881ad67c 100644 --- a/src/components/loading/loading.ts +++ b/src/components/loading/loading.ts @@ -20,7 +20,7 @@ import { TranslateService } from '@ngx-translate/core'; * * It will show a spinner with a message and hide all the content until 'dataLoaded' variable is set to true. * If 'message' and 'dynMessage' attributes aren't set, default message "Loading" is shown. - * 'message' attribute accepts hardcoded strings, variables, filters, etc. E.g. message="'mm.core.loading' | translate". + * 'message' attribute accepts hardcoded strings, variables, filters, etc. E.g. message="'core.loading' | translate". * * Usage: * @@ -43,7 +43,7 @@ export class CoreLoadingComponent implements OnInit { ngOnInit() { if (!this.message) { // Default loading message. - this.message = this.translate.instant('mm.core.loading'); + this.message = this.translate.instant('core.loading'); } } diff --git a/src/components/mark-required/mark-required.ts b/src/components/mark-required/mark-required.ts index 6d6cc7610..95bdaf952 100644 --- a/src/components/mark-required/mark-required.ts +++ b/src/components/mark-required/mark-required.ts @@ -25,7 +25,7 @@ import { CoreUtilsProvider } from '../../providers/utils/utils'; * * This directive should be applied in the label. Example: * - * {{ 'mm.login.username' | translate }} + * {{ 'core.login.username' | translate }} */ @Component({ selector: '[core-mark-required]', @@ -39,7 +39,7 @@ export class CoreMarkRequiredComponent implements OnInit, AfterViewInit { constructor(element: ElementRef, private translate: TranslateService, private textUtils: CoreTextUtilsProvider, private utils: CoreUtilsProvider) { this.element = element.nativeElement; - this.requiredLabel = this.translate.instant('mm.core.required'); + this.requiredLabel = this.translate.instant('core.required'); } /** diff --git a/src/components/show-password/show-password.ts b/src/components/show-password/show-password.ts index 8d83e015c..f4c2fd949 100644 --- a/src/components/show-password/show-password.ts +++ b/src/components/show-password/show-password.ts @@ -90,7 +90,7 @@ export class CoreShowPasswordComponent implements OnInit, AfterViewInit { * Set label, icon name and input type. */ protected setData() { - this.label = this.shown ? 'mm.core.hide' : 'mm.core.show'; + this.label = this.shown ? 'core.hide' : 'core.show'; this.iconName = this.shown ? 'eye-off' : 'eye'; if (this.input) { this.input.type = this.shown ? 'text' : 'password'; diff --git a/src/core/login/pages/credentials/credentials.html b/src/core/login/pages/credentials/credentials.html index b52284bc4..f46bc468b 100644 --- a/src/core/login/pages/credentials/credentials.html +++ b/src/core/login/pages/credentials/credentials.html @@ -1,6 +1,6 @@ - {{ 'mm.login.login' | translate }} + {{ 'core.login.login' | translate }} @@ -19,23 +19,23 @@
- + - + - +
- +
-

{{ 'mm.login.potentialidps' | translate }}

+

{{ 'core.login.potentialidps' | translate }}

{{provider.name}} {{provider.name}} @@ -45,10 +45,10 @@
-

{{ 'mm.login.firsttime' | translate }}

+

{{ 'core.login.firsttime' | translate }}

- +
diff --git a/src/core/login/pages/credentials/credentials.ts b/src/core/login/pages/credentials/credentials.ts index 64b814940..50b5d05a1 100644 --- a/src/core/login/pages/credentials/credentials.ts +++ b/src/core/login/pages/credentials/credentials.ts @@ -140,7 +140,7 @@ export class CoreLoginCredentialsPage { if (this.siteConfig) { this.siteName = this.siteConfig.sitename; this.logoUrl = this.siteConfig.logourl || this.siteConfig.compactlogourl; - this.authInstructions = this.siteConfig.authinstructions || this.translate.instant('mm.login.loginsteps'); + this.authInstructions = this.siteConfig.authinstructions || this.translate.instant('core.login.loginsteps'); this.canSignup = this.siteConfig.registerauth == 'email' && !this.loginHelper.isEmailSignupDisabled(this.siteConfig); this.identityProviders = this.loginHelper.getValidIdentityProviders(this.siteConfig); @@ -182,16 +182,16 @@ export class CoreLoginCredentialsPage { } if (!username) { - this.domUtils.showErrorModal('mm.login.usernamerequired', true); + this.domUtils.showErrorModal('core.login.usernamerequired', true); return; } if (!password) { - this.domUtils.showErrorModal('mm.login.passwordrequired', true); + this.domUtils.showErrorModal('core.login.passwordrequired', true); return; } if (!this.appProvider.isOnline()) { - this.domUtils.showErrorModal('mm.core.networkerrormsg', true); + this.domUtils.showErrorModal('core.networkerrormsg', true); return; } diff --git a/src/core/login/pages/email-signup/email-signup.html b/src/core/login/pages/email-signup/email-signup.html index 77eaa0385..bf242c12a 100644 --- a/src/core/login/pages/email-signup/email-signup.html +++ b/src/core/login/pages/email-signup/email-signup.html @@ -1,9 +1,9 @@ - {{ 'mm.login.newaccount' | translate }} + {{ 'core.login.newaccount' | translate }} - @@ -11,7 +11,7 @@ - + @@ -27,17 +27,17 @@ - {{ 'mm.login.createuserandpass' | translate }} + {{ 'core.login.createuserandpass' | translate }} - {{ 'mm.login.username' | translate }} - + {{ 'core.login.username' | translate }} + - {{ 'mm.login.password' | translate }} + {{ 'core.login.password' | translate }} - +

{{settings.passwordpolicy}} @@ -47,31 +47,31 @@ - {{ 'mm.login.supplyinfo' | translate }} + {{ 'core.login.supplyinfo' | translate }} - {{ 'mm.user.email' | translate }} - + {{ 'core.user.email' | translate }} + - {{ 'mm.user.emailagain' | translate }} - + {{ 'core.user.emailagain' | translate }} + - {{ 'mm.user.' + nameField | translate }} - + {{ 'core.user.' + nameField | translate }} + - {{ 'mm.user.city' | translate }} - + {{ 'core.user.city' | translate }} + - {{ 'mm.user.country' | translate }} + {{ 'core.user.country' | translate }} - {{ 'mm.login.selectacountry' | translate }} + {{ 'core.login.selectacountry' | translate }} {{countries[key]}} @@ -84,29 +84,29 @@

- {{ 'mm.login.security_question' | translate }} + {{ 'core.login.security_question' | translate }} - {{ 'mm.login.recaptchachallengeimage' | translate }} + {{ 'core.login.recaptchachallengeimage' | translate }} - {{ 'mm.login.enterthewordsabove' | translate }} - + {{ 'core.login.enterthewordsabove' | translate }} + - {{ 'mm.login.getanothercaptcha' | translate }} + {{ 'core.login.getanothercaptcha' | translate }}
- {{ 'mm.login.policyagreement' | translate }} + {{ 'core.login.policyagreement' | translate }} -

{{ 'mm.login.policyagreementclick' | translate }}

+

{{ 'core.login.policyagreementclick' | translate }}

- {{ 'mm.login.policyaccept' | translate }} + {{ 'core.login.policyaccept' | translate }} @@ -114,7 +114,7 @@ - + diff --git a/src/core/login/pages/email-signup/email-signup.ts b/src/core/login/pages/email-signup/email-signup.ts index 93cd7489e..cd87027c3 100644 --- a/src/core/login/pages/email-signup/email-signup.ts +++ b/src/core/login/pages/email-signup/email-signup.ts @@ -68,11 +68,11 @@ export class CoreLoginEmailSignupPage { }); // Setup validation errors. - this.usernameErrors = this.loginHelper.getErrorMessages('mm.login.usernamerequired'); - this.passwordErrors = this.loginHelper.getErrorMessages('mm.login.passwordrequired'); - this.emailErrors = this.loginHelper.getErrorMessages('mm.login.missingemail'); - this.email2Errors = this.loginHelper.getErrorMessages('mm.login.missingemail', null, 'mm.login.emailnotmatch'); - this.policyErrors = this.loginHelper.getErrorMessages('mm.login.policyagree'); + this.usernameErrors = this.loginHelper.getErrorMessages('core.login.usernamerequired'); + this.passwordErrors = this.loginHelper.getErrorMessages('core.login.passwordrequired'); + this.emailErrors = this.loginHelper.getErrorMessages('core.login.missingemail'); + this.email2Errors = this.loginHelper.getErrorMessages('core.login.missingemail', null, 'core.login.emailnotmatch'); + this.policyErrors = this.loginHelper.getErrorMessages('core.login.policyagree'); } /** @@ -139,7 +139,7 @@ export class CoreLoginEmailSignupPage { this.namefieldsErrors = {}; if (settings.namefields) { settings.namefields.forEach((field) => { - this.namefieldsErrors[field] = this.loginHelper.getErrorMessages('mm.login.missing' + field); + this.namefieldsErrors[field] = this.loginHelper.getErrorMessages('core.login.missing' + field); }); } @@ -162,7 +162,7 @@ export class CoreLoginEmailSignupPage { return true; } else { this.domUtils.showErrorModal( - this.translate.instant('mm.login.signupplugindisabled', {$a: this.translate.instant('mm.login.auth_email')})); + this.translate.instant('core.login.signupplugindisabled', {$a: this.translate.instant('core.login.auth_email')})); this.navCtrl.pop(); return false; } @@ -203,7 +203,7 @@ export class CoreLoginEmailSignupPage { // Form not valid. Scroll to the first element with errors. if (!this.domUtils.scrollToInputError(this.content, document.body)) { // Input not found, show an error modal. - this.domUtils.showErrorModal('mm.core.errorinvalidform', true); + this.domUtils.showErrorModal('core.errorinvalidform', true); } } else { let params: any = { @@ -215,7 +215,7 @@ export class CoreLoginEmailSignupPage { city: this.textUtils.cleanTags(this.signupForm.value.city), country: this.signupForm.value.country }, - modal = this.domUtils.showModalLoading('mm.core.sending', true); + modal = this.domUtils.showModalLoading('core.sending', true); if (this.siteConfig.launchurl) { let service = this.sitesProvider.determineService(this.siteUrl); @@ -235,21 +235,21 @@ export class CoreLoginEmailSignupPage { this.wsProvider.callAjax('auth_email_signup_user', params, {siteUrl: this.siteUrl}).then((result) => { if (result.success) { // Show alert and ho back. - let message = this.translate.instant('mm.login.emailconfirmsent', {$a: params.email}); - this.domUtils.showAlert('mm.core.success', message); + let message = this.translate.instant('core.login.emailconfirmsent', {$a: params.email}); + this.domUtils.showAlert('core.success', message); this.navCtrl.pop(); } else { if (result.warnings && result.warnings.length) { this.domUtils.showErrorModal(result.warnings[0].message); } else { - this.domUtils.showErrorModal('mm.login.usernotaddederror', true); + this.domUtils.showErrorModal('core.login.usernotaddederror', true); } // Error sending, request another capctha since the current one is probably invalid now. this.requestCaptcha(true); } }).catch((error) => { - this.domUtils.showErrorModalDefault(error && error.error, 'mm.login.usernotaddederror', true); + this.domUtils.showErrorModalDefault(error && error.error, 'core.login.usernotaddederror', true); // Error sending, request another capctha since the current one is probably invalid now. this.requestCaptcha(true); @@ -263,6 +263,6 @@ export class CoreLoginEmailSignupPage { * Show authentication instructions. */ protected showAuthInstructions() { - this.textUtils.expandText(this.translate.instant('mm.login.instructions'), this.authInstructions, true); + this.textUtils.expandText(this.translate.instant('core.login.instructions'), this.authInstructions, true); } } diff --git a/src/core/login/pages/forgotten-password/forgotten-password.html b/src/core/login/pages/forgotten-password/forgotten-password.html index 29cb8052b..0778e033a 100644 --- a/src/core/login/pages/forgotten-password/forgotten-password.html +++ b/src/core/login/pages/forgotten-password/forgotten-password.html @@ -1,32 +1,32 @@ - {{ 'mm.login.passwordforgotten' | translate }} + {{ 'core.login.passwordforgotten' | translate }} - {{ 'mm.login.passwordforgotteninstructions2' | translate }} + {{ 'core.login.passwordforgotteninstructions2' | translate }}
- {{ 'mm.login.searchby' | translate }} + {{ 'core.login.searchby' | translate }}
- {{ 'mm.login.username' | translate }} + {{ 'core.login.username' | translate }} - {{ 'mm.user.email' | translate }} + {{ 'core.user.email' | translate }}
- + - +
diff --git a/src/core/login/pages/forgotten-password/forgotten-password.ts b/src/core/login/pages/forgotten-password/forgotten-password.ts index f10f05f77..1b812040e 100644 --- a/src/core/login/pages/forgotten-password/forgotten-password.ts +++ b/src/core/login/pages/forgotten-password/forgotten-password.ts @@ -49,11 +49,11 @@ export class CoreLoginForgottenPasswordPage { value = this.myForm.value.value; if (!value) { - this.domUtils.showErrorModal('mm.login.usernameoremail', true); + this.domUtils.showErrorModal('core.login.usernameoremail', true); return; } - let modal = this.domUtils.showModalLoading('mm.core.sending', true), + let modal = this.domUtils.showModalLoading('core.sending', true), isMail = field == 'email'; this.loginHelper.requestPasswordReset(this.siteUrl, isMail ? '' : value, isMail ? value : '').then((response) => { @@ -65,7 +65,7 @@ export class CoreLoginForgottenPasswordPage { this.domUtils.showErrorModal(response.notice); } else { // Success. - this.domUtils.showAlert(this.translate.instant('mm.core.success'), response.notice); + this.domUtils.showAlert(this.translate.instant('core.success'), response.notice); this.navCtrl.pop(); } }).catch((error) => { diff --git a/src/core/login/pages/reconnect/reconnect.html b/src/core/login/pages/reconnect/reconnect.html index c6f800266..d4b9e386b 100644 --- a/src/core/login/pages/reconnect/reconnect.html +++ b/src/core/login/pages/reconnect/reconnect.html @@ -1,6 +1,6 @@ - {{ 'mm.login.reconnect' | translate }} + {{ 'core.login.reconnect' | translate }} @@ -8,7 +8,7 @@ - {{ 'mm.core.pictureof' | translate:{$a: site.fullname} }} + {{ 'core.pictureof' | translate:{$a: site.fullname} }} @@ -22,28 +22,28 @@

{{siteUrl}}

- {{ 'mm.login.reconnectdescription' | translate }} + {{ 'core.login.reconnectdescription' | translate }}

-

{{ 'mm.login.username' | translate }}

+

{{ 'core.login.username' | translate }}

{{username}}

- + - {{ 'mm.login.cancel' | translate }} - + {{ 'core.login.cancel' | translate }} +
-

{{ 'mm.login.potentialidps' | translate }}

+

{{ 'core.login.potentialidps' | translate }}

{{provider.name}} {{provider.name}} diff --git a/src/core/login/pages/reconnect/reconnect.ts b/src/core/login/pages/reconnect/reconnect.ts index 162bb62d5..680f0c1f8 100644 --- a/src/core/login/pages/reconnect/reconnect.ts +++ b/src/core/login/pages/reconnect/reconnect.ts @@ -117,12 +117,12 @@ export class CoreLoginReconnectPage { password = this.credForm.value.password; if (!password) { - this.domUtils.showErrorModal('mm.login.passwordrequired', true); + this.domUtils.showErrorModal('core.login.passwordrequired', true); return; } if (!this.appProvider.isOnline()) { - this.domUtils.showErrorModal('mm.core.networkerrormsg', true); + this.domUtils.showErrorModal('core.networkerrormsg', true); return; } @@ -144,7 +144,7 @@ export class CoreLoginReconnectPage { } }).catch((error) => { // Site deleted? Go back to login page. - this.domUtils.showErrorModal('mm.login.errorupdatesite', true); + this.domUtils.showErrorModal('core.login.errorupdatesite', true); this.cancel(); }); }); diff --git a/src/core/login/pages/site-error/site-error.html b/src/core/login/pages/site-error/site-error.html index 071683560..fef796622 100644 --- a/src/core/login/pages/site-error/site-error.html +++ b/src/core/login/pages/site-error/site-error.html @@ -1,24 +1,24 @@ - {{ 'mm.core.error' | translate }} + {{ 'core.error' | translate }} - -

{{ 'mm.core.whoops' | translate }}

-

{{ 'mm.login.problemconnectingerror' | translate }}

+

{{ 'core.whoops' | translate }}

+

{{ 'core.login.problemconnectingerror' | translate }}

{{siteUrl}}

-

{{ 'mm.login.problemconnectingerrorcontinue' | translate }}

- -

{{ 'mm.login.stillcantconnect' | translate }}

-

{{ 'mm.login.contactyouradministrator' | translate }}

+

{{ 'core.login.problemconnectingerrorcontinue' | translate }}

+ +

{{ 'core.login.stillcantconnect' | translate }}

+

{{ 'core.login.contactyouradministrator' | translate }}

- {{ 'mm.login.contactyouradministratorissue' | translate:{$a: ''} }} + {{ 'core.login.contactyouradministratorissue' | translate:{$a: ''} }}

diff --git a/src/core/login/pages/site-help/site-help.html b/src/core/login/pages/site-help/site-help.html index 639ad7440..9c9b4bdd4 100644 --- a/src/core/login/pages/site-help/site-help.html +++ b/src/core/login/pages/site-help/site-help.html @@ -1,14 +1,14 @@ - {{ 'mm.login.help' | translate }} + {{ 'core.login.help' | translate }} - - + diff --git a/src/core/login/pages/site-policy/site-policy.html b/src/core/login/pages/site-policy/site-policy.html index dbcafdfd4..0b646391d 100644 --- a/src/core/login/pages/site-policy/site-policy.html +++ b/src/core/login/pages/site-policy/site-policy.html @@ -1,23 +1,23 @@ - {{ 'mm.login.policyagreement' | translate }} + {{ 'core.login.policyagreement' | translate }} - {{ 'mm.login.policyagree' | translate }} + {{ 'core.login.policyagree' | translate }} -

{{ 'mm.login.policyagreementclick' | translate }}

+

{{ 'core.login.policyagreementclick' | translate }}

- - + + diff --git a/src/core/login/pages/site-policy/site-policy.ts b/src/core/login/pages/site-policy/site-policy.ts index 1c051b005..c344efbec 100644 --- a/src/core/login/pages/site-policy/site-policy.ts +++ b/src/core/login/pages/site-policy/site-policy.ts @@ -103,7 +103,7 @@ export class CoreLoginSitePolicyPage { * Accept the site policy. */ accept() : void { - let modal = this.domUtils.showModalLoading('mm.core.sending', true); + let modal = this.domUtils.showModalLoading('core.sending', true); this.loginHelper.acceptSitePolicy(this.siteId).then(() => { // Success accepting, go to site initial page. // Invalidate cache since some WS don't return error if site policy is not accepted. diff --git a/src/core/login/pages/site/site.html b/src/core/login/pages/site/site.html index 88afa3c4c..f62d3969c 100644 --- a/src/core/login/pages/site/site.html +++ b/src/core/login/pages/site/site.html @@ -1,9 +1,9 @@ - {{ 'mm.login.connecttomoodle' | translate }} + {{ 'core.login.connecttomoodle' | translate }} - @@ -18,9 +18,9 @@
-

{{ 'mm.login.newsitedescription' | translate }}

+

{{ 'core.login.newsitedescription' | translate }}

- +
@@ -29,21 +29,21 @@ - {{ 'mm.login.selectsite' | translate }} - + {{ 'core.login.selectsite' | translate }} + {{site.name}}
-

{{ 'mm.login.selectsite' | translate }}

+

{{ 'core.login.selectsite' | translate }}

{{site.name}}
- +
diff --git a/src/core/login/pages/site/site.ts b/src/core/login/pages/site/site.ts index ec1d9034f..26ff5b05d 100644 --- a/src/core/login/pages/site/site.ts +++ b/src/core/login/pages/site/site.ts @@ -58,12 +58,12 @@ export class CoreLoginSitePage { this.appProvider.closeKeyboard(); if (!url) { - this.domUtils.showErrorModal('mm.login.siteurlrequired', true); + this.domUtils.showErrorModal('core.login.siteurlrequired', true); return; } if (!this.appProvider.isOnline()) { - this.domUtils.showErrorModal('mm.core.networkerrormsg', true); + this.domUtils.showErrorModal('core.networkerrormsg', true); return; } diff --git a/src/core/login/pages/sites/sites.html b/src/core/login/pages/sites/sites.html index 138e2158b..cbab72da6 100644 --- a/src/core/login/pages/sites/sites.html +++ b/src/core/login/pages/sites/sites.html @@ -1,12 +1,12 @@ - {{ 'mm.settings.sites' | translate }} + {{ 'core.settings.sites' | translate }} - - @@ -16,13 +16,13 @@ - {{ 'mm.core.pictureof' | translate:{$a: site.fullname} }} + {{ 'core.pictureof' | translate:{$a: site.fullname} }}

{{site.fullName}}

{{site.siteUrl}}

{{site.badge}} -
diff --git a/src/core/login/pages/sites/sites.ts b/src/core/login/pages/sites/sites.ts index cbbbc498d..d6ba555cd 100644 --- a/src/core/login/pages/sites/sites.ts +++ b/src/core/login/pages/sites/sites.ts @@ -101,7 +101,7 @@ export class CoreLoginSitesPage { siteName = site.siteName; this.textUtils.formatText(siteName).then((siteName) => { - this.domUtils.showConfirm(this.translate.instant('mm.login.confirmdeletesite', {sitename: siteName})).then(() => { + this.domUtils.showConfirm(this.translate.instant('core.login.confirmdeletesite', {sitename: siteName})).then(() => { this.sitesProvider.deleteSite(site.id).then(() => { this.sites.splice(index, 1); this.showDelete = false; @@ -113,7 +113,7 @@ export class CoreLoginSitesPage { }).catch((error) => { this.logger.error('Error deleting site ' + site.id, error); this.domUtils.showErrorModalDefault(error, 'Delete site failed.'); - this.domUtils.showErrorModal('mm.login.errordeletesite', true); + this.domUtils.showErrorModal('core.login.errordeletesite', true); }); }).catch(() => { // User cancelled, nothing to do. diff --git a/src/core/login/providers/helper.ts b/src/core/login/providers/helper.ts index 6a0fa8e32..100aebaef 100644 --- a/src/core/login/providers/helper.ts +++ b/src/core/login/providers/helper.ts @@ -130,7 +130,7 @@ export class CoreLoginHelperProvider { return false; } - let modal = this.domUtils.showModalLoading('mm.login.authenticating', true), + let modal = this.domUtils.showModalLoading('core.login.authenticating', true), siteData: CoreLoginSSOData; // Wait for app to be ready. @@ -198,7 +198,7 @@ export class CoreLoginHelperProvider { promise; if (showConfirmation) { - promise = this.domUtils.showConfirm(this.translate.instant('mm.login.logininsiterequired')); + promise = this.domUtils.showConfirm(this.translate.instant('core.login.logininsiterequired')); } else { promise = Promise.resolve(); } @@ -442,10 +442,10 @@ export class CoreLoginHelperProvider { this.sitesProvider.updateSiteInfoByUrl(info.siteurl, info.username); }).catch(() => { // Error updating token, return proper error message. - return Promise.reject(this.translate.instant('mm.login.errorupdatesite')); + return Promise.reject(this.translate.instant('core.login.errorupdatesite')); }); } - return Promise.reject(this.translate.instant('mm.login.errorupdatesite')); + return Promise.reject(this.translate.instant('core.login.errorupdatesite')); } else { return this.sitesProvider.newSite(siteUrl, token, privateToken); } @@ -667,7 +667,7 @@ export class CoreLoginHelperProvider { if (this.isSSOEmbeddedBrowser(typeOfLogin)) { let options = { clearsessioncache: 'yes', // Clear the session cache to allow for multiple logins. - closebuttoncaption: this.translate.instant('mm.login.cancel'), + closebuttoncaption: this.translate.instant('core.login.cancel'), } this.utils.openInApp(loginUrl, options); } else { @@ -685,7 +685,7 @@ export class CoreLoginHelperProvider { * @param {string} error Error message. */ openChangePassword(siteUrl: string, error: string) : void { - let alert = this.domUtils.showAlert(this.translate.instant('mm.core.notice'), error, null, 3000); + let alert = this.domUtils.showAlert(this.translate.instant('core.notice'), error, null, 3000); alert.onDidDismiss(() => { this.utils.openInApp(siteUrl + '/login/change_password.php'); }); @@ -728,7 +728,7 @@ export class CoreLoginHelperProvider { } // Open change password. - alertMessage = this.translate.instant(alertMessage) + '
' + this.translate.instant('mm.core.redirectingtosite'); + alertMessage = this.translate.instant(alertMessage) + '
' + this.translate.instant('core.redirectingtosite'); currentSite.openInAppWithAutoLogin(siteUrl + path, undefined, alertMessage).then(() => { this.waitingForBrowser = true; }).finally(() => { @@ -823,7 +823,7 @@ export class CoreLoginHelperProvider { this.isSSOConfirmShown = true; if (this.shouldShowSSOConfirm(result.code)) { - promise = this.domUtils.showConfirm(this.translate.instant('mm.login.' + + promise = this.domUtils.showConfirm(this.translate.instant('core.login.' + (currentSite.isLoggedOut() ? 'loggedoutssodescription' : 'reconnectssodescription'))); } else { promise = Promise.resolve(); @@ -857,7 +857,7 @@ export class CoreLoginHelperProvider { // Error checking site. if (currentSite.isLoggedOut()) { // Site is logged out, show error and logout the user. - this.domUtils.showErrorModalDefault(error, 'mm.core.networkerrormsg', true); + this.domUtils.showErrorModalDefault(error, 'core.networkerrormsg', true); this.sitesProvider.logout(); } }); @@ -966,7 +966,7 @@ export class CoreLoginHelperProvider { } else { this.logger.debug('Invalid signature in the URL request yours: ' + params[0] + ' mine: ' + signature + ' for passport ' + passport); - return Promise.reject(this.translate.instant('mm.core.unexpectederror')); + return Promise.reject(this.translate.instant('core.unexpectederror')); } }); } diff --git a/src/core/viewer/pages/text/text.html b/src/core/viewer/pages/text/text.html index ad4992298..dfb15aacb 100644 --- a/src/core/viewer/pages/text/text.html +++ b/src/core/viewer/pages/text/text.html @@ -3,7 +3,7 @@ {{ title }} - diff --git a/src/directives/format-text.ts b/src/directives/format-text.ts index e6f9226ef..bf034f643 100644 --- a/src/directives/format-text.ts +++ b/src/directives/format-text.ts @@ -124,7 +124,7 @@ export class CoreFormatTextDirective implements OnInit { if (imgWidth > elWidth) { let imgSrc = this.textUtils.escapeHTML(img.getAttribute('src')), - label = this.textUtils.escapeHTML(this.translate.instant('mm.core.openfullimage')); + label = this.textUtils.escapeHTML(this.translate.instant('core.openfullimage')); // @todo: Implement image viewer. Maybe we can add the listener here directly? container.innerHTML += '' + this.translate.instant('mm.core.showmore') + '
'; + this.element.innerHTML += '
' + this.translate.instant('core.showmore') + '
'; if (expandInFullview) { this.element.classList.add('mm-expand-in-fullview'); @@ -195,7 +195,7 @@ export class CoreFormatTextDirective implements OnInit { // Open a new state with the contents. // @todo: brOnFull is needed? - this.textUtils.expandText(this.fullTitle || this.translate.instant('mm.core.description'), this.text, + this.textUtils.expandText(this.fullTitle || this.translate.instant('core.description'), this.text, false, this.component, this.componentId); }); } diff --git a/src/pipes/date-day-or-time.ts b/src/pipes/date-day-or-time.ts index d216c150a..0ebfd1e88 100644 --- a/src/pipes/date-day-or-time.ts +++ b/src/pipes/date-day-or-time.ts @@ -58,9 +58,9 @@ export class CoreDateDayOrTimePipe implements PipeTransform { } return moment(timestamp * 1000).calendar(null, { - sameDay: this.translate.instant('mm.core.dftimedate'), - lastDay: this.translate.instant('mm.core.dflastweekdate'), - lastWeek: this.translate.instant('mm.core.dflastweekdate') + sameDay: this.translate.instant('core.dftimedate'), + lastDay: this.translate.instant('core.dflastweekdate'), + lastWeek: this.translate.instant('core.dflastweekdate') }); } } diff --git a/src/pipes/format-date.ts b/src/pipes/format-date.ts index d4c4b491a..387fc017e 100644 --- a/src/pipes/format-date.ts +++ b/src/pipes/format-date.ts @@ -34,8 +34,8 @@ export class CoreFormatDatePipe implements PipeTransform { * Format a date. * * @param {string|number} timestamp Timestamp to format (in milliseconds). If not defined, use current time. - * @param {string} format Format to use. It should be a string code to handle i18n (e.g. mm.core.dftimedate). If the code - * doesn't have a prefix, 'mm.core' will be used by default. E.g. 'dftimedate' -> 'mm.core.dftimedate'. + * @param {string} format Format to use. It should be a string code to handle i18n (e.g. core.dftimedate). If the code + * doesn't have a prefix, 'core' will be used by default. E.g. 'dftimedate' -> 'core.dftimedate'. * @return {String} Formatted date. */ transform(timestamp: string|number, format: string) { @@ -52,7 +52,7 @@ export class CoreFormatDatePipe implements PipeTransform { } if (format.indexOf('.') == -1) { - format = 'mm.core.' + format; + format = 'core.' + format; } return moment(timestamp).format(this.translate.instant(format)); } diff --git a/src/providers/groups.ts b/src/providers/groups.ts index f099976a3..0762719dc 100644 --- a/src/providers/groups.ts +++ b/src/providers/groups.ts @@ -138,7 +138,7 @@ export class CoreGroupsProvider { groupInfo.visibleGroups = false; } else { if (addAllParts || groupInfo.visibleGroups) { - groupInfo.groups.push({id: 0, name: this.translate.instant('mm.core.allparticipants')}); + groupInfo.groups.push({id: 0, name: this.translate.instant('core.allparticipants')}); } groupInfo.groups = groupInfo.groups.concat(groups); } diff --git a/src/providers/sites.ts b/src/providers/sites.ts index 7ad1545c6..ff9877eec 100644 --- a/src/providers/sites.ts +++ b/src/providers/sites.ts @@ -168,9 +168,9 @@ export class CoreSitesProvider { siteUrl = this.urlUtils.formatURL(siteUrl); if (!this.urlUtils.isHttpURL(siteUrl)) { - return Promise.reject(this.translate.instant('mm.login.invalidsite')); + return Promise.reject(this.translate.instant('core.login.invalidsite')); } else if (!this.appProvider.isOnline()) { - return Promise.reject(this.translate.instant('mm.core.networkerrormsg')); + return Promise.reject(this.translate.instant('core.networkerrormsg')); } else { return this.checkSiteWithProtocol(siteUrl, protocol).catch((error) => { // Do not continue checking if a critical error happened. @@ -187,7 +187,7 @@ export class CoreSitesProvider { } else if (error.error) { return Promise.reject(error.error); } - return Promise.reject(this.translate.instant('mm.login.checksiteversion')); + return Promise.reject(this.translate.instant('core.login.checksiteversion')); }); }); } @@ -241,11 +241,11 @@ export class CoreSitesProvider { // Check that the user can authenticate. if (!config.enablewebservices) { - return rejectWithCriticalError(this.translate.instant('mm.login.webservicesnotenabled')); + return rejectWithCriticalError(this.translate.instant('core.login.webservicesnotenabled')); } else if (!config.enablemobilewebservice) { - return rejectWithCriticalError(this.translate.instant('mm.login.mobileservicesnotenabled')); + return rejectWithCriticalError(this.translate.instant('core.login.mobileservicesnotenabled')); } else if (config.maintenanceenabled) { - let message = this.translate.instant('mm.core.sitemaintenance'); + let message = this.translate.instant('core.sitemaintenance'); if (config.maintenancemessage) { message += config.maintenancemessage; } @@ -327,7 +327,7 @@ export class CoreSitesProvider { getUserToken(siteUrl: string, username: string, password: string, service?: string, retry?: boolean) : Promise { if (!this.appProvider.isOnline()) { - return Promise.reject(this.translate.instant('mm.core.networkerrormsg')); + return Promise.reject(this.translate.instant('core.networkerrormsg')); } if (!service) { @@ -343,7 +343,7 @@ export class CoreSitesProvider { return this.utils.observableToPromise(observable).then((data: any) : any => { if (typeof data == 'undefined') { - return Promise.reject(this.translate.instant('mm.core.cannotconnect')); + return Promise.reject(this.translate.instant('core.cannotconnect')); } else { if (typeof data.token != 'undefined') { return {token: data.token, siteUrl: siteUrl, privateToken: data.privatetoken}; @@ -359,12 +359,12 @@ export class CoreSitesProvider { return Promise.reject(data.error); } } else { - return Promise.reject(this.translate.instant('mm.login.invalidaccount')); + return Promise.reject(this.translate.instant('core.login.invalidaccount')); } } } }, () => { - return Promise.reject(this.translate.instant('mm.core.cannotconnect')); + return Promise.reject(this.translate.instant('core.cannotconnect')); }); } @@ -410,7 +410,7 @@ export class CoreSitesProvider { } else if (result == this.LEGACY_APP_VERSION) { return Promise.reject(this.translate.instant('mm.login.legacymoodleversion')); } else { - return Promise.reject(this.translate.instant('mm.login.invalidmoodleversion')); + return Promise.reject(this.translate.instant('core.login.invalidmoodleversion')); } }); } @@ -508,7 +508,7 @@ export class CoreSitesProvider { protected validateSiteInfo(info: any) : any { if (!info.firstname || !info.lastname) { const moodleLink = `
${info.siteurl}`; - return {error: 'mm.core.requireduserdatamissing', params: {'$a': moodleLink}}; + return {error: 'core.requireduserdatamissing', params: {'$a': moodleLink}}; } return true; } diff --git a/src/providers/utils/dom.ts b/src/providers/utils/dom.ts index f6f2ea770..1feaff433 100644 --- a/src/providers/utils/dom.ts +++ b/src/providers/utils/dom.ts @@ -91,7 +91,7 @@ export class CoreDomUtilsProvider { * If the download size is higher than a certain threshold shows a confirm dialog. * * @param {any} size Object containing size to download and a boolean to indicate if its totally or partialy calculated. - * @param {string} [message] Code of the message to show. Default: 'mm.course.confirmdownload'. + * @param {string} [message] Code of the message to show. Default: 'core.course.confirmdownload'. * @param {string} [unknownMessage] ID of the message to show if size is unknown. * @param {number} [wifiThreshold] Threshold to show confirm in WiFi connection. Default: CoreWifiDownloadThreshold. * @param {number} [limitedThreshold] Threshold to show confirm in limited connection. Default: CoreDownloadThreshold. @@ -104,14 +104,14 @@ export class CoreDomUtilsProvider { if (size.size < 0 || (size.size == 0 && !size.total)) { // Seems size was unable to be calculated. Show a warning. - unknownMessage = unknownMessage || 'mm.course.confirmdownloadunknownsize'; + unknownMessage = unknownMessage || 'core.course.confirmdownloadunknownsize'; return this.showConfirm(this.translate.instant(unknownMessage)); } else if (!size.total) { // Filesize is only partial. let readableSize = this.textUtils.bytesToSize(size.size, 2); - return this.showConfirm(this.translate.instant('mm.course.confirmpartialdownloadsize', {size: readableSize})); + return this.showConfirm(this.translate.instant('core.course.confirmpartialdownloadsize', {size: readableSize})); } else if (size.size >= wifiThreshold || (this.appProvider.isNetworkAccessLimited() && size.size >= limitedThreshold)) { - message = message || 'mm.course.confirmdownload'; + message = message || 'core.course.confirmdownload'; let readableSize = this.textUtils.bytesToSize(size.size, 2); return this.showConfirm(this.translate.instant(message, {size: readableSize})); } @@ -380,12 +380,12 @@ export class CoreDomUtilsProvider { * @return {string} Title. */ private getErrorTitle(message: string) : string { - if (message == this.translate.instant('mm.core.networkerrormsg') || - message == this.translate.instant('mm.fileuploader.errormustbeonlinetoupload')) { + if (message == this.translate.instant('core.networkerrormsg') || + message == this.translate.instant('core.fileuploader.errormustbeonlinetoupload')) { return '\ '; } - return this.textUtils.decodeHTML(this.translate.instant('mm.core.error')); + return this.textUtils.decodeHTML(this.translate.instant('core.error')); } /** @@ -610,7 +610,7 @@ export class CoreDomUtilsProvider { let alert = this.alertCtrl.create({ title: title, message: this.addFormatTextIfNeeded(message), // Add format-text to handle links. - buttons: [buttonText || this.translate.instant('mm.core.ok')] + buttons: [buttonText || this.translate.instant('core.ok')] }); alert.present(); @@ -662,14 +662,14 @@ export class CoreDomUtilsProvider { } options.buttons = [ { - text: cancelText || this.translate.instant('mm.core.cancel'), + text: cancelText || this.translate.instant('core.cancel'), role: 'cancel', handler: () => { reject(); } }, { - text: okText || this.translate.instant('mm.core.ok'), + text: okText || this.translate.instant('core.ok'), handler: () => { resolve(); } @@ -734,7 +734,7 @@ export class CoreDomUtilsProvider { /** * Displays a loading modal window. * - * @param {string} [text] The text of the modal window. Default: mm.core.loading. + * @param {string} [text] The text of the modal window. Default: core.loading. * @param {boolean} [needsTranslate] Whether the 'text' needs to be translated. * @return {Loading} Loading modal instance. * @description @@ -745,7 +745,7 @@ export class CoreDomUtilsProvider { */ showModalLoading(text?: string, needsTranslate?: boolean) : Loading { if (!text) { - text = this.translate.instant('mm.core.loading'); + text = this.translate.instant('core.loading'); } else if (needsTranslate) { text = this.translate.instant(text); } @@ -776,20 +776,20 @@ export class CoreDomUtilsProvider { inputs: [ { name: 'promptinput', - placeholder: placeholder || this.translate.instant('mm.login.password'), + placeholder: placeholder || this.translate.instant('core.login.password'), type: type } ], buttons: [ { - text: this.translate.instant('mm.core.cancel'), + text: this.translate.instant('core.cancel'), role: 'cancel', handler: () => { reject(); } }, { - text: this.translate.instant('mm.core.ok'), + text: this.translate.instant('core.ok'), handler: (data) => { resolve(data.promptinput); } diff --git a/src/providers/utils/mimetype.ts b/src/providers/utils/mimetype.ts index e8fe9861b..4d55fff19 100644 --- a/src/providers/utils/mimetype.ts +++ b/src/providers/utils/mimetype.ts @@ -323,7 +323,7 @@ export class CoreMimetypeUtilsProvider { let filename = '', mimetype = '', extension = '', - langPrefix = 'mm.core.mimetype-'; + langPrefix = 'core.mimetype-'; if (typeof obj == 'object' && typeof obj.file == 'function') { // It's a FileEntry. Don't use the file function because it's asynchronous and the type isn't reliable. @@ -422,7 +422,7 @@ export class CoreMimetypeUtilsProvider { * @return {string} Translated name. */ getTranslatedGroupName(name: string) : string { - let key = 'mm.core.mimetype-group:' + name, + let key = 'core.mimetype-group:' + name, translated = this.translate.instant(key); return translated != key ? translated : name; } diff --git a/src/providers/utils/text.ts b/src/providers/utils/text.ts index 0598e24e9..e045adc01 100644 --- a/src/providers/utils/text.ts +++ b/src/providers/utils/text.ts @@ -52,14 +52,14 @@ export class CoreTextUtilsProvider { bytesToSize(bytes: number, precision = 2) : string { if (typeof bytes == 'undefined' || bytes < 0) { - return this.translate.instant('mm.core.notapplicable'); + return this.translate.instant('core.notapplicable'); } if (precision < 0) { precision = 2; } - let keys = ['mm.core.sizeb', 'mm.core.sizekb', 'mm.core.sizemb', 'mm.core.sizegb', 'mm.core.sizetb'], + let keys = ['core.sizeb', 'core.sizekb', 'core.sizemb', 'core.sizegb', 'core.sizetb'], units = this.translate.instant(keys), pos = 0; @@ -71,7 +71,7 @@ export class CoreTextUtilsProvider { // Round to "precision" decimals if needed. bytes = Number(Math.round(parseFloat(bytes + 'e+' + precision)) + 'e-' + precision); } - return this.translate.instant('mm.core.humanreadablesize', {size: bytes, unit: units[keys[pos]]}); + return this.translate.instant('core.humanreadablesize', {size: bytes, unit: units[keys[pos]]}); } /** diff --git a/src/providers/utils/time.ts b/src/providers/utils/time.ts index a65b923e3..f4deaa138 100644 --- a/src/providers/utils/time.ts +++ b/src/providers/utils/time.ts @@ -44,11 +44,11 @@ export class CoreTimeUtilsProvider { let mins = Math.floor(remainder / CoreConstants.secondsMinute), secs = remainder - (mins * CoreConstants.secondsMinute), - ss = this.translate.instant('mm.core.' + (secs == 1 ? 'sec' : 'secs')), - sm = this.translate.instant('mm.core.' + (mins == 1 ? 'min' : 'mins')), - sh = this.translate.instant('mm.core.' + (hours == 1 ? 'hour' : 'hours')), - sd = this.translate.instant('mm.core.' + (days == 1 ? 'day' : 'days')), - sy = this.translate.instant('mm.core.' + (years == 1 ? 'year' : 'years')), + ss = this.translate.instant('core.' + (secs == 1 ? 'sec' : 'secs')), + sm = this.translate.instant('core.' + (mins == 1 ? 'min' : 'mins')), + sh = this.translate.instant('core.' + (hours == 1 ? 'hour' : 'hours')), + sd = this.translate.instant('core.' + (days == 1 ? 'day' : 'days')), + sy = this.translate.instant('core.' + (years == 1 ? 'year' : 'years')), oyears = '', odays = '', ohours = '', @@ -87,7 +87,7 @@ export class CoreTimeUtilsProvider { return osecs; } - return this.translate.instant('mm.core.now'); + return this.translate.instant('core.now'); } /** diff --git a/src/providers/utils/utils.ts b/src/providers/utils/utils.ts index 32857be31..9f077a25a 100644 --- a/src/providers/utils/utils.ts +++ b/src/providers/utils/utils.ts @@ -286,7 +286,7 @@ export class CoreUtilsProvider { copyToClipboard(text: string) : Promise { return this.clipboard.copy(text).then(() => { // Show toast using ionicLoading. - return this.domUtils.showToast('mm.core.copiedtoclipboard', true); + return this.domUtils.showToast('core.copiedtoclipboard', true); }).catch(() => { // Ignore errors. }); @@ -453,7 +453,7 @@ export class CoreUtilsProvider { return ''; } - let localeSeparator = this.translate.instant('mm.core.decsep'); + let localeSeparator = this.translate.instant('core.decsep'); // Convert float to string. float += ''; @@ -525,7 +525,7 @@ export class CoreUtilsProvider { * @return {string} Country name. If the country is not found, return the country code. */ getCountryName(code: string) : string { - let countryKey = 'mm.core.country-' + code, + let countryKey = 'core.country-' + code, countryName = this.translate.instant(countryKey); return countryName !== countryKey ? countryName : code; @@ -553,8 +553,8 @@ export class CoreUtilsProvider { let countries = {}; for (let name in table) { - if (name.indexOf('mm.core.country-') === 0) { - let code = name.replace('mm.core.country-', ''); + if (name.indexOf('core.country-') === 0) { + let code = name.replace('core.country-', ''); countries[code] = table[name]; } } @@ -580,7 +580,7 @@ export class CoreUtilsProvider { for (let i = 0; i < files.length; i++) { let name = files[i].filename || files[i].name; if (names.indexOf(name) > -1) { - return this.translate.instant('mm.core.filenameexist', {$a: name}); + return this.translate.instant('core.filenameexist', {$a: name}); } else { names.push(name); } @@ -641,17 +641,17 @@ export class CoreUtilsProvider { */ isWebServiceError(error: string) : boolean { let localErrors = [ - this.translate.instant('mm.core.wsfunctionnotavailable'), - this.translate.instant('mm.core.lostconnection'), - this.translate.instant('mm.core.userdeleted'), - this.translate.instant('mm.core.unexpectederror'), - this.translate.instant('mm.core.networkerrormsg'), - this.translate.instant('mm.core.serverconnection'), - this.translate.instant('mm.core.errorinvalidresponse'), - this.translate.instant('mm.core.sitemaintenance'), - this.translate.instant('mm.core.upgraderunning'), - this.translate.instant('mm.core.nopasswordchangeforced'), - this.translate.instant('mm.core.unicodenotsupported') + this.translate.instant('core.wsfunctionnotavailable'), + this.translate.instant('core.lostconnection'), + this.translate.instant('core.userdeleted'), + this.translate.instant('core.unexpectederror'), + this.translate.instant('core.networkerrormsg'), + this.translate.instant('core.serverconnection'), + this.translate.instant('core.errorinvalidresponse'), + this.translate.instant('core.sitemaintenance'), + this.translate.instant('core.upgraderunning'), + this.translate.instant('core.nopasswordchangeforced'), + this.translate.instant('core.unicodenotsupported') ]; return error && localErrors.indexOf(error) == -1; } @@ -687,7 +687,7 @@ export class CoreUtilsProvider { if (require('electron').ipcRenderer.sendSync('openItem', path)) { resolve(); } else { - reject(this.translate.instant('mm.core.erroropenfilenoapp')); + reject(this.translate.instant('core.erroropenfilenoapp')); } } else if ((window).plugins) { // @todo @@ -717,9 +717,9 @@ export class CoreUtilsProvider { // if (!extension || extension.indexOf('/') > -1 || extension.indexOf('\\') > -1) { // // Extension not found. - // $mmLang.translateAndRejectDeferred(deferred, 'mm.core.erroropenfilenoextension'); + // $mmLang.translateAndRejectDeferred(deferred, 'core.erroropenfilenoextension'); // } else { - // $mmLang.translateAndRejectDeferred(deferred, 'mm.core.erroropenfilenoapp'); + // $mmLang.translateAndRejectDeferred(deferred, 'core.erroropenfilenoapp'); // } // } // ); @@ -859,7 +859,7 @@ export class CoreUtilsProvider { // }).then(function(mimetype) { // if (!mimetype) { // // Couldn't retrieve mimetype. Return error. - // $mmLang.translateAndRejectDeferred(deferred, 'mm.core.erroropenfilenoextension'); + // $mmLang.translateAndRejectDeferred(deferred, 'core.erroropenfilenoextension'); // return; // } @@ -881,7 +881,7 @@ export class CoreUtilsProvider { // $log.debug('url: ' + iParams.url); // $log.debug('type: ' + iParams.type); - // $mmLang.translateAndRejectDeferred(deferred, 'mm.core.erroropenfilenoapp'); + // $mmLang.translateAndRejectDeferred(deferred, 'core.erroropenfilenoapp'); // } // ); // }); @@ -1120,7 +1120,7 @@ export class CoreUtilsProvider { return ''; } - let localeSeparator = this.translate.instant('mm.core.decsep'); + let localeSeparator = this.translate.instant('core.decsep'); localeFloat = localeFloat.replace(' ', ''); // No spaces - those might be used as thousand separators. localeFloat = localeFloat.replace(localeSeparator, '.'); diff --git a/src/providers/ws.ts b/src/providers/ws.ts index 040667f4f..d5fb825f4 100644 --- a/src/providers/ws.ts +++ b/src/providers/ws.ts @@ -116,9 +116,9 @@ export class CoreWSProvider { let siteUrl; if (!preSets) { - return Promise.reject(this.createFakeWSError('mm.core.unexpectederror', true)); + return Promise.reject(this.createFakeWSError('core.unexpectederror', true)); } else if (!this.appProvider.isOnline()) { - return Promise.reject(this.createFakeWSError('mm.core.networkerrormsg', true)); + return Promise.reject(this.createFakeWSError('core.networkerrormsg', true)); } preSets.typeExpected = preSets.typeExpected || 'object'; @@ -161,9 +161,9 @@ export class CoreWSProvider { ajaxData; if (typeof preSets.siteUrl == 'undefined') { - return rejectWithError(this.translate.instant('mm.core.unexpectederror')); + return rejectWithError(this.translate.instant('core.unexpectederror')); } else if (!this.appProvider.isOnline()) { - return rejectWithError(this.translate.instant('mm.core.networkerrormsg')); + return rejectWithError(this.translate.instant('core.networkerrormsg')); } if (typeof preSets.responseExpected == 'undefined') { @@ -188,7 +188,7 @@ export class CoreWSProvider { // Check if error. Ajax layer should always return an object (if error) or an array (if success). if (!data || typeof data != 'object') { - return rejectWithError(this.translate.instant('mm.core.serverconnection')); + return rejectWithError(this.translate.instant('core.serverconnection')); } else if (data.error) { return rejectWithError(data.error, data.errorcode); } @@ -203,7 +203,7 @@ export class CoreWSProvider { return data.data; }, (data) => { let available = data.status == 404 ? -1 : 0; - return rejectWithError(this.translate.instant('mm.core.serverconnection'), '', available); + return rejectWithError(this.translate.instant('core.serverconnection'), '', available); }); // Convenience function to return an error. @@ -286,7 +286,7 @@ export class CoreWSProvider { this.logger.debug('Downloading file', url, path, addExtension); if (!this.appProvider.isOnline()) { - return Promise.reject(this.translate.instant('mm.core.networkerrormsg')); + return Promise.reject(this.translate.instant('core.networkerrormsg')); } // Use a tmp path to download the file and then move it to final location. This is because if the download fails, @@ -463,10 +463,10 @@ export class CoreWSProvider { } if (!data) { - return Promise.reject(this.createFakeWSError('mm.core.serverconnection', true)); + return Promise.reject(this.createFakeWSError('core.serverconnection', true)); } else if (typeof data != preSets.typeExpected) { this.logger.warn('Response of type "' + typeof data + `" received, expecting "${preSets.typeExpected}"`); - return Promise.reject(this.createFakeWSError('mm.core.errorinvalidresponse', true)); + return Promise.reject(this.createFakeWSError('core.errorinvalidresponse', true)); } if (typeof data.exception !== 'undefined') { @@ -502,7 +502,7 @@ export class CoreWSProvider { return retryPromise; } - return Promise.reject(this.createFakeWSError('mm.core.serverconnection', true)); + return Promise.reject(this.createFakeWSError('core.serverconnection', true)); }); promise = this.setPromiseHttp(promise, 'post', preSets.siteUrl, ajaxData); @@ -574,10 +574,10 @@ export class CoreWSProvider { }; if (!preSets) { - errorResponse.message = this.translate.instant('mm.core.unexpectederror'); + errorResponse.message = this.translate.instant('core.unexpectederror'); return errorResponse; } else if (!this.appProvider.isOnline()) { - errorResponse.message = this.translate.instant('mm.core.networkerrormsg'); + errorResponse.message = this.translate.instant('core.networkerrormsg'); return errorResponse; } @@ -590,7 +590,7 @@ export class CoreWSProvider { data = this.convertValuesToString(data, preSets.cleanUnicode); } catch (e) { // Empty cleaned text found. - errorResponse.message = this.translate.instant('mm.core.unicodenotsupportedcleanerror'); + errorResponse.message = this.translate.instant('core.unicodenotsupportedcleanerror'); return errorResponse; } @@ -631,10 +631,10 @@ export class CoreWSProvider { } if (!data) { - errorResponse.message = this.translate.instant('mm.core.serverconnection'); + errorResponse.message = this.translate.instant('core.serverconnection'); } else if (typeof data != preSets.typeExpected) { this.logger.warn('Response of type "' + typeof data + '" received, expecting "' + preSets.typeExpected + '"'); - errorResponse.message = this.translate.instant('mm.core.errorinvalidresponse'); + errorResponse.message = this.translate.instant('core.errorinvalidresponse'); } if (typeof data.exception != 'undefined' || typeof data.debuginfo != 'undefined') { @@ -666,7 +666,7 @@ export class CoreWSProvider { } if (!this.appProvider.isOnline()) { - return Promise.reject(this.translate.instant('mm.core.networkerrormsg')); + return Promise.reject(this.translate.instant('core.networkerrormsg')); } let uploadUrl = preSets.siteUrl + '/webservice/upload.php', @@ -691,14 +691,14 @@ export class CoreWSProvider { data = JSON.parse(data); } catch(err) { this.logger.error('Error parsing response from upload:', err, data); - return Promise.reject(this.translate.instant('mm.core.errorinvalidresponse')); + return Promise.reject(this.translate.instant('core.errorinvalidresponse')); } if (!data) { - return Promise.reject(this.translate.instant('mm.core.serverconnection')); + return Promise.reject(this.translate.instant('core.serverconnection')); } else if (typeof data != 'object') { this.logger.warn('Upload file: Response of type "' + typeof data + '" received, expecting "object"'); - return Promise.reject(this.translate.instant('mm.core.errorinvalidresponse')); + return Promise.reject(this.translate.instant('core.errorinvalidresponse')); } if (typeof data.exception !== 'undefined') { @@ -714,7 +714,7 @@ export class CoreWSProvider { return data[0]; }).catch((error) => { this.logger.error('Error while uploading file', filePath, error); - return Promise.reject(this.translate.instant('mm.core.errorinvalidresponse')); + return Promise.reject(this.translate.instant('core.errorinvalidresponse')); }); } }