chore(web): translations in page load functions (#10260)

This commit is contained in:
Michel Heusschen
2024-06-13 16:23:52 +02:00
committed by GitHub
parent 827ec1b63a
commit 212ba35aef
20 changed files with 90 additions and 22 deletions
@@ -2,12 +2,15 @@ import { getAssetThumbnailUrl, setSharedLink } from '$lib/utils';
import { authenticate } from '$lib/utils/auth';
import { getAssetInfoFromParam } from '$lib/utils/navigation';
import { getMySharedLink, isHttpError } from '@immich/sdk';
import { t } from 'svelte-i18n';
import { get } from 'svelte/store';
import type { PageLoad } from './$types';
export const load = (async ({ params }) => {
const { key } = params;
await authenticate({ public: true });
const asset = await getAssetInfoFromParam(params);
const $t = get(t);
try {
const sharedLink = await getMySharedLink({ key });
@@ -20,8 +23,8 @@ export const load = (async ({ params }) => {
asset,
key,
meta: {
title: sharedLink.album ? sharedLink.album.albumName : 'Public Share',
description: sharedLink.description || `${assetCount} shared photos & videos.`,
title: sharedLink.album ? sharedLink.album.albumName : $t('public_share'),
description: sharedLink.description || $t('shared_photos_and_videos_count', { values: { assetCount } }),
imageUrl: assetId ? getAssetThumbnailUrl(assetId) : '/feature-panel.png',
},
};
@@ -31,7 +34,7 @@ export const load = (async ({ params }) => {
passwordRequired: true,
sharedLinkKey: key,
meta: {
title: 'Password Required',
title: $t('password_required'),
},
};
}