From 3a5d13ea419ba82f5530d66f2250355dcebd5c92 Mon Sep 17 00:00:00 2001 From: Adeyemi Adetunji Date: Fri, 26 Apr 2024 17:54:11 +0100 Subject: [PATCH] docs: how to translate dashboard (#292) * add cloud translation api package * feat: Script that auto generates translations for other languages * add comments * fix: broken translation * improve translation * update locck file * clean up * all round trasnlations check * checkpoint * finish up * move to dev dependencies * fix vercel build error * translations fix * - add documentation - translation bug fix * quick adjust * PR Fixes * add new line * update docs --------- Co-authored-by: Rotimi Best --- apps/dashboard/scripts/translate.cjs | 2 +- .../AI/AIButton/CustomPromptBtn.svelte | 15 +- .../components/Ceritficate/Design.svelte | 2 +- .../LockedCertificate.svelte | 4 +- .../Lesson/Exercises/NewExerciseModal.svelte | 16 +- .../Lesson/Materials/Video/LocalVideo.svelte | 8 +- .../components/Lesson/Materials/index.svelte | 4 +- .../Course/components/Navigation/index.svelte | 18 +- .../Course/components/Settings/index.svelte | 4 +- .../components/Editor/HeaderForm.svelte | 2 +- .../components/Editor/InstructorForm.svelte | 14 +- .../components/Editor/ReviewsForm.svelte | 3 +- .../components/Editor/index.svelte | 16 +- .../components/CourseLandingPage/constants.ts | 12 +- .../Courses/components/Card/index.svelte | 6 +- .../Org/Settings/Integrations.svelte | 10 +- .../lib/components/Org/Settings/index.svelte | 10 +- .../components/OrgSelector/OrgSelector.svelte | 8 +- .../src/lib/components/Upgrade/Modal.svelte | 16 +- .../WelcomeModal/WelcomeModal.svelte | 6 +- .../src/lib/utils/translations/de.json | 2155 ++++++++--------- .../src/lib/utils/translations/en.json | 208 +- .../src/lib/utils/translations/es.json | 2155 ++++++++--------- .../src/lib/utils/translations/fr.json | 2155 ++++++++--------- .../src/lib/utils/translations/hi.json | 2131 ++++++++-------- .../src/lib/utils/translations/pt.json | 2155 ++++++++--------- .../src/lib/utils/translations/re.json | 1167 --------- .../src/lib/utils/translations/ru.json | 2122 ++++++++-------- .../src/lib/utils/translations/vi.json | 2155 ++++++++--------- .../courses/[id]/submissions/+page.svelte | 12 +- .../src/routes/lms/settings/+page.svelte | 4 +- .../routes/org/[slug]/audience/+page.svelte | 2 +- .../org/[slug]/settings/teams/+page.svelte | 7 +- .../src/routes/org/[slug]/setup/+page.ts | 36 +- .../adding-translation-to-code.mdx | 44 + 35 files changed, 7638 insertions(+), 9046 deletions(-) delete mode 100644 apps/dashboard/src/lib/utils/translations/re.json create mode 100644 apps/docs/pages/contributor-guides/adding-translation-to-code.mdx diff --git a/apps/dashboard/scripts/translate.cjs b/apps/dashboard/scripts/translate.cjs index e1da7a54..718cb37f 100644 --- a/apps/dashboard/scripts/translate.cjs +++ b/apps/dashboard/scripts/translate.cjs @@ -22,7 +22,7 @@ const languageFiles = { pt: path.resolve(__dirname, '../src/lib/utils/translations/pt.json'), de: path.resolve(__dirname, '../src/lib/utils/translations/de.json'), vi: path.resolve(__dirname, '../src/lib/utils/translations/vi.json'), - ru: path.resolve(__dirname, '../src/lib/utils/translations/re.json'), + ru: path.resolve(__dirname, '../src/lib/utils/translations/ru.json'), es: path.resolve(__dirname, '../src/lib/utils/translations/es.json') }; diff --git a/apps/dashboard/src/lib/components/AI/AIButton/CustomPromptBtn.svelte b/apps/dashboard/src/lib/components/AI/AIButton/CustomPromptBtn.svelte index 8793420c..5832d5e5 100644 --- a/apps/dashboard/src/lib/components/AI/AIButton/CustomPromptBtn.svelte +++ b/apps/dashboard/src/lib/components/AI/AIButton/CustomPromptBtn.svelte @@ -6,6 +6,7 @@ import IconButton from '$lib/components/IconButton/index.svelte'; import { Loading } from 'carbon-components-svelte'; import HtmlRender from '$lib/components/HTMLRender/HTMLRender.svelte'; + import { t } from '$lib/utils/functions/translations'; export let className = ''; export let handleInsert = (v: string) => {}; @@ -39,7 +40,7 @@ function callAI(prompt: string, rephrase: boolean) { isSubmitted = true; - $input = rephrase ? `Can you please rephrase this: ${plainText}` : prompt; + $input = rephrase ? `${$t('ai.can_you')}: ${plainText}` : prompt; setTimeout(() => { handleSubmit({ preventDefault: () => {} }); @@ -91,7 +92,7 @@ {#if $isLoading} {:else} - Insert + {$t('ai.insert')} {/if} {#if !$isLoading} {/if} {:else}
-

Help me write

+

{$t('ai.help_me')}