Merge pull request #2765 from crazyserver/MOBILE-3615
MOBILE-3615 menu: Use parent language if any on docs urlmain
commit
84ef10bf23
|
@ -51,7 +51,8 @@
|
||||||
[disabled]="showFilters.future == 'disabled'">
|
[disabled]="showFilters.future == 'disabled'">
|
||||||
{{ 'addon.block_myoverview.future' | translate }}
|
{{ 'addon.block_myoverview.future' | translate }}
|
||||||
</ion-select-option>
|
</ion-select-option>
|
||||||
<ion-select-option class="ion-text-wrap" value="past" *ngIf="showFilters.past != 'hidden'" [disabled]="showFilters.past == 'disabled'">
|
<ion-select-option class="ion-text-wrap" value="past" *ngIf="showFilters.past != 'hidden'"
|
||||||
|
[disabled]="showFilters.past == 'disabled'">
|
||||||
{{ 'addon.block_myoverview.past' | translate }}
|
{{ 'addon.block_myoverview.past' | translate }}
|
||||||
</ion-select-option>
|
</ion-select-option>
|
||||||
<ng-container *ngIf="showFilters.custom != 'hidden'">
|
<ng-container *ngIf="showFilters.custom != 'hidden'">
|
||||||
|
|
|
@ -118,6 +118,19 @@ export class CoreLangProvider {
|
||||||
return value.charAt(0).toUpperCase() + value.slice(1);
|
return value.charAt(0).toUpperCase() + value.slice(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the parent language defined on the language strings.
|
||||||
|
*
|
||||||
|
* @param currentLanguage Current language.
|
||||||
|
* @returns If a parent language is set, return the index name.
|
||||||
|
*/
|
||||||
|
getParentLanguage(currentLanguage: string): string | undefined {
|
||||||
|
const parentLang = Translate.instant('core.parentlanguage');
|
||||||
|
if (parentLang != '' && parentLang != 'core.parentlanguage' && parentLang != currentLanguage) {
|
||||||
|
return parentLang;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Change current language.
|
* Change current language.
|
||||||
*
|
*
|
||||||
|
@ -131,9 +144,9 @@ export class CoreLangProvider {
|
||||||
promises.push(new Promise((resolve, reject) => {
|
promises.push(new Promise((resolve, reject) => {
|
||||||
CoreSubscriptions.once(Translate.use(language), data => {
|
CoreSubscriptions.once(Translate.use(language), data => {
|
||||||
// It's a language override, load the original one first.
|
// It's a language override, load the original one first.
|
||||||
const fallbackLang = Translate.instant('core.parentlanguage');
|
const fallbackLang = this.getParentLanguage(language);
|
||||||
|
|
||||||
if (fallbackLang != '' && fallbackLang != 'core.parentlanguage' && fallbackLang != language) {
|
if (fallbackLang) {
|
||||||
CoreSubscriptions.once(
|
CoreSubscriptions.once(
|
||||||
Translate.use(fallbackLang),
|
Translate.use(fallbackLang),
|
||||||
fallbackData => {
|
fallbackData => {
|
||||||
|
|
|
@ -242,7 +242,8 @@ export class CoreUrlUtilsProvider {
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const lang = await CoreLang.getCurrentLanguage();
|
let lang = await CoreLang.getCurrentLanguage();
|
||||||
|
lang = CoreLang.getParentLanguage(lang) || lang;
|
||||||
|
|
||||||
return docsUrl.replace('/en/', '/' + lang + '/');
|
return docsUrl.replace('/en/', '/' + lang + '/');
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|
|
@ -98,7 +98,7 @@
|
||||||
// Generates the color classes and variables based on the
|
// Generates the color classes and variables based on the
|
||||||
// colors map
|
// colors map
|
||||||
|
|
||||||
@mixin generate-color($color-name) {
|
@mixin generate-color($color-name, $colors) {
|
||||||
$value: map-get($colors, $color-name);
|
$value: map-get($colors, $color-name);
|
||||||
|
|
||||||
$base: map-get($value, base);
|
$base: map-get($value, base);
|
||||||
|
|
|
@ -132,15 +132,7 @@ $colors: (
|
||||||
|
|
||||||
// Just swipe light and dark.
|
// Just swipe light and dark.
|
||||||
$colors-dark: (
|
$colors-dark: (
|
||||||
primary: map-get($colors, primary),
|
|
||||||
secondary: map-get($colors, secondary),
|
|
||||||
tertiary: map-get($colors, tertiary),
|
|
||||||
success: map-get($colors, success),
|
|
||||||
warning: map-get($colors, warning),
|
|
||||||
danger: map-get($colors, danger),
|
|
||||||
info: map-get($colors, info),
|
|
||||||
light: map-get($colors, dark),
|
light: map-get($colors, dark),
|
||||||
medium: map-get($colors, medium),
|
|
||||||
dark: map-get($colors, light),
|
dark: map-get($colors, light),
|
||||||
) !default;
|
) !default;
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,7 @@
|
||||||
--dark: #{$light};
|
--dark: #{$light};
|
||||||
|
|
||||||
@each $color-name, $value in $colors-dark {
|
@each $color-name, $value in $colors-dark {
|
||||||
@include generate-color($color-name);
|
@include generate-color($color-name, $colors-dark);
|
||||||
}
|
}
|
||||||
|
|
||||||
--ion-tab-bar-background: #1f1f1f;
|
--ion-tab-bar-background: #1f1f1f;
|
||||||
|
|
|
@ -59,7 +59,7 @@
|
||||||
--medium: #{$medium};
|
--medium: #{$medium};
|
||||||
|
|
||||||
@each $color-name, $value in $colors {
|
@each $color-name, $value in $colors {
|
||||||
@include generate-color($color-name);
|
@include generate-color($color-name, $colors);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Accessibility vars.
|
// Accessibility vars.
|
||||||
|
|
Loading…
Reference in New Issue