feat: add Polish language support

This commit is contained in:
Rotimi Best
2025-08-08 04:53:38 +01:00
parent 0d0719e8f9
commit 279d10a914
7 changed files with 1561 additions and 35 deletions
+6 -5
View File
@@ -17,13 +17,14 @@ const SCRIPT_WAIT_TIME = 2000;
// Define file paths for each language
const languageFiles = {
hi: path.resolve(__dirname, '../src/lib/utils/translations/hi.json'),
fr: path.resolve(__dirname, '../src/lib/utils/translations/fr.json'),
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'),
es: path.resolve(__dirname, '../src/lib/utils/translations/es.json'),
fr: path.resolve(__dirname, '../src/lib/utils/translations/fr.json'),
hi: path.resolve(__dirname, '../src/lib/utils/translations/hi.json'),
pl: path.resolve(__dirname, '../src/lib/utils/translations/pl.json'),
pt: path.resolve(__dirname, '../src/lib/utils/translations/pt.json'),
ru: path.resolve(__dirname, '../src/lib/utils/translations/ru.json'),
es: path.resolve(__dirname, '../src/lib/utils/translations/es.json')
vi: path.resolve(__dirname, '../src/lib/utils/translations/vi.json')
};
const wait = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
@@ -1,14 +1,15 @@
import { LOCALE } from '../types';
export const LANGUAGE = {
[LOCALE.EN]: 'English',
[LOCALE.HI]: 'Hindi',
[LOCALE.FR]: 'French',
[LOCALE.PT]: 'Portuguese',
[LOCALE.DE]: 'German',
[LOCALE.VI]: 'Vietnamese',
[LOCALE.EN]: 'English',
[LOCALE.ES]: 'Spanish',
[LOCALE.FR]: 'French',
[LOCALE.HI]: 'Hindi',
[LOCALE.PL]: 'Polish',
[LOCALE.PT]: 'Portuguese',
[LOCALE.RU]: 'Russian',
[LOCALE.ES]: 'Spanish'
[LOCALE.VI]: 'Vietnamese'
};
export const LANGUAGES = Object.keys(LANGUAGE).map((lang) => ({
@@ -21,6 +21,11 @@ export const config = {
key: '',
loader: async () => (await import('../translations/fr.json')).default
},
{
locale: 'pl',
key: '',
loader: async () => (await import('../translations/pl.json')).default
},
{
locale: 'pt',
key: '',
File diff suppressed because it is too large Load Diff
@@ -5,6 +5,7 @@ export enum LOCALE {
EN = 'en',
HI = 'hi',
FR = 'fr',
PL = 'pl',
PT = 'pt',
DE = 'de',
VI = 'vi',
@@ -49,14 +49,15 @@
let selectedId = 'en';
let dropdownItems = [
{ id: 'en', text: 'English' },
{ id: 'hi', text: 'Hindi' },
{ id: 'fr', text: 'French' },
{ id: 'pt', text: 'Portuguese' },
{ id: 'de', text: 'German' },
{ id: 'vi', text: 'Vietnamese' },
{ id: 'en', text: 'English' },
{ id: 'es', text: 'Spanish' },
{ id: 'fr', text: 'French' },
{ id: 'hi', text: 'Hindi' },
{ id: 'pl', text: 'Polish' },
{ id: 'pt', text: 'Portuguese' },
{ id: 'ru', text: 'Russian' },
{ id: 'es', text: 'Spanish' }
{ id: 'vi', text: 'Vietnamese' }
];
const educatorGoals: Goal[] = [
@@ -237,28 +238,28 @@
</script>
{#if $profile.id}
<div class="w-full min-h-screen flex justify-center">
<div class="flex justify-center items-center flex-col w-9/12 max-w-md">
<div class="flex min-h-screen w-full justify-center">
<div class="flex w-9/12 max-w-md flex-col items-center justify-center">
<!-- Header With Logo -->
<div class="flex flex-col items-center">
<div class="flex items-center w-full justify-center mb-4">
<div class="mb-4 flex w-full items-center justify-center">
<img src="/logo-192.png" alt="ClassroomIO logo" height="50" width="50" data-atf="1" />
<h4 class="dark:text-white text-xl">ClassroomIO</h4>
<h4 class="text-xl dark:text-white">ClassroomIO</h4>
</div>
<!-- Loggedin Email -->
<div
class="w-64 flex items-center justify-center mb-6 py-6 bg-gray-100 dark:bg-neutral-800 rounded-2xl border border-gray-300"
class="mb-6 flex w-64 items-center justify-center rounded-2xl border border-gray-300 bg-gray-100 py-6 dark:bg-neutral-800"
>
<UserProfileIcon />
<p class="dark:text-white text-sm ml-2">{$profile.email}</p>
<p class="ml-2 text-sm dark:text-white">{$profile.email}</p>
</div>
</div>
<div class="form-container overflow-y-auto w-full px-2">
<div class="form-container w-full overflow-y-auto px-2">
{#if step === 1}
<!-- Name/Organization Question -->
<div id="role-question" class="flex items-start flex-col mb-6">
<div id="role-question" class="mb-6 flex flex-col items-start">
<!-- Full name -->
<TextField
label={$t('onboarding.fullname')}
@@ -304,17 +305,17 @@
</div>
{:else}
<!-- Goal/Source Question -->
<div id="goal-question" class="flex items-center flex-col mb-6">
<div id="goal-question" class="mb-6 flex flex-col items-center">
<div class="w-10/12">
<!-- Goal Question -->
<div class="w-full flex items-start flex-col justify-between mb-10">
<label for="text-field" class="dark:text-white m-0 text-lg font-normal mb-3">
<div class="mb-10 flex w-full flex-col items-start justify-between">
<label for="text-field" class="m-0 mb-3 text-lg font-normal dark:text-white">
{$t('onboarding.what_brings')}
</label>
<!-- Loop through Goals -->
{#each educatorGoals as goal}
<label class="dark:text-white w-full inline-flex items-center mb-1 font-light">
<label class="mb-1 inline-flex w-full items-center font-light dark:text-white">
<input
type="radio"
bind:group={fields.goal}
@@ -334,14 +335,14 @@
</div>
<!-- Source Question -->
<div class="w-full flex items-start flex-col justify-between">
<label for="text-field" class="dark:text-white m-0 text-lg font-normal mb-3">
<div class="flex w-full flex-col items-start justify-between">
<label for="text-field" class="m-0 mb-3 text-lg font-normal dark:text-white">
{$t('onboarding.how')}
</label>
<!-- Loop through Goals -->
{#each sources as source}
<label class="dark:text-white w-full inline-flex items-center mb-1 font-light">
<label class="mb-1 inline-flex w-full items-center font-light dark:text-white">
<input
type="radio"
bind:group={fields.source}
@@ -376,10 +377,10 @@
</div>
<!-- Footer -->
<div class="flex justify-between items-center mt-8 w-full">
<div class="w-24 h-2 bg-gray-300 relative">
<div class="mt-8 flex w-full items-center justify-between">
<div class="relative h-2 w-24 bg-gray-300">
<span
class="progress absolute top-0 left-0 bg-primary-700 h-full"
class="progress bg-primary-700 absolute left-0 top-0 h-full"
style="width: {progress}%;"
/>
</div>
@@ -0,0 +1,27 @@
drop view if exists "public"."lesson_versions";
alter table "public"."lesson_language" alter column "locale" drop default;
alter table "public"."profile" alter column "locale" drop default;
alter type "public"."LOCALE" rename to "LOCALE__old_version_to_be_dropped";
create type "public"."LOCALE" as enum ('en', 'hi', 'fr', 'pt', 'de', 'vi', 'ru', 'es', 'pl');
alter table "public"."lesson_language" alter column locale type "public"."LOCALE" using locale::text::"public"."LOCALE";
alter table "public"."profile" alter column locale type "public"."LOCALE" using locale::text::"public"."LOCALE";
alter table "public"."lesson_language" alter column "locale" set default 'en'::"LOCALE";
alter table "public"."profile" alter column "locale" set default 'en'::"LOCALE";
drop type "public"."LOCALE__old_version_to_be_dropped";
create or replace view "public"."lesson_versions" as SELECT llh.old_content,
llh.new_content,
llh."timestamp",
ll.locale,
ll.lesson_id
FROM (lesson_language_history llh
JOIN lesson_language ll ON ((ll.id = llh.lesson_language_id)));