Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/assets/lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -1316,7 +1316,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 2.4 or later.",
"core.cannotconnect": "Cannot connect: Verify that you have correctly typed the URL and that your site uses Moodle 3.1 or later.",
"core.cannotdownloadfiles": "File downloading is disabled. Please contact your site administrator.",
"core.captureaudio": "Record audio",
"core.capturedimage": "Taken picture.",
Expand Down
14 changes: 14 additions & 0 deletions src/providers/lang.ts
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,8 @@ export class CoreLangProvider {
return;
}

let currentLangChanged = false;

const list: string[] = strings.split(/(?:\r\n|\r|\n)/);
list.forEach((entry: string) => {
const values: string[] = entry.split('|');
Expand All @@ -327,6 +329,10 @@ export class CoreLangProvider {

lang = values[2].replace(/_/g, '-'); // Use the app format instead of Moodle format.

if (lang == this.currentLanguage) {
currentLangChanged = true;
}

if (!this.customStrings[lang]) {
this.customStrings[lang] = {};
}
Expand All @@ -340,6 +346,14 @@ export class CoreLangProvider {
});

this.customStringsRaw = strings;

if (currentLangChanged) {
// Some lang strings have changed, emit an event to update the pipes.
this.translate.onLangChange.emit({
lang: this.currentLanguage,
translations: this.translate.translations[this.currentLanguage]
});
}
}

/**
Expand Down