Skip to content

Commit

Permalink
fix: fix template i18n
Browse files Browse the repository at this point in the history
  • Loading branch information
nichenqin committed Dec 5, 2024
1 parent 16a95b7 commit c371276
Show file tree
Hide file tree
Showing 10 changed files with 173 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import TemplatePreview from "./template-preview.svelte"
import { Checkbox } from "$lib/components/ui/checkbox/index.js"
import Label from "$lib/components/ui/label/label.svelte"
import { LL } from "@undb/i18n/client"
let includeData = false
Expand Down Expand Up @@ -67,15 +68,16 @@
disabled={$createFromTemplate.isPending}
>
<FullscreenIcon class="mr-2 size-4" />
Preview Template
{$LL.template.previewTemplate()}
</Button>
</Dialog.Trigger>
<Dialog.Content class="flex h-[90%] !w-[90%] !max-w-none flex-col overflow-hidden">
<Dialog.Header class="flex flex-row justify-between">
<div class="space-y-2">
<Dialog.Title>
<span>
Preview template {template.name}
{$LL.template.previewTemplate()}
{template.name}
</span>
</Dialog.Title>
<Dialog.Description class="max-w-4xl">
Expand All @@ -92,7 +94,7 @@
{#if $createFromTemplate.isPending}
<LoaderCircleIcon class="mr-2 size-4 animate-spin" />
{/if}
Use this Template
{$LL.template.useThisTemplate()}
</Button>

<div class="flex items-center space-x-2">
Expand All @@ -101,7 +103,7 @@
for="terms"
class="text-xs font-medium leading-none text-gray-500 peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
>
Include data.
{$LL.table.record.includeData()}
</Label>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import * as Form from "$lib/components/ui/form/index.js"
import { goto, invalidate } from "$app/navigation"
import LoginOrSignup from "../auth/login-or-signup.svelte"
import { LL } from "@undb/i18n/client"
export let template: ITemplateDTO
export let me: any
Expand Down Expand Up @@ -103,18 +104,18 @@
}}
>
<Dialog.Trigger asChild let:builder>
<Button size="sm" builders={[builder]}>Get started with this template</Button>
<Button size="sm" builders={[builder]}>{$LL.template.getStarted()}</Button>
</Dialog.Trigger>
<Dialog.Content>
<Dialog.Header>
<Dialog.Title>Which space do you want to create this template in?</Dialog.Title>
<Dialog.Description>You can create a new base or a new table in the selected space.</Dialog.Description>
<Dialog.Title>{$LL.template.whichSpace()}</Dialog.Title>
<Dialog.Description>{$LL.template.whichSpaceDescription()}</Dialog.Description>
</Dialog.Header>

<form method="POST" use:enhance>
<Form.Field {form} name="spaceId">
<Form.Control let:attrs>
<Form.Label>Space</Form.Label>
<Form.Label>{$LL.space.space()}</Form.Label>

