0
Fork 0
mirror of https://github.com/immich-app/immich.git synced 2025-02-11 01:18:24 -05:00

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
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
20 changed files with 90 additions and 22 deletions

View file

@ -410,6 +410,7 @@
"done": "Done", "done": "Done",
"download": "Download", "download": "Download",
"downloading": "Downloading", "downloading": "Downloading",
"duplicates": "Duplicates",
"duration": "Duration", "duration": "Duration",
"durations": { "durations": {
"days": "{days, plural, one {day} other {{days, number} days}}", "days": "{days, plural, one {day} other {{days, number} days}}",
@ -551,6 +552,7 @@
"hour": "Hour", "hour": "Hour",
"image": "Image", "image": "Image",
"immich_logo": "Immich Logo", "immich_logo": "Immich Logo",
"immich_web_interface": "Immich Web Interface",
"import_from_json": "Import from JSON", "import_from_json": "Import from JSON",
"import_path": "Import path", "import_path": "Import path",
"in_archive": "In archive", "in_archive": "In archive",
@ -793,6 +795,7 @@
"shared_by_you": "Shared by you", "shared_by_you": "Shared by you",
"shared_from_partner": "Photos from {partner}", "shared_from_partner": "Photos from {partner}",
"shared_links": "Shared links", "shared_links": "Shared links",
"shared_photos_and_videos_count": "{assetCount} shared photos & videos.",
"shared_with_partner": "Shared with {partner}", "shared_with_partner": "Shared with {partner}",
"sharing": "Sharing", "sharing": "Sharing",
"sharing_sidebar_description": "Display a link to Sharing in the sidebar", "sharing_sidebar_description": "Display a link to Sharing in the sidebar",
@ -896,6 +899,7 @@
"viewer": "Viewer", "viewer": "Viewer",
"waiting": "Waiting", "waiting": "Waiting",
"week": "Week", "week": "Week",
"welcome": "Welcome",
"welcome_to_immich": "Welcome to immich", "welcome_to_immich": "Welcome to immich",
"year": "Year", "year": "Year",
"yes": "Yes", "yes": "Yes",

View file

@ -1,17 +1,20 @@
import { authenticate } from '$lib/utils/auth'; import { authenticate } from '$lib/utils/auth';
import { getAllAlbums } from '@immich/sdk'; import { getAllAlbums } from '@immich/sdk';
import { t } from 'svelte-i18n';
import { get } from 'svelte/store';
import type { PageLoad } from './$types'; import type { PageLoad } from './$types';
export const load = (async () => { export const load = (async () => {
await authenticate(); await authenticate();
const sharedAlbums = await getAllAlbums({ shared: true }); const sharedAlbums = await getAllAlbums({ shared: true });
const albums = await getAllAlbums({}); const albums = await getAllAlbums({});
const $t = get(t);
return { return {
albums, albums,
sharedAlbums, sharedAlbums,
meta: { meta: {
title: 'Albums', title: $t('albums'),
}, },
}; };
}) satisfies PageLoad; }) satisfies PageLoad;

View file

@ -1,15 +1,18 @@
import { authenticate } from '$lib/utils/auth'; import { authenticate } from '$lib/utils/auth';
import { getAssetInfoFromParam } from '$lib/utils/navigation'; import { getAssetInfoFromParam } from '$lib/utils/navigation';
import { t } from 'svelte-i18n';
import { get } from 'svelte/store';
import type { PageLoad } from './$types'; import type { PageLoad } from './$types';
export const load = (async ({ params }) => { export const load = (async ({ params }) => {
await authenticate(); await authenticate();
const asset = await getAssetInfoFromParam(params); const asset = await getAssetInfoFromParam(params);
const $t = get(t);
return { return {
asset, asset,
meta: { meta: {
title: 'Archive', title: $t('archive'),
}, },
}; };
}) satisfies PageLoad; }) satisfies PageLoad;

View file

@ -1,16 +1,19 @@
import { authenticate } from '$lib/utils/auth'; import { authenticate } from '$lib/utils/auth';
import { getAllPeople, getExploreData } from '@immich/sdk'; import { getAllPeople, getExploreData } from '@immich/sdk';
import { t } from 'svelte-i18n';
import { get } from 'svelte/store';
import type { PageLoad } from './$types'; import type { PageLoad } from './$types';
export const load = (async () => { export const load = (async () => {
await authenticate(); await authenticate();
const [items, response] = await Promise.all([getExploreData(), getAllPeople({ withHidden: false })]); const [items, response] = await Promise.all([getExploreData(), getAllPeople({ withHidden: false })]);
const $t = get(t);
return { return {
items, items,
response, response,
meta: { meta: {
title: 'Explore', title: $t('explore'),
}, },
}; };
}) satisfies PageLoad; }) satisfies PageLoad;

View file

@ -1,15 +1,18 @@
import { authenticate } from '$lib/utils/auth'; import { authenticate } from '$lib/utils/auth';
import { getAssetInfoFromParam } from '$lib/utils/navigation'; import { getAssetInfoFromParam } from '$lib/utils/navigation';
import { t } from 'svelte-i18n';
import { get } from 'svelte/store';
import type { PageLoad } from './$types'; import type { PageLoad } from './$types';
export const load = (async ({ params }) => { export const load = (async ({ params }) => {
await authenticate(); await authenticate();
const asset = await getAssetInfoFromParam(params); const asset = await getAssetInfoFromParam(params);
const $t = get(t);
return { return {
asset, asset,
meta: { meta: {
title: 'Favorites', title: $t('favorites'),
}, },
}; };
}) satisfies PageLoad; }) satisfies PageLoad;

View file

@ -1,15 +1,18 @@
import { authenticate } from '$lib/utils/auth'; import { authenticate } from '$lib/utils/auth';
import { getAssetInfoFromParam } from '$lib/utils/navigation'; import { getAssetInfoFromParam } from '$lib/utils/navigation';
import { t } from 'svelte-i18n';
import { get } from 'svelte/store';
import type { PageLoad } from './$types'; import type { PageLoad } from './$types';
export const load = (async ({ params }) => { export const load = (async ({ params }) => {
await authenticate(); await authenticate();
const asset = await getAssetInfoFromParam(params); const asset = await getAssetInfoFromParam(params);
const $t = get(t);
return { return {
asset, asset,
meta: { meta: {
title: 'Map', title: $t('map'),
}, },
}; };
}) satisfies PageLoad; }) satisfies PageLoad;

View file

@ -1,16 +1,19 @@
import { authenticate } from '$lib/utils/auth'; import { authenticate } from '$lib/utils/auth';
import { getAssetInfoFromParam } from '$lib/utils/navigation'; import { getAssetInfoFromParam } from '$lib/utils/navigation';
import { t } from 'svelte-i18n';
import { get } from 'svelte/store';
import type { PageLoad } from './$types'; import type { PageLoad } from './$types';
export const load = (async ({ params }) => { export const load = (async ({ params }) => {
const user = await authenticate(); const user = await authenticate();
const asset = await getAssetInfoFromParam(params); const asset = await getAssetInfoFromParam(params);
const $t = get(t);
return { return {
user, user,
asset, asset,
meta: { meta: {
title: 'Memory', title: $t('memory'),
}, },
}; };
}) satisfies PageLoad; }) satisfies PageLoad;

View file

@ -1,6 +1,8 @@
import { authenticate } from '$lib/utils/auth'; import { authenticate } from '$lib/utils/auth';
import { getAssetInfoFromParam } from '$lib/utils/navigation'; import { getAssetInfoFromParam } from '$lib/utils/navigation';
import { getUser } from '@immich/sdk'; import { getUser } from '@immich/sdk';
import { t } from 'svelte-i18n';
import { get } from 'svelte/store';
import type { PageLoad } from './$types'; import type { PageLoad } from './$types';
export const load = (async ({ params }) => { export const load = (async ({ params }) => {
@ -8,11 +10,13 @@ export const load = (async ({ params }) => {
const partner = await getUser({ id: params.userId }); const partner = await getUser({ id: params.userId });
const asset = await getAssetInfoFromParam(params); const asset = await getAssetInfoFromParam(params);
const $t = get(t);
return { return {
asset, asset,
partner, partner,
meta: { meta: {
title: 'Partner', title: $t('partner'),
}, },
}; };
}) satisfies PageLoad; }) satisfies PageLoad;

View file

@ -1,15 +1,19 @@
import { authenticate } from '$lib/utils/auth'; import { authenticate } from '$lib/utils/auth';
import { getAllPeople } from '@immich/sdk'; import { getAllPeople } from '@immich/sdk';
import { t } from 'svelte-i18n';
import { get } from 'svelte/store';
import type { PageLoad } from './$types'; import type { PageLoad } from './$types';
export const load = (async () => { export const load = (async () => {
await authenticate(); await authenticate();
const people = await getAllPeople({ withHidden: true }); const people = await getAllPeople({ withHidden: true });
const $t = get(t);
return { return {
people, people,
meta: { meta: {
title: 'People', title: $t('people'),
}, },
}; };
}) satisfies PageLoad; }) satisfies PageLoad;

View file

@ -1,6 +1,8 @@
import { authenticate } from '$lib/utils/auth'; import { authenticate } from '$lib/utils/auth';
import { getAssetInfoFromParam } from '$lib/utils/navigation'; import { getAssetInfoFromParam } from '$lib/utils/navigation';
import { getPerson, getPersonStatistics } from '@immich/sdk'; import { getPerson, getPersonStatistics } from '@immich/sdk';
import { t } from 'svelte-i18n';
import { get } from 'svelte/store';
import type { PageLoad } from './$types'; import type { PageLoad } from './$types';
export const load = (async ({ params }) => { export const load = (async ({ params }) => {
@ -11,13 +13,14 @@ export const load = (async ({ params }) => {
getPersonStatistics({ id: params.personId }), getPersonStatistics({ id: params.personId }),
getAssetInfoFromParam(params), getAssetInfoFromParam(params),
]); ]);
const $t = get(t);
return { return {
person, person,
statistics, statistics,
asset, asset,
meta: { meta: {
title: person.name || 'Person', title: person.name || $t('person'),
}, },
}; };
}) satisfies PageLoad; }) satisfies PageLoad;

View file

@ -1,14 +1,18 @@
import { authenticate } from '$lib/utils/auth'; import { authenticate } from '$lib/utils/auth';
import { getAssetInfoFromParam } from '$lib/utils/navigation'; import { getAssetInfoFromParam } from '$lib/utils/navigation';
import { t } from 'svelte-i18n';
import { get } from 'svelte/store';
import type { PageLoad } from './$types'; import type { PageLoad } from './$types';
export const load = (async ({ params }) => { export const load = (async ({ params }) => {
await authenticate(); await authenticate();
const asset = await getAssetInfoFromParam(params); const asset = await getAssetInfoFromParam(params);
const $t = get(t);
return { return {
asset, asset,
meta: { meta: {
title: 'Photos', title: $t('photos'),
}, },
}; };
}) satisfies PageLoad; }) satisfies PageLoad;

View file

@ -1,15 +1,18 @@
import { authenticate } from '$lib/utils/auth'; import { authenticate } from '$lib/utils/auth';
import { getAssetsByCity } from '@immich/sdk'; import { getAssetsByCity } from '@immich/sdk';
import { t } from 'svelte-i18n';
import { get } from 'svelte/store';
import type { PageLoad } from './$types'; import type { PageLoad } from './$types';
export const load = (async () => { export const load = (async () => {
await authenticate(); await authenticate();
const items = await getAssetsByCity(); const items = await getAssetsByCity();
const $t = get(t);
return { return {
items, items,
meta: { meta: {
title: 'Places', title: $t('places'),
}, },
}; };
}) satisfies PageLoad; }) satisfies PageLoad;

View file

@ -1,14 +1,18 @@
import { authenticate } from '$lib/utils/auth'; import { authenticate } from '$lib/utils/auth';
import { getAssetInfoFromParam } from '$lib/utils/navigation'; import { getAssetInfoFromParam } from '$lib/utils/navigation';
import { t } from 'svelte-i18n';
import { get } from 'svelte/store';
import type { PageLoad } from './$types'; import type { PageLoad } from './$types';
export const load = (async ({ params }) => { export const load = (async ({ params }) => {
await authenticate(); await authenticate();
const asset = await getAssetInfoFromParam(params); const asset = await getAssetInfoFromParam(params);
const $t = get(t);
return { return {
asset, asset,
meta: { meta: {
title: 'Search', title: $t('search'),
}, },
}; };
}) satisfies PageLoad; }) satisfies PageLoad;

View file

@ -2,12 +2,15 @@ import { getAssetThumbnailUrl, setSharedLink } from '$lib/utils';
import { authenticate } from '$lib/utils/auth'; import { authenticate } from '$lib/utils/auth';
import { getAssetInfoFromParam } from '$lib/utils/navigation'; import { getAssetInfoFromParam } from '$lib/utils/navigation';
import { getMySharedLink, isHttpError } from '@immich/sdk'; import { getMySharedLink, isHttpError } from '@immich/sdk';
import { t } from 'svelte-i18n';
import { get } from 'svelte/store';
import type { PageLoad } from './$types'; import type { PageLoad } from './$types';
export const load = (async ({ params }) => { export const load = (async ({ params }) => {
const { key } = params; const { key } = params;
await authenticate({ public: true }); await authenticate({ public: true });
const asset = await getAssetInfoFromParam(params); const asset = await getAssetInfoFromParam(params);
const $t = get(t);
try { try {
const sharedLink = await getMySharedLink({ key }); const sharedLink = await getMySharedLink({ key });
@ -20,8 +23,8 @@ export const load = (async ({ params }) => {
asset, asset,
key, key,
meta: { meta: {
title: sharedLink.album ? sharedLink.album.albumName : 'Public Share', title: sharedLink.album ? sharedLink.album.albumName : $t('public_share'),
description: sharedLink.description || `${assetCount} shared photos & videos.`, description: sharedLink.description || $t('shared_photos_and_videos_count', { values: { assetCount } }),
imageUrl: assetId ? getAssetThumbnailUrl(assetId) : '/feature-panel.png', imageUrl: assetId ? getAssetThumbnailUrl(assetId) : '/feature-panel.png',
}, },
}; };
@ -31,7 +34,7 @@ export const load = (async ({ params }) => {
passwordRequired: true, passwordRequired: true,
sharedLinkKey: key, sharedLinkKey: key,
meta: { meta: {
title: 'Password Required', title: $t('password_required'),
}, },
}; };
} }

View file

@ -1,17 +1,20 @@
import { authenticate } from '$lib/utils/auth'; import { authenticate } from '$lib/utils/auth';
import { getAllAlbums, getPartners } from '@immich/sdk'; import { getAllAlbums, getPartners } from '@immich/sdk';
import { t } from 'svelte-i18n';
import { get } from 'svelte/store';
import type { PageLoad } from './$types'; import type { PageLoad } from './$types';
export const load = (async () => { export const load = (async () => {
await authenticate(); await authenticate();
const sharedAlbums = await getAllAlbums({ shared: true }); const sharedAlbums = await getAllAlbums({ shared: true });
const partners = await getPartners({ direction: 'shared-with' }); const partners = await getPartners({ direction: 'shared-with' });
const $t = get(t);
return { return {
sharedAlbums, sharedAlbums,
partners, partners,
meta: { meta: {
title: 'Sharing', title: $t('sharing'),
}, },
}; };
}) satisfies PageLoad; }) satisfies PageLoad;

View file

@ -1,11 +1,15 @@
import { authenticate } from '$lib/utils/auth'; import { authenticate } from '$lib/utils/auth';
import { t } from 'svelte-i18n';
import { get } from 'svelte/store';
import type { PageLoad } from './$types'; import type { PageLoad } from './$types';
export const load = (async () => { export const load = (async () => {
await authenticate(); await authenticate();
const $t = get(t);
return { return {
meta: { meta: {
title: 'Shared Links', title: $t('shared_links'),
}, },
}; };
}) satisfies PageLoad; }) satisfies PageLoad;

View file

@ -1,14 +1,18 @@
import { authenticate } from '$lib/utils/auth'; import { authenticate } from '$lib/utils/auth';
import { getAssetInfoFromParam } from '$lib/utils/navigation'; import { getAssetInfoFromParam } from '$lib/utils/navigation';
import { t } from 'svelte-i18n';
import { get } from 'svelte/store';
import type { PageLoad } from './$types'; import type { PageLoad } from './$types';
export const load = (async ({ params }) => { export const load = (async ({ params }) => {
await authenticate(); await authenticate();
const asset = await getAssetInfoFromParam(params); const asset = await getAssetInfoFromParam(params);
const $t = get(t);
return { return {
asset, asset,
meta: { meta: {
title: 'Trash', title: $t('trash'),
}, },
}; };
}) satisfies PageLoad; }) satisfies PageLoad;

View file

@ -1,15 +1,18 @@
import { authenticate } from '$lib/utils/auth'; import { authenticate } from '$lib/utils/auth';
import { getAssetInfoFromParam } from '$lib/utils/navigation'; import { getAssetInfoFromParam } from '$lib/utils/navigation';
import { t } from 'svelte-i18n';
import { get } from 'svelte/store';
import type { PageLoad } from './$types'; import type { PageLoad } from './$types';
export const load = (async ({ params }) => { export const load = (async ({ params }) => {
await authenticate(); await authenticate();
const asset = await getAssetInfoFromParam(params); const asset = await getAssetInfoFromParam(params);
const $t = get(t);
return { return {
asset, asset,
meta: { meta: {
title: 'Utilities', title: $t('utilities'),
}, },
}; };
}) satisfies PageLoad; }) satisfies PageLoad;

View file

@ -1,18 +1,21 @@
import { authenticate } from '$lib/utils/auth'; import { authenticate } from '$lib/utils/auth';
import { getAssetInfoFromParam } from '$lib/utils/navigation'; import { getAssetInfoFromParam } from '$lib/utils/navigation';
import { getAssetDuplicates } from '@immich/sdk'; import { getAssetDuplicates } from '@immich/sdk';
import { t } from 'svelte-i18n';
import { get } from 'svelte/store';
import type { PageLoad } from './$types'; import type { PageLoad } from './$types';
export const load = (async ({ params }) => { export const load = (async ({ params }) => {
await authenticate(); await authenticate();
const asset = await getAssetInfoFromParam(params); const asset = await getAssetInfoFromParam(params);
const duplicates = await getAssetDuplicates(); const duplicates = await getAssetDuplicates();
const $t = get(t);
return { return {
asset, asset,
duplicates, duplicates,
meta: { meta: {
title: 'Duplicates', title: $t('duplicates'),
}, },
}; };
}) satisfies PageLoad; }) satisfies PageLoad;

View file

@ -1,6 +1,8 @@
import { AppRoute } from '$lib/constants'; import { AppRoute } from '$lib/constants';
import { getServerConfig } from '@immich/sdk'; import { getServerConfig } from '@immich/sdk';
import { redirect } from '@sveltejs/kit'; import { redirect } from '@sveltejs/kit';
import { t } from 'svelte-i18n';
import { get } from 'svelte/store';
import { loadUser } from '../lib/utils/auth'; import { loadUser } from '../lib/utils/auth';
import type { PageLoad } from './$types'; import type { PageLoad } from './$types';
@ -19,10 +21,12 @@ export const load = (async () => {
redirect(302, AppRoute.AUTH_LOGIN); redirect(302, AppRoute.AUTH_LOGIN);
} }
const $t = get(t);
return { return {
meta: { meta: {
title: 'Welcome 🎉', title: $t('welcome') + ' 🎉',
description: 'Immich Web Interface', description: $t('immich_web_interface'),
}, },
}; };
}) satisfies PageLoad; }) satisfies PageLoad;