diff --git a/scripts/lang_functions.php b/scripts/lang_functions.php index af1e2ab3b..7765841ca 100644 --- a/scripts/lang_functions.php +++ b/scripts/lang_functions.php @@ -58,6 +58,7 @@ function build_languages($languages, $keys, $added_langs = []) { } function get_langindex_keys() { + $local = 0; // Process the index file, just once. $keys = file_get_contents('langindex.json'); $keys = (array) json_decode($keys); @@ -67,6 +68,7 @@ function get_langindex_keys() { if ($value == 'local_moodlemobileapp') { $map->file = $value; $map->string = $key; + $local++; } else { $exp = explode('/', $value, 2); $map->file = $exp[0]; @@ -87,7 +89,7 @@ function get_langindex_keys() { } $total = count($keys); - echo "Total strings to translate $total\n"; + echo "Total strings to translate $total ($local local)\n"; return $keys; } @@ -232,6 +234,10 @@ function build_lang($lang, $keys) { // Prevent double. $text = str_replace(array('{{{', '}}}'), array('{{', '}}'), $text); } else { + // @TODO: Remove that line when core.cannotconnect and core.login.invalidmoodleversion are completelly changed to use $a + if (($key == 'core.cannotconnect' || $key == 'core.login.invalidmoodleversion') && strpos($text, '2.4') != false) { + $text = str_replace('2.4', '{{$a}}', $text); + } $local++; } @@ -244,7 +250,11 @@ function build_lang($lang, $keys) { $success = count($translations); $percentage = floor($success/$total * 100); - echo "\t\t$success of $total -> $percentage% ($local local)\n"; + $bar = progressbar($percentage); + if (strlen($lang) <= 2 && !$parent) { + echo "\t"; + } + echo "\t\t$success of $total -> $percentage% $bar ($local local)\n"; if ($lang == 'en') { generate_local_moodlemobileapp($keys, $translations); @@ -254,6 +264,11 @@ function build_lang($lang, $keys) { return true; } +function progressbar($percentage) { + $done = $percentage/10; + return "\t".str_repeat('=', $done) . str_repeat('-', 10-$done); +} + function detect_lang($lang, $keys) { $langfoldername = get_langfolder($lang); if (!$langfoldername) { @@ -271,12 +286,14 @@ function detect_lang($lang, $keys) { return false; } - echo "Checking $lang"; + $title = $lang; if ($parent != "" && $parent != $lang) { - echo " ($parent)"; + $title .= " ($parent)"; } $langname = $string['thislanguage']; - echo " ".$langname." -D"; + $title .= " ".$langname." -D"; + + // Add the translation to the array. foreach ($keys as $key => $value) { @@ -300,7 +317,10 @@ function detect_lang($lang, $keys) { } $percentage = floor($success/$total * 100); - echo "\t\t$success of $total -> $percentage% ($local local)"; + $bar = progressbar($percentage); + + echo "Checking ".$title.str_repeat("\t", 7 - floor(mb_strlen($title, 'UTF-8')/8)); + echo "\t$success of $total -> $percentage% $bar ($local local)"; if (($percentage > 75 && $local > 50) || ($percentage > 50 && $local > 75)) { echo " \t DETECTED\n"; return true; diff --git a/src/addon/mod/folder/components/index/index.ts b/src/addon/mod/folder/components/index/index.ts index ae0bcfae0..573b4dfb6 100644 --- a/src/addon/mod/folder/components/index/index.ts +++ b/src/addon/mod/folder/components/index/index.ts @@ -34,7 +34,6 @@ export class AddonModFolderIndexComponent extends CoreCourseModuleMainResourceCo component = AddonModFolderProvider.COMPONENT; canGetFolder: boolean; contents: any; - moduleContents: any; constructor(injector: Injector, private folderProvider: AddonModFolderProvider, private courseProvider: CoreCourseProvider, private appProvider: CoreAppProvider, private folderHelper: AddonModFolderHelperProvider) { @@ -51,7 +50,7 @@ export class AddonModFolderIndexComponent extends CoreCourseModuleMainResourceCo if (this.path) { // Subfolder. Use module param. - this.showModuleData(this.module); + this.showModuleData(this.module, this.module.contents); this.loaded = true; this.refreshIcon = 'refresh'; } else { @@ -81,16 +80,16 @@ export class AddonModFolderIndexComponent extends CoreCourseModuleMainResourceCo * Convenience function to set scope data using module. * @param module Module to show. */ - protected showModuleData(module: any): void { + protected showModuleData(module: any, folderContents: any): void { this.description = module.intro || module.description; this.dataRetrieved.emit(module); if (this.path) { // Subfolder. - this.contents = this.moduleContents; + this.contents = folderContents; } else { - this.contents = this.folderHelper.formatContents(this.moduleContents); + this.contents = this.folderHelper.formatContents(folderContents); } } @@ -101,12 +100,13 @@ export class AddonModFolderIndexComponent extends CoreCourseModuleMainResourceCo * @return Promise resolved when done. */ protected fetchContent(refresh?: boolean): Promise { - let promise; + let promise, + folderContents = this.module.contents; if (this.canGetFolder) { promise = this.folderProvider.getFolder(this.courseId, this.module.id).then((folder) => { return this.courseProvider.loadModuleContents(this.module, this.courseId).then(() => { - this.moduleContents = this.module.contents; + folderContents = this.module.contents; return folder; }); @@ -118,14 +118,14 @@ export class AddonModFolderIndexComponent extends CoreCourseModuleMainResourceCo folder.contents = this.module.contents; } this.module = folder; - this.moduleContents = folder.contents; + folderContents = folder.contents; return folder; }); } return promise.then((folder) => { - this.showModuleData(folder); + this.showModuleData(folder, folderContents); }).finally(() => { this.fillContextMenu(refresh); }); diff --git a/src/addon/mod/forum/providers/discussion-link-handler.ts b/src/addon/mod/forum/providers/discussion-link-handler.ts index 67e87c4cd..e884b6545 100644 --- a/src/addon/mod/forum/providers/discussion-link-handler.ts +++ b/src/addon/mod/forum/providers/discussion-link-handler.ts @@ -45,11 +45,8 @@ export class AddonModForumDiscussionLinkHandler extends CoreContentLinksHandlerB CoreContentLinksAction[] | Promise { data = data || {}; - if (!data.instance) { - // Without the forumId discussions cannot be loaded (from link). - - return []; - } + // On 3.6 downwards, it will open the discussion but without knowing the lock status of the discussion. + // However canreply will be false. return [{ action: (siteId, navCtrl?): void => { diff --git a/src/addon/mod/resource/providers/module-handler.ts b/src/addon/mod/resource/providers/module-handler.ts index 5b0d8686e..735bcae53 100644 --- a/src/addon/mod/resource/providers/module-handler.ts +++ b/src/addon/mod/resource/providers/module-handler.ts @@ -222,12 +222,11 @@ export class AddonModResourceModuleHandler implements CoreCourseModuleHandler { } } - if (resourceData.icon == '') { - resourceData.icon = this.courseProvider.getModuleIconSrc(this.modName, module.modicon); - } resourceData.extra += extra.join(' '); - } else { - // No files, just set the icon. + } + + // No previously set, just set the icon. + if (resourceData.icon == '') { resourceData.icon = this.courseProvider.getModuleIconSrc(this.modName, module.modicon); } diff --git a/src/addon/mod/workshop/components/index/addon-mod-workshop-index.html b/src/addon/mod/workshop/components/index/addon-mod-workshop-index.html index 7d398d32c..3ce7e2c32 100644 --- a/src/addon/mod/workshop/components/index/addon-mod-workshop-index.html +++ b/src/addon/mod/workshop/components/index/addon-mod-workshop-index.html @@ -18,14 +18,14 @@

{{ phases[workshop.phase].title }}

- +

{{task.title}}

-

{{ task.details }}

+

@@ -94,7 +94,7 @@ - +