Reverse time by default for RTL languages
This commit is contained in:
parent
54c44565fb
commit
5d3ee50bca
@ -1,4 +1,4 @@
|
|||||||
import { Inject, Injectable, PLATFORM_ID } from '@angular/core';
|
import { Inject, Injectable, PLATFORM_ID, LOCALE_ID } from '@angular/core';
|
||||||
import { ReplaySubject, BehaviorSubject, Subject, fromEvent, Observable } from 'rxjs';
|
import { ReplaySubject, BehaviorSubject, Subject, fromEvent, Observable } from 'rxjs';
|
||||||
import { Transaction } from '../interfaces/electrs.interface';
|
import { Transaction } from '../interfaces/electrs.interface';
|
||||||
import { IBackendInfo, MempoolBlock, MempoolBlockWithTransactions, MempoolBlockDelta, MempoolInfo, Recommendedfees, ReplacedTransaction, TransactionStripped } from '../interfaces/websocket.interface';
|
import { IBackendInfo, MempoolBlock, MempoolBlockWithTransactions, MempoolBlockDelta, MempoolInfo, Recommendedfees, ReplacedTransaction, TransactionStripped } from '../interfaces/websocket.interface';
|
||||||
@ -113,6 +113,7 @@ export class StateService {
|
|||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
@Inject(PLATFORM_ID) private platformId: any,
|
@Inject(PLATFORM_ID) private platformId: any,
|
||||||
|
@Inject(LOCALE_ID) private locale: string,
|
||||||
private router: Router,
|
private router: Router,
|
||||||
private storageService: StorageService,
|
private storageService: StorageService,
|
||||||
) {
|
) {
|
||||||
@ -151,7 +152,10 @@ export class StateService {
|
|||||||
|
|
||||||
this.blockVSize = this.env.BLOCK_WEIGHT_UNITS / 4;
|
this.blockVSize = this.env.BLOCK_WEIGHT_UNITS / 4;
|
||||||
|
|
||||||
this.timeLtr = new BehaviorSubject<boolean>(this.storageService.getValue('time-preference-ltr') === 'true');
|
const savedTimePreference = this.storageService.getValue('time-preference-ltr');
|
||||||
|
const rtlLanguage = (this.locale.startsWith('ar') || this.locale.startsWith('fa') || this.locale.startsWith('he'));
|
||||||
|
// default time direction is right-to-left, unless locale is a RTL language
|
||||||
|
this.timeLtr = new BehaviorSubject<boolean>(savedTimePreference === 'true' || (savedTimePreference == null && rtlLanguage));
|
||||||
this.timeLtr.subscribe((ltr) => {
|
this.timeLtr.subscribe((ltr) => {
|
||||||
this.storageService.setValue('time-preference-ltr', ltr ? 'true' : 'false');
|
this.storageService.setValue('time-preference-ltr', ltr ? 'true' : 'false');
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user