Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(web): another missing translations #10274

Merged
merged 57 commits into from
Jun 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
5f363f5
chore(web): another missing translations
waclaw66 Jun 13, 2024
57ea1ec
unused removed
waclaw66 Jun 13, 2024
22306f1
Merge branch 'main' into chore/missing-translations
waclaw66 Jun 13, 2024
ef489d9
more keys
waclaw66 Jun 14, 2024
dd6dc0c
Merge branch 'main' into chore/missing-translations
waclaw66 Jun 14, 2024
df8b722
lint fix
waclaw66 Jun 14, 2024
95c9038
test fixed
waclaw66 Jun 14, 2024
233aa12
dynamic translation fix
waclaw66 Jun 14, 2024
f4c233b
fixes
waclaw66 Jun 14, 2024
f0c35df
people search translation
waclaw66 Jun 14, 2024
7a6403f
params fixed
waclaw66 Jun 14, 2024
231fefe
keep filter setting fix
waclaw66 Jun 14, 2024
7a04166
lint fix
waclaw66 Jun 14, 2024
45dd696
$t fixes
waclaw66 Jun 15, 2024
3757636
Update web/src/lib/i18n/en.json
waclaw66 Jun 15, 2024
b78f13b
another missing
waclaw66 Jun 16, 2024
82b2bdb
activity translation
waclaw66 Jun 16, 2024
08777dc
link sharing translations
waclaw66 Jun 17, 2024
3c34bc9
expiration dropdown fix - didn't work localized
waclaw66 Jun 17, 2024
9b6064c
Merge branch 'main' into chore/missing-translations
waclaw66 Jun 17, 2024
669715f
notification title
waclaw66 Jun 17, 2024
5b9ea19
device logout
waclaw66 Jun 17, 2024
c27cc94
search results
waclaw66 Jun 17, 2024
35c72c0
reset to default
waclaw66 Jun 17, 2024
1c19681
unsaved change
waclaw66 Jun 17, 2024
21cbbe7
select from computer
waclaw66 Jun 17, 2024
9eb8140
selected
waclaw66 Jun 17, 2024
368a20d
select-2
waclaw66 Jun 17, 2024
7748f24
select-3
waclaw66 Jun 17, 2024
a8c711b
unmerge
waclaw66 Jun 17, 2024
cea498c
Merge branch 'main' into chore/missing-translations
waclaw66 Jun 17, 2024
fac0716
Merge branch 'main' into chore/missing-translations
waclaw66 Jun 18, 2024
716954b
pluralize, force icu message
waclaw66 Jun 18, 2024
9a91f6d
Update web/src/lib/components/asset-viewer/asset-viewer.svelte
waclaw66 Jun 18, 2024
870b586
review fixes
waclaw66 Jun 18, 2024
7438f44
remove user
waclaw66 Jun 18, 2024
e1e8068
plural fixes
waclaw66 Jun 18, 2024
599f588
ffmpeg settings
waclaw66 Jun 19, 2024
a72e37d
Merge branch 'main' into chore/missing-translations
waclaw66 Jun 19, 2024
880e371
fixes
waclaw66 Jun 19, 2024
dec6c72
error title
waclaw66 Jun 20, 2024
e9dba7f
plural fixes
waclaw66 Jun 20, 2024
2cb64d0
onboarding
waclaw66 Jun 20, 2024
4e6f0a6
change password
waclaw66 Jun 20, 2024
082dc58
Merge branch 'main' into chore/missing-translations
waclaw66 Jun 21, 2024
f994dc9
more more
waclaw66 Jun 21, 2024
61c8826
console log fix
waclaw66 Jun 21, 2024
f2ecb22
another
waclaw66 Jun 21, 2024
d142817
Merge branch 'main' of https://github.com/waclaw66/immich into chore/…
waclaw66 Jun 21, 2024
b3c42e4
Merge branch 'main' into chore/missing-translations
waclaw66 Jun 24, 2024
2d99a38
api key desc
waclaw66 Jun 24, 2024
6171e37
map marker
waclaw66 Jun 24, 2024
ba429dc
format fix
waclaw66 Jun 24, 2024
f2c00c7
key fix
waclaw66 Jun 24, 2024
29d3bf0
asset-utils
waclaw66 Jun 24, 2024
6419402
utils
waclaw66 Jun 24, 2024
35b698a
misc
waclaw66 Jun 24, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@
{ value: '1080', text: '1080p' },
{ value: '720', text: '720p' },
{ value: '480', text: '480p' },
{ value: 'original', text: 'original' },
{ value: 'original', text: $t('original') },
]}
name="resolution"
isEdited={config.ffmpeg.targetResolution !== savedConfig.ffmpeg.targetResolution}
Expand Down Expand Up @@ -191,7 +191,7 @@
bind:value={config.ffmpeg.transcode}
name="transcode"
options={[
{ value: TranscodePolicy.All, text: 'All videos' },
{ value: TranscodePolicy.All, text: $t('all_videos') },
{
value: TranscodePolicy.Optimal,
text: $t('admin.transcoding_optimal_description'),
Expand Down Expand Up @@ -233,7 +233,7 @@
},
{
value: ToneMapping.Disabled,
text: 'Disabled',
text: $t('disabled'),
},
]}
isEdited={config.ffmpeg.tonemap !== savedConfig.ffmpeg.tonemap}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,20 @@ import { sdkMock } from '$lib/__mocks__/sdk.mock';
import { albumFactory } from '@test-data';
import '@testing-library/jest-dom';
import { fireEvent, render, waitFor, type RenderResult } from '@testing-library/svelte';
import { init, register, waitLocale } from 'svelte-i18n';
import AlbumCard from '../album-card.svelte';

