mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
Initial support for RTL layouts
This commit is contained in:
parent
941fe35103
commit
0f994ccb5b
19 changed files with 212 additions and 25 deletions
|
@ -84,7 +84,7 @@ import globalize from './globalize';
|
|||
hours = Math.floor(hours);
|
||||
|
||||
if (hours) {
|
||||
parts.push(hours);
|
||||
parts.push(hours.toLocaleString());
|
||||
}
|
||||
|
||||
ticks -= (hours * ticksPerHour);
|
||||
|
@ -95,7 +95,9 @@ import globalize from './globalize';
|
|||
ticks -= (minutes * ticksPerMinute);
|
||||
|
||||
if (minutes < 10 && hours) {
|
||||
minutes = '0' + minutes;
|
||||
minutes = (0).toLocaleString() + minutes.toLocaleString();
|
||||
} else {
|
||||
minutes = minutes.toLocaleString();
|
||||
}
|
||||
parts.push(minutes);
|
||||
|
||||
|
@ -103,7 +105,9 @@ import globalize from './globalize';
|
|||
seconds = Math.floor(seconds);
|
||||
|
||||
if (seconds < 10) {
|
||||
seconds = '0' + seconds;
|
||||
seconds = (0).toLocaleString() + seconds.toLocaleString();
|
||||
} else {
|
||||
seconds = seconds.toLocaleString();
|
||||
}
|
||||
parts.push(seconds);
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@ import { currentSettings as userSettings } from './settings/userSettings';
|
|||
const allTranslations = {};
|
||||
let currentCulture;
|
||||
let currentDateTimeCulture;
|
||||
let isRTL = false;
|
||||
|
||||
export function getCurrentLocale() {
|
||||
return currentCulture;
|
||||
|
@ -38,6 +39,10 @@ import { currentSettings as userSettings } from './settings/userSettings';
|
|||
return fallbackCulture;
|
||||
}
|
||||
|
||||
export function getIsRTL() {
|
||||
return isRTL;
|
||||
}
|
||||
|
||||
export function updateCurrentCulture() {
|
||||
let culture;
|
||||
try {
|
||||
|
@ -46,6 +51,13 @@ import { currentSettings as userSettings } from './settings/userSettings';
|
|||
console.error('no language set in user settings');
|
||||
}
|
||||
culture = culture || getDefaultLanguage();
|
||||
isRTL = culture === 'ar' || culture === 'fa' || culture === 'ur_PK' || culture === 'he';
|
||||
|
||||
if (isRTL) {
|
||||
document.getElementsByTagName('body')[0].setAttribute('dir', 'rtl');
|
||||
} else {
|
||||
document.getElementsByTagName('body')[0].setAttribute('dir', 'ltr');
|
||||
}
|
||||
|
||||
currentCulture = normalizeLocaleName(culture);
|
||||
|
||||
|
@ -257,7 +269,8 @@ export default {
|
|||
getCurrentLocale,
|
||||
getCurrentDateTimeLocale,
|
||||
register,
|
||||
updateCurrentCulture
|
||||
updateCurrentCulture,
|
||||
getIsRTL
|
||||
};
|
||||
|
||||
/* eslint-enable indent */
|
||||
|
|
|
@ -100,6 +100,7 @@ function onGlobalizeInit() {
|
|||
import('../assets/css/fonts.scss');
|
||||
}
|
||||
|
||||
import('../styles/rtl.scss');
|
||||
import('../assets/css/librarybrowser.scss');
|
||||
|
||||
loadPlugins().then(function () {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue