From b7322d696d2a2a243c6c13111043ccee102a6f2c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pau=20Ferrer=20Oca=C3=B1a?= Date: Fri, 17 Nov 2023 13:54:42 +0100 Subject: [PATCH] MOBILE-3947 lang: Remove usage of Ionic 1 strings types (mm and mma) --- .../mod/workshop/pages/assessment/assessment.ts | 2 +- src/core/services/lang.ts | 13 ++++--------- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/src/addons/mod/workshop/pages/assessment/assessment.ts b/src/addons/mod/workshop/pages/assessment/assessment.ts index ecc6ddad3..61fded7ba 100644 --- a/src/addons/mod/workshop/pages/assessment/assessment.ts +++ b/src/addons/mod/workshop/pages/assessment/assessment.ts @@ -268,7 +268,7 @@ export class AddonModWorkshopAssessmentPage implements OnInit, OnDestroy, CanLea this.evaluateByProfile = await CoreUser.getProfile(this.assessment.gradinggradeoverby, this.courseId, true); } } catch (error) { - CoreDomUtils.showErrorModalDefault(error, 'mm.course.errorgetmodule', true); + CoreDomUtils.showErrorModalDefault(error, 'core.course.errorgetmodule', true); } finally { this.loaded = true; } diff --git a/src/core/services/lang.ts b/src/core/services/lang.ts index 78fd63355..f7e14e911 100644 --- a/src/core/services/lang.ts +++ b/src/core/services/lang.ts @@ -381,7 +381,7 @@ export class CoreLangProvider { * @param strings Custom strings to load (tool_mobile_customlangstrings). */ loadCustomStrings(strings: string): void { - if (strings == this.customStringsRaw) { + if (strings === this.customStringsRaw) { // Strings haven't changed, stop. return; } @@ -404,9 +404,9 @@ export class CoreLangProvider { return; } - const lang = values[2].replace(/_/g, '-'); // Use the app format instead of Moodle format. + const lang = this.formatLanguage(values[2], CoreLangFormat.App); // Use the app format instead of Moodle format. - if (lang == this.currentLanguage) { + if (lang === this.currentLanguage) { currentLangChanged = true; } @@ -414,12 +414,7 @@ export class CoreLangProvider { this.customStrings[lang] = {}; } - // Convert old keys format to new one. - const key = values[0].replace(/^mm\.core/, 'core').replace(/^mm\./, 'core.').replace(/^mma\./, 'addon.') - .replace(/^core\.sidemenu/, 'core.mainmenu').replace(/^addon\.grades/, 'core.grades') - .replace(/^addon\.participants/, 'core.user'); - - this.loadString(this.customStrings, lang, key, values[1]); + this.loadString(this.customStrings, lang, values[0], values[1]); }); this.customStringsRaw = strings;