MOBILE-4059 core: Translate hardcoded errors
This commit is contained in:
		
							parent
							
								
									8b36a6864d
								
							
						
					
					
						commit
						95e0640eb2
					
				@ -35,6 +35,7 @@ import { CoreSite } from '@classes/site';
 | 
				
			|||||||
import { CoreEventObserver, CoreEvents } from '@singletons/events';
 | 
					import { CoreEventObserver, CoreEvents } from '@singletons/events';
 | 
				
			||||||
import { CoreConstants } from '../constants';
 | 
					import { CoreConstants } from '../constants';
 | 
				
			||||||
import { CoreNetwork } from '@services/network';
 | 
					import { CoreNetwork } from '@services/network';
 | 
				
			||||||
 | 
					import { Translate } from '@singletons';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * Directive to handle external content.
 | 
					 * Directive to handle external content.
 | 
				
			||||||
@ -217,7 +218,7 @@ export class CoreExternalContentDirective implements AfterViewInit, OnChanges, O
 | 
				
			|||||||
        if (!site.canDownloadFiles() && isSiteFile) {
 | 
					        if (!site.canDownloadFiles() && isSiteFile) {
 | 
				
			||||||
            this.element.parentElement?.removeChild(this.element); // Remove element since it'll be broken.
 | 
					            this.element.parentElement?.removeChild(this.element); // Remove element since it'll be broken.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            throw new CoreError('Site doesn\'t allow downloading files.');
 | 
					            throw new CoreError(Translate.instant('core.cannotdownloadfiles'));
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        const finalUrl = await this.getUrlToUse(targetAttr, url, site);
 | 
					        const finalUrl = await this.getUrlToUse(targetAttr, url, site);
 | 
				
			||||||
 | 
				
			|||||||
@ -374,7 +374,7 @@ export class CoreFilepoolProvider {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        const site = await CoreSites.getSite(siteId);
 | 
					        const site = await CoreSites.getSite(siteId);
 | 
				
			||||||
        if (!site.canDownloadFiles()) {
 | 
					        if (!site.canDownloadFiles()) {
 | 
				
			||||||
            throw new CoreError('Site doesn\'t allow downloading files.');
 | 
					            throw new CoreError(Translate.instant('core.cannotdownloadfiles'));
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (!alreadyFixed) {
 | 
					        if (!alreadyFixed) {
 | 
				
			||||||
@ -745,7 +745,7 @@ export class CoreFilepoolProvider {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        this.filePromises[siteId][downloadId] = CoreSites.getSite(siteId).then(async (site) => {
 | 
					        this.filePromises[siteId][downloadId] = CoreSites.getSite(siteId).then(async (site) => {
 | 
				
			||||||
            if (!site.canDownloadFiles()) {
 | 
					            if (!site.canDownloadFiles()) {
 | 
				
			||||||
                throw new CoreError('Site doesn\'t allow downloading files.');
 | 
					                throw new CoreError(Translate.instant('core.cannotdownloadfiles'));
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            const entry = await CoreWS.downloadFile(fileUrl, path, addExtension, onProgress);
 | 
					            const entry = await CoreWS.downloadFile(fileUrl, path, addExtension, onProgress);
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user