<Select.Root
selected={selectedSpace}
Expand All @@ -123,7 +124,7 @@
}}
>
<Select.Trigger class="w-full">
<Select.Value placeholder="Space" />
<Select.Value placeholder={$LL.space.space()} />
</Select.Trigger>
<Select.Content sameWidth>
{#each items as item}
Expand All @@ -133,9 +134,7 @@
</Select.Root>
<input hidden bind:value={$formData.spaceId} name={attrs.name} />
</Form.Control>
<Form.Description
>Select a space to create a new base or a new table in the selected space.</Form.Description
>
<Form.Description>{$LL.template.selectATemplateToCreateABase()}</Form.Description>
<Form.FieldErrors />
</Form.Field>

Expand All @@ -147,8 +146,8 @@
<Form.Control let:attrs>
<Checkbox {...attrs} bind:checked={$formData.includeData} />
<div class="space-y-1 leading-none">
<Form.Label>Include data</Form.Label>
<Form.Description>Include data from the template to the new base or table.</Form.Description>
<Form.Label>{$LL.table.record.includeData()}</Form.Label>
<Form.Description>{$LL.template.includeDataDescription()}</Form.Description>
</div>
<input name={attrs.name} value={$formData.includeData} hidden />
</Form.Control>
Expand All @@ -158,14 +157,14 @@
{#if $createFromTemplate.isPending}
<LoaderCircleIcon class="mr-2 size-4 animate-spin" />
{/if}
Import
{$LL.common.import()}
</Form.Button>
</form>
</Dialog.Content>
</Dialog.Root>
{:else}
<Button href={`/login?redirect=${encodeURIComponent(`/templates/${template.id}`)}`}
>Login to create a new base or table</Button
>{$LL.template.loginToCreateNewBaseOrTable()}</Button
>
{/if}
</header>
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import Logo from "$lib/images/logo.svg"
import { Button } from "$lib/components/ui/button"
import { page } from "$app/stores"
import { LL } from "@undb/i18n/client"
export let data: LayoutData
Expand Down Expand Up @@ -36,7 +37,9 @@
<span class="font-bold"> Undb </span>
</a>

<Button href={`/create-from-share/${$page.params.shareId}`} size="sm">Use this template</Button>
<Button href={`/create-from-share/${$page.params.shareId}`} size="sm">
{$LL.template.useThisTemplate()}
</Button>
</div>
<div class="w-full flex-1 overflow-y-auto">
<ShareBaseNav {base} />
Expand Down
14 changes: 12 additions & 2 deletions packages/i18n/src/i18n/en/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -528,6 +528,7 @@ const webhook = {
}

const space = {
space: 'Space',
spaces: 'Spaces',
name: "Space Name",
setDisplayName: 'Set Display Name',
Expand Down Expand Up @@ -623,8 +624,16 @@ const webhook = {
}

const template = {
template: 'Template',
useThisTemplate: 'Use this template',
previewTemplate: 'Preview Template',
getStarted: 'Get Started with this template',
whichSpace: "Which space do you want to create this template in?",
whichSpaceDescription: "You can create a new base or a new table in the selected space.",
createBase: 'Create New Base',
selectATemplateToCreateABase: 'Select a template to create a new base'
selectATemplateToCreateABase: 'Select a template to create a new base',
includeDataDescription: 'Include data from the template to the new base or table.',
loginToCreateNewBaseOrTable: 'Login to create a new base or table'
}

const auth = {
Expand Down Expand Up @@ -722,7 +731,8 @@ const en = {
today: 'Today',
clear: 'Clear',
updated: 'Updated',
now: 'Now'
now: 'Now',
import: 'Import'
},
share: {
title: 'Share',
Expand Down
14 changes: 12 additions & 2 deletions packages/i18n/src/i18n/es/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -515,6 +515,7 @@ const base = {
}

const space = {
space: 'Espacio',
spaces: 'Espacios',
name: 'Nombre del espacio',
setDisplayName: 'Establecer nombre de visualización',
Expand Down Expand Up @@ -619,8 +620,16 @@ const events = {
}

const template = {
template: 'Plantilla',
useThisTemplate: 'Usar esta plantilla',
previewTemplate: 'Vista previa de plantilla',
getStarted: 'Comenzar con esta plantilla',
whichSpace: "¿Qué espacio quieres crear esta plantilla en?",
whichSpaceDescription: "Puedes crear una nueva Base o una nueva tabla en el espacio seleccionado.",
createBase: 'Crear Base',
selectATemplateToCreateABase: 'Selecciona una plantilla para crear una Base'
selectATemplateToCreateABase: 'Selecciona una plantilla para crear una Base',
includeDataDescription: 'Incluir datos de la plantilla en la nueva Base o tabla.',
loginToCreateNewBaseOrTable: 'Iniciar sesión para crear una nueva Base o tabla'
}

const auth = {
Expand Down Expand Up @@ -715,7 +724,8 @@ const es = {
today: 'Hoy',
clear: 'Limpiar',
updated: 'Actualizado',
now: 'Ahora'
now: 'Ahora',
import: 'Importar'
},
share: {
title: 'Compartir',
Expand Down
80 changes: 80 additions & 0 deletions packages/i18n/src/i18n/i18n-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,30 @@ type RootTranslation = {
enterYourWorkEmail: string
}
template: {
/**
* T​e​m​p​l​a​t​e
*/
template: string
/**
* U​s​e​ ​t​h​i​s​ ​t​e​m​p​l​a​t​e
*/
useThisTemplate: string
/**
* P​r​e​v​i​e​w​ ​T​e​m​p​l​a​t​e
*/
previewTemplate: string
/**
* G​e​t​ ​S​t​a​r​t​e​d​ ​w​i​t​h​ ​t​h​i​s​ ​t​e​m​p​l​a​t​e
*/
getStarted: string
/**
* W​h​i​c​h​ ​s​p​a​c​e​ ​d​o​ ​y​o​u​ ​w​a​n​t​ ​t​o​ ​c​r​e​a​t​e​ ​t​h​i​s​ ​t​e​m​p​l​a​t​e​ ​i​n​?
*/
whichSpace: string
/**
* Y​o​u​ ​c​a​n​ ​c​r​e​a​t​e​ ​a​ ​n​e​w​ ​b​a​s​e​ ​o​r​ ​a​ ​n​e​w​ ​t​a​b​l​e​ ​i​n​ ​t​h​e​ ​s​e​l​e​c​t​e​d​ ​s​p​a​c​e​.
*/
whichSpaceDescription: string
/**
* C​r​e​a​t​e​ ​N​e​w​ ​B​a​s​e
*/
Expand All @@ -138,6 +162,14 @@ type RootTranslation = {
* S​e​l​e​c​t​ ​a​ ​t​e​m​p​l​a​t​e​ ​t​o​ ​c​r​e​a​t​e​ ​a​ ​n​e​w​ ​b​a​s​e
*/
selectATemplateToCreateABase: string
/**
* I​n​c​l​u​d​e​ ​d​a​t​a​ ​f​r​o​m​ ​t​h​e​ ​t​e​m​p​l​a​t​e​ ​t​o​ ​t​h​e​ ​n​e​w​ ​b​a​s​e​ ​o​r​ ​t​a​b​l​e​.
*/
includeDataDescription: string
/**
* L​o​g​i​n​ ​t​o​ ​c​r​e​a​t​e​ ​a​ ​n​e​w​ ​b​a​s​e​ ​o​r​ ​t​a​b​l​e
*/
loginToCreateNewBaseOrTable: string
}
setting: {
/**
Expand Down Expand Up @@ -221,6 +253,10 @@ type RootTranslation = {
systemFieldsUpdated: string
}
space: {
/**
* S​p​a​c​e
*/
space: string
/**
* S​p​a​c​e​s
*/
Expand Down Expand Up @@ -2282,6 +2318,10 @@ type RootTranslation = {
* N​o​w
*/
now: string
/**
* I​m​p​o​r​t
*/
'import': string
}
share: {
/**
Expand Down Expand Up @@ -2532,6 +2572,30 @@ export type TranslationFunctions = {
enterYourWorkEmail: () => LocalizedString
}
template: {
/**
* Template
*/
template: () => LocalizedString
/**
* Use this template
*/
useThisTemplate: () => LocalizedString
/**
* Preview Template
*/
previewTemplate: () => LocalizedString
/**
* Get Started with this template
*/
getStarted: () => LocalizedString
/**
* Which space do you want to create this template in?
*/
whichSpace: () => LocalizedString
/**
* You can create a new base or a new table in the selected space.
*/
whichSpaceDescription: () => LocalizedString
/**
* Create New Base
*/
Expand All @@ -2540,6 +2604,14 @@ export type TranslationFunctions = {
* Select a template to create a new base
*/
selectATemplateToCreateABase: () => LocalizedString
/**
* Include data from the template to the new base or table.
*/
includeDataDescription: () => LocalizedString
/**
* Login to create a new base or table
*/
loginToCreateNewBaseOrTable: () => LocalizedString
}
setting: {
/**
Expand Down Expand Up @@ -2622,6 +2694,10 @@ export type TranslationFunctions = {
systemFieldsUpdated: () => LocalizedString
}
space: {
/**
* Space
*/
space: () => LocalizedString
/**
* Spaces
*/
Expand Down Expand Up @@ -4658,6 +4734,10 @@ export type TranslationFunctions = {
* Now
*/
now: () => LocalizedString
/**
* Import
*/
'import': () => LocalizedString
}
share: {
/**
Expand Down
14 changes: 12 additions & 2 deletions packages/i18n/src/i18n/ja/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -518,6 +518,7 @@ const base = {
}

const space = {
space: 'スペース',
spaces: 'スペース',
name: 'スペース名',
setDisplayName: '表示名を設定',
Expand Down Expand Up @@ -622,8 +623,16 @@ const events = {
}

const template = {
template: 'テンプレート',
useThisTemplate: 'このテンプレートを使用',
previewTemplate: 'テンプレートのプレビュー',
getStarted: 'このテンプレートを使用して開始',
whichSpace: "このテンプレートを作成するスペースはどれですか?",
whichSpaceDescription: "新しい Base または新しいテーブルを選択したスペースに作成できます。",
createBase: 'Base を作成',
selectATemplateToCreateABase: 'テンプレートを選択して Base を作成します'
selectATemplateToCreateABase: 'テンプレートを選択して Base を作成します',
includeDataDescription: 'テンプレートのデータを新しい Base またはテーブルに含めます。',
loginToCreateNewBaseOrTable: 'ログインして新しい Base またはテーブルを作成します'
}

const auth = {
Expand Down Expand Up @@ -721,7 +730,8 @@ const ja = {
today: '今日',
clear: 'クリア',
updated: '更新済み',
now: '現在'
now: '現在',
import: 'インポート'
},
share: {
title: '共有',
Expand Down
Loading

0 comments on commit c371276

Please sign in to comment.