feat(web): More localisation (#1441)

* File size localisation

* Localisation for sidebar tooltips

* Localisation for active/waiting jobs

* Localisation for selected item counts

* Prettier

* Ignore Jest coverage directory for Prettier
This commit is contained in:
Kiel Hurley 2023-01-28 18:57:25 +13:00 committed by GitHub
parent 12ecf366b0
commit 5aee5c0fb8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 25 additions and 12 deletions

View file

@ -3,6 +3,7 @@ node_modules
/build /build
/.svelte-kit /.svelte-kit
/package /package
/coverage
.env .env
.env.* .env.*
!.env.example !.env.example

View file

@ -22,6 +22,8 @@
const run = (includeAllAssets: boolean) => { const run = (includeAllAssets: boolean) => {
dispatch('click', { includeAllAssets }); dispatch('click', { includeAllAssets });
}; };
const locale = navigator.language;
</script> </script>
<div class="flex justify-between rounded-3xl bg-gray-100 dark:bg-immich-dark-gray"> <div class="flex justify-between rounded-3xl bg-gray-100 dark:bg-immich-dark-gray">
@ -43,7 +45,7 @@
<p>Active</p> <p>Active</p>
<p class="text-2xl"> <p class="text-2xl">
{#if jobCounts.active !== undefined} {#if jobCounts.active !== undefined}
{jobCounts.active} {jobCounts.active.toLocaleString(locale)}
{:else} {:else}
<LoadingSpinner /> <LoadingSpinner />
{/if} {/if}
@ -55,7 +57,7 @@
> >
<p class="text-2xl"> <p class="text-2xl">
{#if jobCounts.waiting !== undefined} {#if jobCounts.waiting !== undefined}
{jobCounts.waiting} {jobCounts.waiting.toLocaleString(locale)}
{:else} {:else}
<LoadingSpinner /> <LoadingSpinner />
{/if} {/if}

View file

@ -383,7 +383,7 @@
> >
<svelte:fragment slot="leading"> <svelte:fragment slot="leading">
<p class="font-medium text-immich-primary dark:text-immich-dark-primary"> <p class="font-medium text-immich-primary dark:text-immich-dark-primary">
Selected {multiSelectAsset.size} Selected {multiSelectAsset.size.toLocaleString(locale)}
</p> </p>
</svelte:fragment> </svelte:fragment>
<svelte:fragment slot="trailing"> <svelte:fragment slot="trailing">

View file

@ -28,6 +28,8 @@
assetInteractionStore.clearMultiselect(); assetInteractionStore.clearMultiselect();
}; };
const locale = navigator.language;
</script> </script>
<section <section
@ -44,7 +46,9 @@
{#if $selectedAssets.size == 0} {#if $selectedAssets.size == 0}
<p class="text-lg dark:text-immich-dark-fg">Add to album</p> <p class="text-lg dark:text-immich-dark-fg">Add to album</p>
{:else} {:else}
<p class="text-lg dark:text-immich-dark-fg">{$selectedAssets.size} selected</p> <p class="text-lg dark:text-immich-dark-fg">
{$selectedAssets.size.toLocaleString(locale)} selected
</p>
{/if} {/if}
</svelte:fragment> </svelte:fragment>

View file

@ -79,6 +79,8 @@
clearMultiSelectAssetAssetHandler(); clearMultiSelectAssetAssetHandler();
} }
}; };
const locale = navigator.language;
</script> </script>
<section class="bg-immich-bg dark:bg-immich-dark-bg"> <section class="bg-immich-bg dark:bg-immich-dark-bg">
@ -90,7 +92,7 @@
> >
<svelte:fragment slot="leading"> <svelte:fragment slot="leading">
<p class="font-medium text-immich-primary dark:text-immich-dark-primary"> <p class="font-medium text-immich-primary dark:text-immich-dark-primary">
Selected {selectedAssets.size} Selected {selectedAssets.size.toLocaleString(locale)}
</p> </p>
</svelte:fragment> </svelte:fragment>
<svelte:fragment slot="trailing"> <svelte:fragment slot="trailing">

View file

@ -42,6 +42,8 @@
owned: albumCount.owned owned: albumCount.owned
}; };
}; };
const locale = navigator.language;
</script> </script>
<section id="sidebar" class="flex flex-col gap-1 pt-8 pr-6 bg-immich-bg dark:bg-immich-dark-bg"> <section id="sidebar" class="flex flex-col gap-1 pt-8 pr-6 bg-immich-bg dark:bg-immich-dark-bg">
@ -73,8 +75,8 @@
<LoadingSpinner /> <LoadingSpinner />
{:then data} {:then data}
<div> <div>
<p>{data.videos} Videos</p> <p>{data.videos.toLocaleString(locale)} Videos</p>
<p>{data.photos} Photos</p> <p>{data.photos.toLocaleString(locale)} Photos</p>
</div> </div>
{/await} {/await}
</div> </div>
@ -104,7 +106,7 @@
<LoadingSpinner /> <LoadingSpinner />
{:then data} {:then data}
<div> <div>
<p>{data.shared + data.sharing} Albums</p> <p>{(data.shared + data.sharing).toLocaleString(locale)} Albums</p>
</div> </div>
{/await} {/await}
</div> </div>
@ -174,7 +176,7 @@
<LoadingSpinner /> <LoadingSpinner />
{:then data} {:then data}
<div> <div>
<p>{data.owned} Albums</p> <p>{data.owned.toLocaleString(locale)} Albums</p>
</div> </div>
{/await} {/await}
</div> </div>

View file

@ -6,7 +6,7 @@
import WindowMinimize from 'svelte-material-icons/WindowMinimize.svelte'; import WindowMinimize from 'svelte-material-icons/WindowMinimize.svelte';
import type { UploadAsset } from '$lib/models/upload-asset'; import type { UploadAsset } from '$lib/models/upload-asset';
import { notificationController, NotificationType } from './notification/notification'; import { notificationController, NotificationType } from './notification/notification';
import { getBytesWithUnit } from '../../utils/byte-units'; import { asByteUnitString } from '$lib/utils/byte-units';
let showDetail = true; let showDetail = true;
@ -116,7 +116,7 @@
<input <input
disabled disabled
class="bg-gray-100 border w-full p-1 rounded-md text-[10px] px-2" class="bg-gray-100 border w-full p-1 rounded-md text-[10px] px-2"
value={`[${getBytesWithUnit(uploadAsset.file.size)}] ${uploadAsset.file.name}`} value={`[${asByteUnitString(uploadAsset.file.size)}] ${uploadAsset.file.name}`}
/> />
<div class="w-full bg-gray-300 h-[15px] rounded-md mt-[5px] text-white relative"> <div class="w-full bg-gray-300 h-[15px] rounded-md mt-[5px] text-white relative">

View file

@ -145,6 +145,8 @@
assetInteractionStore.clearMultiselect(); assetInteractionStore.clearMultiselect();
isShowCreateSharedLinkModal = false; isShowCreateSharedLinkModal = false;
}; };
const locale = navigator.language;
</script> </script>
<section> <section>
@ -156,7 +158,7 @@
> >
<svelte:fragment slot="leading"> <svelte:fragment slot="leading">
<p class="font-medium text-immich-primary dark:text-immich-dark-primary"> <p class="font-medium text-immich-primary dark:text-immich-dark-primary">
Selected {$selectedAssets.size} Selected {$selectedAssets.size.toLocaleString(locale)}
</p> </p>
</svelte:fragment> </svelte:fragment>
<svelte:fragment slot="trailing"> <svelte:fragment slot="trailing">