mirror of
https://github.com/immich-app/immich.git
synced 2025-05-24 01:12:58 -04:00
* chore(web): another missing translations * unused removed * more keys * lint fix * test fixed * dynamic translation fix * fixes * people search translation * params fixed * keep filter setting fix * lint fix * $t fixes * Update web/src/lib/i18n/en.json Co-authored-by: Michel Heusschen <59014050+michelheusschen@users.noreply.github.com> * another missing * activity translation * link sharing translations * expiration dropdown fix - didn't work localized * notification title * device logout * search results * reset to default * unsaved change * select from computer * selected * select-2 * select-3 * unmerge * pluralize, force icu message * Update web/src/lib/components/asset-viewer/asset-viewer.svelte Co-authored-by: Michel Heusschen <59014050+michelheusschen@users.noreply.github.com> * review fixes * remove user * plural fixes * ffmpeg settings * fixes * error title * plural fixes * onboarding * change password * more more * console log fix * another * api key desc * map marker * format fix * key fix * asset-utils * utils * misc --------- Co-authored-by: Michel Heusschen <59014050+michelheusschen@users.noreply.github.com>
34 lines
1.2 KiB
TypeScript
34 lines
1.2 KiB
TypeScript
import type { PersonResponseDto } from '@immich/sdk';
|
|
import { t } from 'svelte-i18n';
|
|
import { get } from 'svelte/store';
|
|
|
|
export const searchNameLocal = (
|
|
name: string,
|
|
people: PersonResponseDto[],
|
|
slice: number,
|
|
personId?: string,
|
|
): PersonResponseDto[] => {
|
|
return name.includes(' ')
|
|
? people
|
|
.filter((person: PersonResponseDto) => {
|
|
return personId
|
|
? person.name.toLowerCase().startsWith(name.toLowerCase()) && person.id !== personId
|
|
: person.name.toLowerCase().startsWith(name.toLowerCase());
|
|
})
|
|
.slice(0, slice)
|
|
: people
|
|
.filter((person: PersonResponseDto) => {
|
|
const nameParts = person.name.split(' ');
|
|
return personId
|
|
? nameParts.some((splitName) => splitName.toLowerCase().startsWith(name.toLowerCase())) &&
|
|
person.id !== personId
|
|
: nameParts.some((splitName) => splitName.toLowerCase().startsWith(name.toLowerCase()));
|
|
})
|
|
.slice(0, slice);
|
|
};
|
|
|
|
export const getPersonNameWithHiddenValue = (name: string, isHidden: boolean) => {
|
|
const $t = get(t);
|
|
return $t('person_hidden', { values: { name: name, hidden: isHidden } });
|
|
};
|