Merge pull request #4124 from alfonso-salces/MOBILE-4630
MOBILE-4630 pluginfile: Add lang to file download requestmain
commit
d6b4febe65
|
@ -97,6 +97,7 @@ export class CoreFilepoolProvider {
|
||||||
new RegExp('(\\?|&)forcedownload=[0-1]'),
|
new RegExp('(\\?|&)forcedownload=[0-1]'),
|
||||||
new RegExp('(\\?|&)preview=[A-Za-z0-9]+'),
|
new RegExp('(\\?|&)preview=[A-Za-z0-9]+'),
|
||||||
new RegExp('(\\?|&)offline=[0-1]', 'g'),
|
new RegExp('(\\?|&)offline=[0-1]', 'g'),
|
||||||
|
new RegExp(/(\\?|&)lang=[A-Za-z\-_]+/, 'g'),
|
||||||
];
|
];
|
||||||
|
|
||||||
// To handle file downloads using the queue.
|
// To handle file downloads using the queue.
|
||||||
|
|
|
@ -249,6 +249,19 @@ export class CoreLangProvider {
|
||||||
return format ? this.formatLanguage(this.currentLanguage, format) : this.currentLanguage;
|
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.
|
* Update a language code to the given format.
|
||||||
*
|
*
|
||||||
|
|
|
@ -934,14 +934,15 @@ export class CoreDomUtilsProvider {
|
||||||
* @param options More options. See https://ionicframework.com/docs/v3/api/components/alert/AlertController/
|
* @param options More options. See https://ionicframework.com/docs/v3/api/components/alert/AlertController/
|
||||||
* @returns Promise resolved if the user confirms and rejected with a canceled error if he cancels.
|
* @returns Promise resolved if the user confirms and rejected with a canceled error if he cancels.
|
||||||
*/
|
*/
|
||||||
showDeleteConfirm(
|
async showDeleteConfirm(
|
||||||
translateMessage: string = 'core.areyousure',
|
translateMessage: string = 'core.areyousure',
|
||||||
translateArgs: Record<string, unknown> = {},
|
translateArgs: Record<string, unknown> = {},
|
||||||
options: AlertOptions = {},
|
options: AlertOptions = {},
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
return new Promise((resolve, reject): void => {
|
options.message = Translate.instant(translateMessage, translateArgs);
|
||||||
options.message = Translate.instant(translateMessage, translateArgs);
|
options.message = await CoreLang.filterMultilang(options.message);
|
||||||
|
|
||||||
|
return new Promise((resolve, reject): void => {
|
||||||
options.buttons = [
|
options.buttons = [
|
||||||
{
|
{
|
||||||
text: Translate.instant('core.cancel'),
|
text: Translate.instant('core.cancel'),
|
||||||
|
|
|
@ -211,7 +211,8 @@ export class CoreUrlUtilsProvider {
|
||||||
url = this.addParamsToUrl(url, { token });
|
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) });
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue