refactor(web): use derived instead of get(t) (#10884)

This commit is contained in:
Michel Heusschen 2024-07-05 15:06:35 +02:00 committed by GitHub
parent 6791af8c2c
commit 3cd187dced
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 16 additions and 18 deletions

View file

@ -1,6 +1,6 @@
import type { PersonResponseDto } from '@immich/sdk';
import { t } from 'svelte-i18n';
import { get } from 'svelte/store';
import { derived } from 'svelte/store';
export const searchNameLocal = (
name: string,
@ -27,7 +27,6 @@ export const searchNameLocal = (
.slice(0, slice);
};
export const getPersonNameWithHiddenValue = (name: string, isHidden: boolean) => {
const $t = get(t);
return $t('person_hidden', { values: { name: name, hidden: isHidden } });
};
export const getPersonNameWithHiddenValue = derived(t, ($t) => {
return (name: string, isHidden: boolean) => $t('person_hidden', { values: { name: name, hidden: isHidden } });
});