MOBILE-4630 pluginfile: Add lang to file download request

main
Alfonso Salces 2024-07-22 09:00:50 +02:00
parent 337c69d60f
commit fd9577cfbf
3 changed files with 16 additions and 1 deletions

View File

@ -97,6 +97,7 @@ export class CoreFilepoolProvider {
new RegExp('(\\?|&)forcedownload=[0-1]'),
new RegExp('(\\?|&)preview=[A-Za-z0-9]+'),
new RegExp('(\\?|&)offline=[0-1]', 'g'),
new RegExp(/(\\?|&)lang=[A-Za-z\-_]+/, 'g'),
];
// To handle file downloads using the queue.

View File

@ -249,6 +249,19 @@ export class CoreLangProvider {
return format ? this.formatLanguage(this.currentLanguage, format) : this.currentLanguage;
}
/**
* Get current language sync.
*
* @returns Current language or undefined.
*/
getCurrentLanguageSync(format?: CoreLangFormat): string | undefined {
if (this.currentLanguage === undefined) {
return;
}
return format ? this.formatLanguage(this.currentLanguage, format) : this.currentLanguage;
}
/**
* Update a language code to the given format.
*

View File

@ -211,7 +211,8 @@ export class CoreUrlUtilsProvider {
url = this.addParamsToUrl(url, { token });
}
return this.addParamsToUrl(url, { offline: '1' }); // Always send offline=1 (it's for external repositories).
// Always send offline=1 (it's for external repositories).
return this.addParamsToUrl(url, { offline: '1', lang: CoreLang.getCurrentLanguageSync(CoreLangFormat.LMS) });
}
/**