mirror of
https://github.com/immich-app/immich.git
synced 2025-12-23 17:25:11 +03:00
feat: rtl (#17860)
This commit is contained in:
21
web/src/lib/stores/language-manager.svelte.ts
Normal file
21
web/src/lib/stores/language-manager.svelte.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
import { langs } from '$lib/constants';
|
||||
import { eventManager } from '$lib/stores/event-manager.svelte';
|
||||
|
||||
class LanguageManager {
|
||||
rtl = $state(false);
|
||||
|
||||
setLanguage(code: string) {
|
||||
const item = langs.find((item) => item.code === code);
|
||||
if (!item) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.rtl = item.rtl ?? false;
|
||||
|
||||
document.body.setAttribute('dir', item.rtl ? 'rtl' : 'ltr');
|
||||
|
||||
eventManager.emit('language.change', item);
|
||||
}
|
||||
}
|
||||
|
||||
export const languageManager = new LanguageManager();
|
||||
Reference in New Issue
Block a user