feat: automatically detect language on server and translate UI (#530)

* feat: detect language on the server and translate page

* translate auth pages

* PR reviews
This commit is contained in:
Rotimi Best
2024-12-28 23:11:55 +01:00
committed by GitHub
parent 1f1ee8afd3
commit 381776f388
24 changed files with 431 additions and 232 deletions
@@ -1,21 +1,21 @@
import { get } from 'svelte/store';
import { supabase } from '$lib/utils/functions/supabase';
import { isUUID } from '$lib/utils/functions/isUUID';
import { QUESTION_TYPE } from '$lib/components/Question/constants';
import { STATUS } from '$lib/utils/constants/course';
import { isUUID } from '$lib/utils/functions/isUUID';
import { supabase } from '$lib/utils/functions/supabase';
import { isOrgAdmin } from '$lib/utils/store/org';
import type {
Lesson,
Course,
Exercise,
ExerciseTemplate,
Group,
Groupmember,
Exercise,
Lesson,
LessonCompletion,
ExerciseTemplate,
LessonSection
LessonSection,
ProfileCourseProgress
} from '$lib/utils/types';
import { STATUS } from '$lib/utils/constants/course';
import type { PostgrestSingleResponse, PostgrestError } from '@supabase/supabase-js';
import type { ProfileCourseProgress } from '$lib/utils/types';
import { isOrgAdmin } from '$lib/utils/store/org';
import type { PostgrestError, PostgrestSingleResponse } from '@supabase/supabase-js';
import { get } from 'svelte/store';
export async function fetchCourses(profileId, orgId) {
if (!orgId || !profileId) return;
@@ -144,10 +144,7 @@ export async function fetchCourse(courseId?: Course['id'], slug?: Course['slug']
const { data, error } = response;
console.log(`error`, error);
console.log(`data`, data);
if (!data || error) {
console.log(`data`, data);
console.log(`fetchCourse => error`, error);
// return this.redirect(307, '/courses');
return { data, error };
@@ -1,11 +1,11 @@
import { get } from 'svelte/store';
import type { PostgrestError } from '@supabase/supabase-js';
import { goto } from '$app/navigation';
import { supabase } from '$lib/utils/functions/supabase';
import { orgs, currentOrg, orgAudience, orgTeam } from '$lib/utils/store/org';
import { ROLE, ROLE_LABEL } from '$lib/utils/constants/roles';
import type { CurrentOrg, OrgTeamMember } from '$lib/utils/types/org';
import { supabase } from '$lib/utils/functions/supabase';
import { currentOrg, orgAudience, orgs, orgTeam } from '$lib/utils/store/org';
import type { OrganizationPlan } from '$lib/utils/types';
import type { CurrentOrg, OrgTeamMember } from '$lib/utils/types/org';
import type { PostgrestError } from '@supabase/supabase-js';
import { get } from 'svelte/store';
export async function getOrgTeam(orgId: string) {
const { data, error } = await supabase
@@ -164,8 +164,6 @@ export async function getOrgAudience(orgId: string) {
.eq('groupmember.group.organization_id', orgId)
.eq('groupmember.role_id', ROLE.STUDENT);
console.log('data', data);
const audience = (data || []).map((profile) => ({
id: profile.id,
name: profile.fullname,