diff --git a/.gitignore b/.gitignore index 0aaa6e8d16..07c187c044 100644 --- a/.gitignore +++ b/.gitignore @@ -57,6 +57,7 @@ launch.json #rspack .swc assets/.rsdoctor +*.ignore *storybook.log storybook-static diff --git a/assets/react/v3/@types/index.d.ts b/assets/react/v3/@types/index.d.ts index 4043001988..9a6db0451c 100644 --- a/assets/react/v3/@types/index.d.ts +++ b/assets/react/v3/@types/index.d.ts @@ -81,7 +81,7 @@ declare global { wp_rest_nonce: string; is_admin: string; is_admin_bar_showing: string; - max_upload_size: string; + max_upload_size: string; // in bytes content_change_event: string; is_tutor_course_edit: string; assignment_max_file_allowed: string; diff --git a/assets/react/v3/declaration.d.ts b/assets/react/v3/declaration.d.ts index b9629ab299..1ec60b150b 100644 --- a/assets/react/v3/declaration.d.ts +++ b/assets/react/v3/declaration.d.ts @@ -7,3 +7,5 @@ declare module '*.webp'; interface Window { tutor_get_nonce_data: (value: boolean) => { key: string; value: string }; } + +declare const __TUTOR_TEXT_DOMAIN__: string; diff --git a/assets/react/v3/entries/course-builder/components/course-basic/CourseBasicSidebar.tsx b/assets/react/v3/entries/course-builder/components/course-basic/CourseBasicSidebar.tsx index 8862130cdc..0ef62b76de 100644 --- a/assets/react/v3/entries/course-builder/components/course-basic/CourseBasicSidebar.tsx +++ b/assets/react/v3/entries/course-builder/components/course-basic/CourseBasicSidebar.tsx @@ -25,7 +25,7 @@ import { typography } from '@TutorShared/config/typography'; import Show from '@TutorShared/controls/Show'; import { useInstructorListQuery, useUserListQuery } from '@TutorShared/services/users'; import { styleUtils } from '@TutorShared/utils/style-utils'; -import { isAddonEnabled } from '@TutorShared/utils/util'; +import { formatBytes, isAddonEnabled } from '@TutorShared/utils/util'; import CoursePricing from './CoursePricing'; @@ -181,7 +181,10 @@ const CourseBasicSidebar = () => { buttonText={__('Upload Thumbnail', 'tutor')} infoText={ // translators: %s is the maximum allowed upload file size (e.g., "2MB") - sprintf(__('JPEG, PNG, GIF, and WebP formats, up to %s', 'tutor'), tutorConfig.max_upload_size) + sprintf( + __('JPEG, PNG, GIF, and WebP formats, up to %s', 'tutor'), + formatBytes(Number(tutorConfig?.max_upload_size || 0)), + ) } generateWithAi={!isTutorPro || isOpenAiEnabled} loading={!!isCourseDetailsFetching && !controllerProps.field.value} @@ -200,7 +203,10 @@ const CourseBasicSidebar = () => { buttonText={__('Upload Video', 'tutor')} infoText={ // translators: %s is the maximum allowed file size - sprintf(__('MP4, and WebM formats, up to %s', 'tutor'), tutorConfig.max_upload_size) + sprintf( + __('MP4, and WebM formats, up to %s', 'tutor'), + formatBytes(Number(tutorConfig?.max_upload_size || 0)), + ) } loading={!!isCourseDetailsFetching && !controllerProps.field.value} visibilityKey={VisibilityControlKeys.COURSE_BUILDER.BASICS.INTRO_VIDEO} diff --git a/assets/react/v3/entries/course-builder/components/course-basic/ScheduleOptions.tsx b/assets/react/v3/entries/course-builder/components/course-basic/ScheduleOptions.tsx index 4eaf1bb63e..4a2c8d43d2 100644 --- a/assets/react/v3/entries/course-builder/components/course-basic/ScheduleOptions.tsx +++ b/assets/react/v3/entries/course-builder/components/course-basic/ScheduleOptions.tsx @@ -25,7 +25,7 @@ import { typography } from '@TutorShared/config/typography'; import Show from '@TutorShared/controls/Show'; import { withVisibilityControl } from '@TutorShared/hoc/withVisibilityControl'; import { styleUtils } from '@TutorShared/utils/style-utils'; -import { noop } from '@TutorShared/utils/util'; +import { formatBytes, noop } from '@TutorShared/utils/util'; import { invalidDateRule, invalidTimeRule } from '@TutorShared/utils/validation'; const isTutorPro = !!tutorConfig.tutor_pro_url; @@ -230,7 +230,10 @@ const ScheduleOptions = () => { buttonText={__('Upload Thumbnail', 'tutor')} infoText={ /* translators: %s is the maximum allowed upload file size (e.g., "2MB") */ - sprintf(__('JPEG, PNG, GIF, and WebP formats, up to %s', 'tutor'), tutorConfig.max_upload_size) + sprintf( + __('JPEG, PNG, GIF, and WebP formats, up to %s', 'tutor'), + formatBytes(Number(tutorConfig?.max_upload_size || 0)), + ) } /> )} diff --git a/assets/react/v3/entries/course-builder/components/modals/LessonModal.tsx b/assets/react/v3/entries/course-builder/components/modals/LessonModal.tsx index e8b7a1574a..2d6d34c8f8 100644 --- a/assets/react/v3/entries/course-builder/components/modals/LessonModal.tsx +++ b/assets/react/v3/entries/course-builder/components/modals/LessonModal.tsx @@ -44,7 +44,7 @@ import useVisibilityControl from '@TutorShared/hooks/useVisibilityControl'; import { type WPMedia } from '@TutorShared/hooks/useWpMedia'; import { styleUtils } from '@TutorShared/utils/style-utils'; import { type H5PContent, type ID } from '@TutorShared/utils/types'; -import { findSlotFields, isAddonEnabled, normalizeLineEndings } from '@TutorShared/utils/util'; +import { findSlotFields, formatBytes, isAddonEnabled, normalizeLineEndings } from '@TutorShared/utils/util'; import { maxLimitRule } from '@TutorShared/utils/validation'; interface LessonModalProps extends ModalProps { @@ -383,7 +383,10 @@ const LessonModal = ({ buttonText={__('Upload Image', 'tutor')} infoText={ /* translators: %s is the maximum allowed upload file size (e.g., "2MB") */ - sprintf(__('JPEG, PNG, GIF, and WebP formats, up to %s', 'tutor'), tutorConfig.max_upload_size) + sprintf( + __('JPEG, PNG, GIF, and WebP formats, up to %s', 'tutor'), + formatBytes(Number(tutorConfig?.max_upload_size || 0)), + ) } visibilityKey={VisibilityControlKeys.COURSE_BUILDER.CURRICULUM.LESSON.FEATURED_IMAGE} /> @@ -399,7 +402,10 @@ const LessonModal = ({ buttonText={__('Upload Video', 'tutor')} infoText={ // translators: %s is the maximum allowed file size - sprintf(__('MP4, and WebM formats, up to %s', 'tutor'), tutorConfig.max_upload_size) + sprintf( + __('MP4, and WebM formats, up to %s', 'tutor'), + formatBytes(Number(tutorConfig?.max_upload_size || 0)), + ) } onGetDuration={(duration) => { form.setValue('duration.hour', duration.hours); diff --git a/assets/react/v3/entries/import-export/components/Import.tsx b/assets/react/v3/entries/import-export/components/Import.tsx index 79b6560a75..55c8b76f1d 100644 --- a/assets/react/v3/entries/import-export/components/Import.tsx +++ b/assets/react/v3/entries/import-export/components/Import.tsx @@ -145,7 +145,11 @@ const Import = () => {
{__('Try the following steps to resolve the issue:', 'tutor')}
+{__('Try the following steps to resolve the issue:', __TUTOR_TEXT_DOMAIN__)}
{__('No courses found', 'tutor')}
+{__('No courses found', __TUTOR_TEXT_DOMAIN__)}
{__('No user found', 'tutor')}
+{__('No user found', __TUTOR_TEXT_DOMAIN__)}
{__('No topics content found', 'tutor')}
+{__('No topics content found', __TUTOR_TEXT_DOMAIN__)}
{ // prettier-ignore - __('Please make sure to use the variable {dash} in your question title to show the blanks in your question. You can use multiple {dash} variables in one question.', 'tutor') + __('Please make sure to use the variable {dash} in your question title to show the blanks in your question. You can use multiple {dash} variables in one question.', __TUTOR_TEXT_DOMAIN__) }
{__('Match the number of answers to the number of blanks {dash} in your question.', 'tutor')}
++ {__( + 'Match the number of answers to the number of blanks {dash} in your question.', + __TUTOR_TEXT_DOMAIN__, + )} +
{ // prettier-ignore - __( 'Separate multiple answers by a vertical bar |. 1 answer per {dash} variable is defined in the question. Example: Apple | Banana | Orange', 'tutor') + __( 'Separate multiple answers by a vertical bar |. 1 answer per {dash} variable is defined in the question. Example: Apple | Banana | Orange', __TUTOR_TEXT_DOMAIN__) }
- {__('Students need to type their answers exactly as you write them here. Use ', 'tutor')} - {__('small caps', 'tutor')} - {__(' when writing the answer.', 'tutor')} + {__( + 'Students need to type their answers exactly as you write them here. Use ', + __TUTOR_TEXT_DOMAIN__, + )} + {__('small caps', __TUTOR_TEXT_DOMAIN__)} + {__(' when writing the answer.', __TUTOR_TEXT_DOMAIN__)}