From a8b44b09a404aee477e735501b828d1b14aad311 Mon Sep 17 00:00:00 2001
From: ivarlovlie <git@ivarlovlie.no>
Date: Tue, 7 Jun 2022 01:33:52 +0200
Subject: feat: Add inital translation support

---
 apps/projects/src/app/pages/views/entry-form/index.svelte | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

(limited to 'apps/projects/src/app/pages/views/entry-form/index.svelte')

diff --git a/apps/projects/src/app/pages/views/entry-form/index.svelte b/apps/projects/src/app/pages/views/entry-form/index.svelte
index cb974ed..cf3d173 100644
--- a/apps/projects/src/app/pages/views/entry-form/index.svelte
+++ b/apps/projects/src/app/pages/views/entry-form/index.svelte
@@ -1,4 +1,5 @@
 <script lang="ts">
+    import LL from "$app/lib/i18n/i18n-svelte";
     import {TimeEntryDto} from "$shared/lib/models/TimeEntryDto";
     import {Temporal} from "@js-temporal/polyfill";
     import {createEventDispatcher, onMount, onDestroy} from "svelte";
@@ -48,7 +49,7 @@
 
     function description_is_valid() {
         if (!description) {
-            descriptionError = "Description is required";
+            descriptionError = $LL.views.entryForm.errDescriptionReq();
         } else {
             descriptionError = "";
         }
@@ -97,7 +98,7 @@
                     functions.reset();
                     dispatch("updated", response.data);
                 } else {
-                    formError = "An error occured while updating the entry, try again soon";
+                    formError = $LL.views.entryForm.entryUpdateError();
                     formIsLoading = false;
                 }
             } else {
@@ -106,7 +107,7 @@
                     functions.reset();
                     dispatch("created");
                 } else {
-                    formError = "An error occured while creating the entry, try again soon";
+                    formError = $LL.views.entryForm.entryCreateError();
                     formIsLoading = false;
                 }
             }
@@ -175,14 +176,14 @@
     <div class="margin-bottom-sm">
         <Textarea class="width-100%"
                   id="description"
-                  label="Description"
+                  label="{$LL.views.entryForm.description()}"
                   errorText="{descriptionError}"
                   bind:value={description}></Textarea>
     </div>
 
     <div class="flex flex-row justify-end gap-x-xs">
         {#if entryId}
-            <Button text="Reset"
+            <Button text="{$LL.views.entryForm.reset()}"
                     on:click={() => functions.reset()}
                     variant="subtle"
             />
@@ -190,7 +191,7 @@
         <Button loading={formIsLoading}
                 type="submit"
                 variant="primary"
-                text={entryId ? "Save" : "Create"}
+                text={entryId ? $LL.views.entryForm.save() : $LL.views.entryForm.create()}
         />
     </div>
 </form>
-- 
cgit v1.3