const onShowContextMenu = vi.fn();

describe('AlbumCard component', () => {
let sut: RenderResult<AlbumCard>;

beforeAll(async () => {
await init({ fallbackLocale: 'en-US' });
register('en-US', () => import('$lib/i18n/en.json'));
await waitLocale('en-US');
});

it.each([
{
album: albumFactory.build({ albumThumbnailAssetId: null, shared: false, assetCount: 0 }),
Expand Down Expand Up @@ -36,7 +43,7 @@ describe('AlbumCard component', () => {
const albumImgElement = sut.getByTestId('album-image');
const albumNameElement = sut.getByTestId('album-name');
const albumDetailsElement = sut.getByTestId('album-details');
const detailsText = `${count} items` + (shared ? ' . shared' : '');
const detailsText = `${count} items` + (shared ? ' . Shared' : '');

expect(albumImgElement).toHaveAttribute('src');
expect(albumImgElement).toHaveAttribute('alt', album.albumName);
Expand Down
3 changes: 2 additions & 1 deletion web/src/lib/components/album-page/album-card-group.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import { mdiChevronRight } from '@mdi/js';
import AlbumCard from '$lib/components/album-page/album-card.svelte';
import Icon from '$lib/components/elements/icon.svelte';
import { t } from 'svelte-i18n';

export let albums: AlbumResponseDto[];
export let group: AlbumGroup | undefined = undefined;
Expand Down Expand Up @@ -41,7 +42,7 @@
class="inline-block -mt-2.5 transition-all duration-[250ms] {iconRotation}"
/>
<span class="font-bold text-3xl text-black dark:text-white">{group.name}</span>
<span class="ml-1.5">({albums.length} {albums.length > 1 ? 'albums' : 'album'})</span>
<span class="ml-1.5">({$t('albums_count', { values: { count: albums.length } })})</span>
</button>
<hr class="dark:border-immich-dark-gray" />
</div>
Expand Down
7 changes: 2 additions & 5 deletions web/src/lib/components/album-page/album-card.svelte
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
<script lang="ts">
import { locale } from '$lib/stores/preferences.store';
import { user } from '$lib/stores/user.store';
import type { AlbumResponseDto } from '@immich/sdk';
import { mdiDotsVertical } from '@mdi/js';
import { getContextMenuPositionFromEvent, type ContextMenuPosition } from '$lib/utils/context-menu';
import { getShortDateRange } from '$lib/utils/date-time';
import AlbumCover from '$lib/components/album-page/album-cover.svelte';
import CircleIconButton from '$lib/components/elements/buttons/circle-icon-button.svelte';
import { s } from '$lib/utils';
import { t } from 'svelte-i18n';

export let album: AlbumResponseDto;
Expand Down Expand Up @@ -66,8 +64,7 @@
<span class="flex gap-2 text-sm dark:text-immich-dark-fg" data-testid="album-details">
{#if showItemCount}
<p>
{album.assetCount.toLocaleString($locale)}
item{s(album.assetCount)}
{$t('items_count', { values: { count: album.assetCount } })}
</p>
{/if}

Expand All @@ -79,7 +76,7 @@
{#if $user.id === album.ownerId}
<p>{$t('owned')}</p>
{:else if album.owner}
<p>Shared by {album.owner.name}</p>
<p>{$t('shared_by_user', { values: { user: album.owner.name } })}</p>
{:else}
<p>{$t('shared')}</p>
{/if}
Expand Down
2 changes: 1 addition & 1 deletion web/src/lib/components/album-page/album-options.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
/>
{/if}
<SettingSwitch
title="Comments & likes"
title={$t('comments_and_likes')}
subtitle={$t('let_others_respond')}
checked={album.isActivityEnabled}
on:toggle={() => dispatch('toggleEnableActivity')}
Expand Down
3 changes: 2 additions & 1 deletion web/src/lib/components/album-page/album-summary.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import { dateFormats } from '$lib/constants';
import { locale } from '$lib/stores/preferences.store';
import type { AlbumResponseDto } from '@immich/sdk';
import { t } from 'svelte-i18n';

export let album: AlbumResponseDto;

Expand All @@ -28,5 +29,5 @@
<span class="my-2 flex gap-2 text-sm font-medium text-gray-500" data-testid="album-details">
<span>{getDateRange(startDate, endDate)}</span>
<span>•</span>
<span>{album.assetCount} items</span>
<span>{$t('items_count', { values: { count: album.assetCount } })}</span>
</span>
54 changes: 45 additions & 9 deletions web/src/lib/components/album-page/albums-controls.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import Icon from '$lib/components/elements/icon.svelte';
import {
AlbumFilter,
AlbumSortBy,
AlbumGroupBy,
AlbumViewMode,
albumViewSettings,
Expand All @@ -25,6 +26,7 @@
type AlbumGroupOptionMetadata,
type AlbumSortOptionMetadata,
findGroupOptionMetadata,
findFilterOption,
findSortOptionMetadata,
getSelectedAlbumGroupOption,
groupOptionsMetadata,
Expand All @@ -43,6 +45,11 @@
return ordering === SortOrder.Asc ? SortOrder.Desc : SortOrder.Asc;
};

const handleChangeAlbumFilter = (filter: string, defaultFilter: AlbumFilter) => {
$albumViewSettings.filter =
Object.keys(albumFilterNames).find((key) => albumFilterNames[key as AlbumFilter] === filter) ?? defaultFilter;
};

const handleChangeGroupBy = ({ id, defaultOrder }: AlbumGroupOptionMetadata) => {
if ($albumViewSettings.groupBy === id) {
$albumViewSettings.groupOrder = flipOrdering($albumViewSettings.groupOrder);
Expand All @@ -69,15 +76,17 @@
let selectedGroupOption: AlbumGroupOptionMetadata;
let groupIcon: string;

$: selectedFilterOption = albumFilterNames[findFilterOption($albumViewSettings.filter)];

$: selectedSortOption = findSortOptionMetadata($albumViewSettings.sortBy);

$: {
selectedGroupOption = findGroupOptionMetadata($albumViewSettings.groupBy);
if (selectedGroupOption.isDisabled()) {
selectedGroupOption = findGroupOptionMetadata(AlbumGroupBy.None);
}
}

$: selectedSortOption = findSortOptionMetadata($albumViewSettings.sortBy);

$: {
if (selectedGroupOption.id === AlbumGroupBy.None) {
groupIcon = mdiFolderRemoveOutline;
Expand All @@ -88,14 +97,41 @@
}

$: sortIcon = $albumViewSettings.sortOrder === SortOrder.Desc ? mdiArrowDownThin : mdiArrowUpThin;

$: albumFilterNames = ((): Record<AlbumFilter, string> => {
return {
[AlbumFilter.All]: $t('all'),
[AlbumFilter.Owned]: $t('owned'),
[AlbumFilter.Shared]: $t('shared'),
};
})();

$: albumSortByNames = ((): Record<AlbumSortBy, string> => {
return {
[AlbumSortBy.Title]: $t('sort_title'),
[AlbumSortBy.ItemCount]: $t('sort_items'),
[AlbumSortBy.DateModified]: $t('sort_modified'),
[AlbumSortBy.DateCreated]: $t('sort_created'),
[AlbumSortBy.MostRecentPhoto]: $t('sort_recent'),
[AlbumSortBy.OldestPhoto]: $t('sort_oldest'),
};
})();

$: albumGroupByNames = ((): Record<AlbumGroupBy, string> => {
return {
[AlbumGroupBy.None]: $t('group_no'),
[AlbumGroupBy.Owner]: $t('group_owner'),
[AlbumGroupBy.Year]: $t('group_year'),
};
})();
</script>

<!-- Filter Albums by Sharing Status (All, Owned, Shared) -->
<div class="hidden xl:block h-10">
<GroupTab
filters={Object.keys(AlbumFilter)}
selected={$albumViewSettings.filter}
onSelect={(selected) => ($albumViewSettings.filter = selected)}
filters={Object.values(albumFilterNames)}
waclaw66 marked this conversation as resolved.
Show resolved Hide resolved
selected={selectedFilterOption}
onSelect={(selected) => handleChangeAlbumFilter(selected, AlbumFilter.All)}
/>
</div>

Expand All @@ -118,8 +154,8 @@
options={Object.values(sortOptionsMetadata)}
selectedOption={selectedSortOption}
on:select={({ detail }) => handleChangeSortBy(detail)}
render={({ text }) => ({
title: text,
render={({ id }) => ({
title: albumSortByNames[id],
icon: sortIcon,
})}
/>
Expand All @@ -130,8 +166,8 @@
options={Object.values(groupOptionsMetadata)}
selectedOption={selectedGroupOption}
on:select={({ detail }) => handleChangeGroupBy(detail)}
render={({ text, isDisabled }) => ({
title: text,
render={({ id, isDisabled }) => ({
title: albumGroupByNames[id],
icon: groupIcon,
disabled: isDisabled(),
})}
Expand Down
4 changes: 2 additions & 2 deletions web/src/lib/components/album-page/albums-list.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@

const isConfirmed = await dialogController.show({
id: 'delete-album',
prompt: `Are you sure you want to delete the album ${albumToDelete.albumName}?\nIf this album is shared, other users will not be able to access it anymore.`,
prompt: $t('album_delete_confirmation', { values: { album: albumToDelete.albumName } }),
});

if (!isConfirmed) {
Expand Down Expand Up @@ -340,7 +340,7 @@
message: $t('album_info_updated'),
type: NotificationType.Info,
button: {
text: 'View Album',
text: $t('view_album'),
onClick() {
return goto(`${AppRoute.ALBUMS}/${album.id}`);
},
Expand Down
16 changes: 14 additions & 2 deletions web/src/lib/components/album-page/albums-table-header.svelte
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<script lang="ts">
import { albumViewSettings, SortOrder } from '$lib/stores/preferences.store';
import { albumViewSettings, SortOrder, AlbumSortBy } from '$lib/stores/preferences.store';
import type { AlbumSortOptionMetadata } from '$lib/utils/album-utils';
import { t } from 'svelte-i18n';

export let option: AlbumSortOptionMetadata;

Expand All @@ -12,6 +13,17 @@
$albumViewSettings.sortOrder = option.defaultOrder;
}
};

$: albumSortByNames = ((): Record<AlbumSortBy, string> => {
return {
[AlbumSortBy.Title]: $t('sort_title'),
[AlbumSortBy.ItemCount]: $t('sort_items'),
[AlbumSortBy.DateModified]: $t('sort_modified'),
[AlbumSortBy.DateCreated]: $t('sort_created'),
[AlbumSortBy.MostRecentPhoto]: $t('sort_recent'),
[AlbumSortBy.OldestPhoto]: $t('sort_oldest'),
};
})();
</script>

<th class="text-sm font-medium {option.columnStyle}">
Expand All @@ -27,6 +39,6 @@
&#8593;
{/if}
{/if}
{option.text}
{albumSortByNames[option.id]}
</button>
</th>
4 changes: 3 additions & 1 deletion web/src/lib/components/album-page/albums-table-row.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@
path={mdiShareVariantOutline}
size="16"
class="inline ml-1 opacity-70"
title={album.ownerId === $user.id ? $t('shared_by_you') : `Shared by ${album.owner.name}`}
title={album.ownerId === $user.id
? $t('shared_by_you')
: $t('shared_by_user', { values: { user: album.owner.name } })}
/>
{/if}
</td>
Expand Down
4 changes: 2 additions & 2 deletions web/src/lib/components/album-page/albums-table.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
sortOptionsMetadata,
type AlbumGroup,
} from '$lib/utils/album-utils';
import { t } from 'svelte-i18n';

export let groupedAlbums: AlbumGroup[];
export let albumGroupOption: string = AlbumGroupBy.None;
Expand Down Expand Up @@ -58,8 +59,7 @@
/>
<span class="font-bold text-2xl">{albumGroup.name}</span>
<span class="ml-1.5">
({albumGroup.albums.length}
{albumGroup.albums.length > 1 ? 'albums' : 'album'})
({$t('albums_count', { values: { count: albumGroup.albums.length } })})
</span>
</td>
</tr>
Expand Down
23 changes: 14 additions & 9 deletions web/src/lib/components/album-page/share-info-modal.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,10 @@
try {
await removeUserFromAlbum({ id: album.id, userId });
dispatch('remove', userId);
const message = userId === 'me' ? `Left ${album.albumName}` : `Removed ${selectedRemoveUser.name}`;
const message =
userId === 'me'
? $t('album_user_left', { values: { album: album.albumName } })
: $t('album_user_removed', { values: { user: selectedRemoveUser.name } });
notificationController.show({ type: NotificationType.Info, message });
} catch (error) {
handleError(error, $t('errors.unable_to_remove_album_users'));
Expand All @@ -65,7 +68,9 @@
const handleSetReadonly = async (user: UserResponseDto, role: AlbumUserRole) => {
try {
await updateAlbumUser({ id: album.id, userId: user.id, updateAlbumUserDto: { role } });
const message = `Set ${user.name} as ${role}`;
const message = $t('user_role_set', {
values: { user: user.name, role: role == AlbumUserRole.Viewer ? $t('role_viewer') : $t('role_editor') },
});
dispatch('refreshAlbum');
notificationController.show({ type: NotificationType.Info, message });
} catch (error) {
Expand Down Expand Up @@ -101,9 +106,9 @@
<div id="icon-{user.id}" class="flex place-items-center gap-2 text-sm">
<div>
{#if role === AlbumUserRole.Viewer}
Viewer
{$t('role_viewer')}
{:else}
Editor
{$t('role_editor')}
{/if}
</div>
{#if isOwned}
Expand Down Expand Up @@ -135,8 +140,8 @@

{#if selectedRemoveUser && selectedRemoveUser?.id === currentUser?.id}
<ConfirmDialog
title="Leave album?"
prompt="Are you sure you want to leave {album.albumName}?"
title={$t('album_leave')}
prompt={$t('album_leave_confirmation', { values: { album: album.albumName } })}
confirmText={$t('leave')}
onConfirm={handleRemoveUser}
onCancel={() => (selectedRemoveUser = null)}
Expand All @@ -145,9 +150,9 @@

{#if selectedRemoveUser && selectedRemoveUser?.id !== currentUser?.id}
<ConfirmDialog
title="Remove user?"
prompt="Are you sure you want to remove {selectedRemoveUser.name}?"
confirmText={$t('remove')}
title={$t('album_remove_user')}
prompt={$t('album_remove_user_confirmation', { values: { user: selectedRemoveUser.name } })}
confirmText={$t('remove_user')}
onConfirm={handleRemoveUser}
onCancel={() => (selectedRemoveUser = null)}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
disabled={selectedThumbnail == undefined}
on:click={() => dispatch('thumbnail', selectedThumbnail)}
>
Done
{$t('done')}
</Button>
</svelte:fragment>
</ControlAppBar>
Expand Down
Loading
Loading