From a788b7bc138d9022fce08ac36f011d2da76a5d55 Mon Sep 17 00:00:00 2001 From: Restray Date: Sat, 2 Apr 2022 23:00:03 +0200 Subject: [PATCH] Add translation for applications components --- src/lib/locales/en.json | 93 +++++++++++++++++- src/routes/applications/[id]/__layout.svelte | 53 +++++----- src/routes/applications/[id]/check.json.ts | 7 +- .../[id]/configuration/buildpack.svelte | 2 +- src/routes/applications/[id]/index.svelte | 97 +++++++++++-------- .../[id]/logs/build/_BuildLog.svelte | 3 +- .../applications/[id]/logs/build/index.svelte | 18 ++-- .../applications/[id]/logs/index.svelte | 3 +- .../applications/[id]/previews/index.svelte | 21 ++-- .../applications/[id]/secrets/_Secret.svelte | 19 ++-- .../applications/[id]/secrets/index.svelte | 14 ++- src/routes/applications/[id]/settings.json.ts | 4 +- .../applications/[id]/storage/_Storage.svelte | 18 ++-- .../applications/[id]/storage/index.svelte | 8 +- src/routes/applications/_Application.svelte | 3 +- src/routes/applications/index.svelte | 5 +- 16 files changed, 249 insertions(+), 119 deletions(-) diff --git a/src/lib/locales/en.json b/src/lib/locales/en.json index 2c6d457eb..6c52891c6 100644 --- a/src/lib/locales/en.json +++ b/src/lib/locales/en.json @@ -30,7 +30,21 @@ "passwords_not_match": "Passwords do not match.", "password_again": "Password again", "save": "Save", - "saving": "Saving..." + "saving": "Saving...", + "name": "Name", + "value": "Value", + "action": "Action", + "is_required": "is required.", + "add": "Add", + "set": "Set", + "remove": "Remove", + "path": "Path", + "confirm_continue": "Are you sure to continue?", + "must_be_stopped_to_modify": "Must be stopped to modify.", + "port": "Port", + "default": "default", + "base_directory": "Base Directory", + "publish_directory": "Publish Directory" }, "register": { "register": "Register", @@ -67,6 +81,79 @@ "select_a_git_source": "Select a Git Source", "no_configurable_git": "No configurable Git Source found", "configuration_missing": "Configuration missing" - } - } + }, + "build": { + "queued_waiting_exec": "Queued and waiting for execution.", + "build_logs_of": "Build logs of", + "running": "Running", + "queued": "Queued", + "finished_in": "Finished in", + "load_more": "Load More", + "no_logs": "No logs found", + "waiting_logs": "Waiting for the logs..." + }, + "preview": { + "need_during_buildtime": "Need during buildtime?", + "setup_secret_app_first": "You can add secrets to PR/MR deployments. Please add secrets to the application first.
Useful for creating staging environments.", + "values_overwriting_app_secrets": "These values overwrite application secrets in PR/MR deployments. Useful for creating staging environments.", + "redeploy": "Redeploy", + "no_previews_available": "No previews available" + }, + "secrets": { + "secret_saved": "Secret saved.", + "use_isbuildsecret": "Use isBuildSecret", + "secrets_for": "Secrets for" + }, + "storage": { + "path_is_required": "Path is required.", + "storage_saved": "Storage saved.", + "storage_updated": "Storage updated.", + "storage_deleted": "Storage deleted.", + "persistent_storage_explainer": "You can specify any folder that you want to be persistent across deployments.
This is useful for storing data such as a database (SQLite) or a cache." + }, + "deployment_queued": "Deployment queued.", + "confirm_to_delete": "Are you sure you would like to delete '{0}'?", + "stop_application": "Stop application", + "permission_denied_stop_application": "You do not have permission to stop the application.", + "rebuild_application": "Rebuild application", + "permission_denied_rebuild_application": "You do not have permission to rebuild application.", + "build_and_start_application": "Build and start application", + "permission_denied_build_and_start_application": "You do not have permission to Build and start application.", + "configurations": "Configurations", + "secret": "Secrets", + "persistent_storage": "Persistent Storage", + "previews": "Previews", + "logs": "Application Logs", + "build_logs": "Build Logs", + "delete_application": "Delete application", + "permission_denied_delete_application": "You do not have permission to delete this application", + "domain_already_in_use": "Domain {domain} is already used.", + "dns_not_set_error": "DNS not set or propogated for {domain}.

Please check your DNS settings.", + "settings_saved": "Settings saved.", + "dns_not_set_partial_error": "DNS not set", + "git_source": "Git Source", + "git_repository": "Git Repository", + "build_pack": "Build Pack", + "destination": "Destination", + "application": "Application", + "domain_fqdn": "Domain (FQDN)", + "https_explainer": "If you specify https, the application will be accessible only over https. SSL certificate will be generated for you.
If you specify www, the application will be redirected (302) from non-www and vice versa.

To modify the domain, you must first stop the application.

You must set your DNS to point to the server IP in advance.", + "ssl_www_and_non_www": "Generate SSL for www and non-www?", + "ssl_explainer": "It will generate certificates for both www and non-www.
You need to have both DNS entries set in advance.

Useful if you expect to have visitors on both.", + "install_command": "Install Command", + "build_command": "Build Command", + "start_command": "Start Command", + "directory_to_use_explainer": "Directory to use as the base for all commands.
Could be useful with monorepos.", + "publish_directory_explainer": "Directory containing all the assets for deployment.
For example: dist,_site or public.", + "features": "Features", + "enable_automatic_deployment": "Enable Automatic Deployment", + "enable_auto_deploy_webhooks": "Enable automatic deployment through webhooks.", + "enable_mr_pr_previews": "Enable MR/PR Previews", + "enable_preview_deploy_mr_pr_requests": "Enable preview deployments from pull or merge requests.", + "debug_logs": "Debug Logs", + "enable_debug_log_during_build": "Enable debug logs during build phase.
Sensitive information could be visible and saved in logs.", + "cant_activate_auto_deploy_without_repo": "Cannot activate automatic deployments until only one application is defined for this repository / branch.", + "no_applications_found": "No applications found" + }, + "general": "General" } diff --git a/src/routes/applications/[id]/__layout.svelte b/src/routes/applications/[id]/__layout.svelte index 4a79bba44..342ad99b4 100644 --- a/src/routes/applications/[id]/__layout.svelte +++ b/src/routes/applications/[id]/__layout.svelte @@ -77,6 +77,7 @@ import { goto } from '$app/navigation'; import { gitTokens } from '$lib/store'; import { toast } from '@zerodevx/svelte-toast'; + import { t } from '$lib/translations'; if (githubToken) $gitTokens.githubToken = githubToken; if (gitlabToken) $gitTokens.gitlabToken = gitlabToken; @@ -87,7 +88,7 @@ async function handleDeploySubmit() { try { const { buildId } = await post(`/applications/${id}/deploy.json`, { ...application }); - toast.push('Deployment queued.'); + toast.push($t('application.deployment_queued')); console.log($page.url); if ($page.url.pathname.startsWith(`/applications/${id}/logs/build`)) { return window.location.assign(`/applications/${id}/logs/build?buildId=${buildId}`); @@ -102,7 +103,7 @@ } async function deleteApplication(name) { - const sure = confirm(`Are you sure you would like to delete '${name}'?`); + const sure = confirm($t('application.confirm_to_delete', { name })); if (sure) { loading = true; try { @@ -132,13 +133,13 @@ {#if isRunning} {loading + ? $t('forms.saving') + : forceSave + ? $t('forms.confirm_continue') + : $t('forms.save')} {/if}
- +
- +
- +
-
Application
+
{$t('application.application')}
- + {#if browser && window.location.hostname === 'demo.coolify.io'} {/if} - +
!isRunning && changeSettings('dualCerts')} />
{#if !staticDeployments.includes(application.buildPack)}
- +
{/if} @@ -331,63 +344,63 @@ {#if !notNodeDeployments.includes(application.buildPack)}
{$t('application.install_command')}
- +
- +
{/if}
{$t('forms.base_directory')} - +
{#if !notNodeDeployments.includes(application.buildPack)}
{$t('forms.publish_directory')} - +
{/if}
-
Features
+
{$t('application.features')}
@@ -410,8 +423,8 @@ isCenter={false} bind:setting={autodeploy} on:click={() => changeSettings('autodeploy')} - title="Enable Automatic Deployment" - description="Enable automatic deployment through webhooks." + title={$t('application.enable_automatic_deployment')} + description={$t('application.enable_auto_deploy_webhooks')} />
@@ -419,8 +432,8 @@ isCenter={false} bind:setting={previews} on:click={() => changeSettings('previews')} - title="Enable MR/PR Previews" - description="Enable preview deployments from pull or merge requests." + title={$t('application.enable_mr_pr_previews')} + description={$t('application.enable_preview_deploy_mr_pr_requests')} />
@@ -428,8 +441,8 @@ isCenter={false} bind:setting={debug} on:click={() => changeSettings('debug')} - title="Debug Logs" - description="Enable debug logs during build phase.
Sensitive information could be visible and saved in logs." + title={$t('application.debug_logs')} + description={$t('application.enable_debug_log_during_build')} />
diff --git a/src/routes/applications/[id]/logs/build/_BuildLog.svelte b/src/routes/applications/[id]/logs/build/_BuildLog.svelte index 4379d2d27..9a8dea4cc 100644 --- a/src/routes/applications/[id]/logs/build/_BuildLog.svelte +++ b/src/routes/applications/[id]/logs/build/_BuildLog.svelte @@ -10,6 +10,7 @@ import LoadingLogs from '../_Loading.svelte'; import { get } from '$lib/api'; import { errorNotification } from '$lib/form'; + import { t } from '$lib/translations'; let logs = []; let loading = true; @@ -84,7 +85,7 @@ {/if} {#if currentStatus === 'queued'} -
Queued and waiting for execution.
+
{$t('application.build.queued_waiting_exec')}
{:else}
@@ -119,19 +121,23 @@
{#if build.status === 'running'} -
Running
+
{$t('application.build.running')}
{:else if build.status === 'queued'} -
Queued
+
{$t('application.build.queued')}
{:else}
{build.since}
-
Finished in {build.took}s
+
+ {$t('application.build.finished_in')} {build.took}s +
{/if}
{/each}
- +
@@ -143,5 +149,5 @@
{#if buildCount === 0} -
No logs found
+
{$t('application.build.no_logs')}
{/if} diff --git a/src/routes/applications/[id]/logs/index.svelte b/src/routes/applications/[id]/logs/index.svelte index 036832f6c..c5eb52a2f 100644 --- a/src/routes/applications/[id]/logs/index.svelte +++ b/src/routes/applications/[id]/logs/index.svelte @@ -27,6 +27,7 @@ import { getDomain } from '$lib/components/common'; import { get } from '$lib/api'; import { errorNotification } from '$lib/form'; + import { t } from '$lib/translations'; let loadLogsInterval = null; let logs = []; @@ -75,7 +76,7 @@
{#if logs.length === 0} -
Waiting for the logs...
+
{$t('application.build.waiting_logs')}
{:else}
diff --git a/src/routes/applications/[id]/previews/index.svelte b/src/routes/applications/[id]/previews/index.svelte index e78e46efd..5d249412d 100644 --- a/src/routes/applications/[id]/previews/index.svelte +++ b/src/routes/applications/[id]/previews/index.svelte @@ -31,6 +31,7 @@ import Explainer from '$lib/components/Explainer.svelte'; import { errorNotification } from '$lib/form'; import { toast } from '@zerodevx/svelte-toast'; + import { t } from '$lib/translations'; const { id } = $page.params; async function refreshSecrets() { @@ -61,10 +62,12 @@ - - - - + + + + @@ -90,8 +93,8 @@ Useful for creating staging environments." - : "These values overwrite application secrets in PR/MR deployments. Useful for creating staging environments."} + ? $t('application.preview.setup_secret_app_first') + : $t('application.preview.values_overwriting_app_secrets')} />
@@ -105,13 +108,15 @@
{$t('application.preview.redeploy')}
{/each} {:else}
-
No previews available
+
+ {$t('application.preview.no_previews_available')} +
{/if}
diff --git a/src/routes/applications/[id]/secrets/_Secret.svelte b/src/routes/applications/[id]/secrets/_Secret.svelte index 12b03cb7b..34b997761 100644 --- a/src/routes/applications/[id]/secrets/_Secret.svelte +++ b/src/routes/applications/[id]/secrets/_Secret.svelte @@ -12,6 +12,7 @@ import { del, post } from '$lib/api'; import CopyPasswordField from '$lib/components/CopyPasswordField.svelte'; import { errorNotification } from '$lib/form'; + import { t } from '$lib/translations'; import { toast } from '@zerodevx/svelte-toast'; import { createEventDispatcher } from 'svelte'; @@ -31,8 +32,8 @@ } } async function saveSecret(isNew = false) { - if (!name) return errorNotification('Name is required.'); - if (!value) return errorNotification('Value is required.'); + if (!name) return errorNotification(`${$t('forms.name')} ${$t('forms.is_required')}`); + if (!value) return errorNotification(`${$t('forms.value')} ${$t('forms.is_required')}`); try { await post(`/applications/${id}/secrets.json`, { name, @@ -47,7 +48,7 @@ value = ''; isBuildSecret = false; } - toast.push('Secret saved.'); + toast.push($t('application.secrets.secret_saved')); } catch ({ error }) { return errorNotification(error); } @@ -93,7 +94,7 @@ class:cursor-not-allowed={!isNewSecret} class:cursor-pointer={isNewSecret} > - Use isBuildSecret + {$t('application.secrets.use_isbuildsecret')} {#if isNewSecret}
- +
{:else}
- +
{#if !isPRMRSecret}
- +
{/if}
diff --git a/src/routes/applications/[id]/secrets/index.svelte b/src/routes/applications/[id]/secrets/index.svelte index faeb22361..dd0ceab49 100644 --- a/src/routes/applications/[id]/secrets/index.svelte +++ b/src/routes/applications/[id]/secrets/index.svelte @@ -26,6 +26,7 @@ import { getDomain } from '$lib/components/common'; import { page } from '$app/stores'; import { get } from '$lib/api'; + import { t } from '$lib/translations'; const { id } = $page.params; @@ -37,17 +38,20 @@
- Secrets for {getDomain(application.fqdn)} + {$t('application.secrets.secrets_for')} + {getDomain(application.fqdn)}
NameValueNeed during buildtime?Action{$t('forms.name')}{$t('forms.value')}{$t('application.preview.need_during_buildtime')}{$t('forms.action')}
- - - - + + + + diff --git a/src/routes/applications/[id]/settings.json.ts b/src/routes/applications/[id]/settings.json.ts index aea78ff96..77c4bc886 100644 --- a/src/routes/applications/[id]/settings.json.ts +++ b/src/routes/applications/[id]/settings.json.ts @@ -1,6 +1,7 @@ import { getUserDetails } from '$lib/common'; import * as db from '$lib/database'; import { ErrorHandler } from '$lib/database'; +import { t } from '$lib/translations'; import type { RequestHandler } from '@sveltejs/kit'; export const post: RequestHandler = async (event) => { @@ -14,8 +15,7 @@ export const post: RequestHandler = async (event) => { const isDouble = await db.checkDoubleBranch(branch, projectId); if (isDouble && autodeploy) { throw { - message: - 'Cannot activate automatic deployments until only one application is defined for this repository / branch.' + message: t.get('application.cant_activate_auto_deploy_without_repo') }; } await db.setApplicationSettings({ id, debug, previews, dualCerts, autodeploy }); diff --git a/src/routes/applications/[id]/storage/_Storage.svelte b/src/routes/applications/[id]/storage/_Storage.svelte index 0b75ec717..363c93390 100644 --- a/src/routes/applications/[id]/storage/_Storage.svelte +++ b/src/routes/applications/[id]/storage/_Storage.svelte @@ -10,12 +10,13 @@ import { errorNotification } from '$lib/form'; import { toast } from '@zerodevx/svelte-toast'; + import { t } from '$lib/translations'; const { id } = $page.params; const dispatch = createEventDispatcher(); async function saveStorage(newStorage = false) { try { - if (!storage.path) return errorNotification('Path is required.'); + if (!storage.path) return errorNotification($t('application.storage.path_is_required')); storage.path = storage.path.startsWith('/') ? storage.path : `/${storage.path}`; storage.path = storage.path.endsWith('/') ? storage.path.slice(0, -1) : storage.path; storage.path.replace(/\/\//g, '/'); @@ -29,8 +30,8 @@ storage.path = null; storage.id = null; } - if (newStorage) toast.push('Storage saved.'); - else toast.push('Storage updated.'); + if (newStorage) toast.push($t('application.storage.storage_saved')); + else toast.push($t('application.storage.storage_updated')); } catch ({ error }) { return errorNotification(error); } @@ -39,7 +40,7 @@ try { await del(`/applications/${id}/storage.json`, { path: storage.path }); dispatch('refresh'); - toast.push('Storage deleted.'); + toast.push($t('application.storage.storage_deleted')); } catch ({ error }) { return errorNotification(error); } @@ -57,16 +58,19 @@
NameValueNeed during buildtime?Action{$t('forms.name')}{$t('forms.value')}{$t('application.preview.need_during_buildtime')}{$t('forms.action')}
{#if isNew}
- saveStorage(true)} + >{$t('forms.add')}
{:else}
- +
- +
{/if} diff --git a/src/routes/applications/[id]/storage/index.svelte b/src/routes/applications/[id]/storage/index.svelte index 75b129d68..473d35f2a 100644 --- a/src/routes/applications/[id]/storage/index.svelte +++ b/src/routes/applications/[id]/storage/index.svelte @@ -28,6 +28,7 @@ import Storage from './_Storage.svelte'; import { get } from '$lib/api'; import Explainer from '$lib/components/Explainer.svelte'; + import { t } from '$lib/translations'; const { id } = $page.params; async function refreshStorage() { @@ -46,15 +47,12 @@
- This is useful for storing data such as a database (SQLite) or a cache.'} - /> +
- + diff --git a/src/routes/applications/_Application.svelte b/src/routes/applications/_Application.svelte index 16d19a42f..d3b9b9d51 100644 --- a/src/routes/applications/_Application.svelte +++ b/src/routes/applications/_Application.svelte @@ -15,6 +15,7 @@ import Docker from '$lib/components/svg/applications/Docker.svelte'; import Astro from '$lib/components/svg/applications/Astro.svelte'; import Eleventy from '$lib/components/svg/applications/Eleventy.svelte'; + import { t } from '$lib/translations'; const buildPack = application?.buildPack?.toLowerCase(); @@ -59,7 +60,7 @@ {/if} {#if !application.gitSourceId || !application.destinationDockerId}
- Configuration missing + {$t('application.configuration.configuration_missing')}
{/if} diff --git a/src/routes/applications/index.svelte b/src/routes/applications/index.svelte index 5f6056ac5..d559fd7b9 100644 --- a/src/routes/applications/index.svelte +++ b/src/routes/applications/index.svelte @@ -4,6 +4,7 @@ import Application from './_Application.svelte'; import { post } from '$lib/api'; import { goto } from '$app/navigation'; + import { t } from '$lib/translations'; async function newApplication() { const { id } = await post('/applications/new', {}); return await goto(`/applications/${id}`, { replaceState: true }); @@ -11,7 +12,7 @@
-
Applications
+
{$t('index.applications')}
{#if $session.isAdmin}
{#if !applications || applications.length === 0}
-
No applications found
+
{$t('application.no_applications_found')}
{:else} {#each applications as application}
Path{$t('forms.path')}