Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add form field list for translation #7778

Open
wants to merge 6 commits into
base: feat/multi-lang-feature
Choose a base branch
from

Conversation

siddarth2824
Copy link
Contributor

@siddarth2824 siddarth2824 commented Oct 15, 2024

Changes

  • Add view to display list of form fields that requires translation
  • Each form field row will show whether or not the translations for that form field is completed or still incomplete

Before & After Screenshots

Description Before After
Form fields that have not completed translations yet Screenshot 2024-10-15 at 4 07 06 PM
Some form fields that have completed translations Screenshot 2024-10-15 at 4 20 27 PM

@datadog-opengovsg
Copy link

Datadog Report

Branch report: feat/add-form-field-list-for-translation
Commit report: 0df2d1e
Test service: formsg

✅ 0 Failed, 3074 Passed, 1 Skipped, 7m 30.41s Total Time

siddarth2824 and others added 6 commits October 15, 2024 14:33
* feat: add fields in model to represent translations for form fields

* feat: add shared types to represent form field translations

* fix: use unicode locales
* feat: add settings tab and toggle for multi lang feature

* feat: add fields to joi validations

* fix: refactor code to address comments

* fix: failing tests

* feat: add tooltip over icons

* feat: add chromatic tests
@@ -165,7 +165,9 @@ export const AppRouter = (): JSX.Element => {
>
<Route index element={<CreatePage />} />
<Route path={ADMINFORM_SETTINGS_SUBROUTE} element={<SettingsPage />}>
<Route path={':settingsTab'} element={<SettingsPage />} />
<Route path={':settingsTab'} element={<SettingsPage />}>
<Route path={':language'} element={<SettingsPage />} />
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Possible to use frontend/src/features/admin-form/settings/SettingsPage.tsx::tabConfig to manage the deeplink for language? -- since language seemed to be a subpath of SettingsPage

Comment on lines +11 to +12
{!language ? <MultiLanguageSection /> : null}
{language ? <TranslationListSection language={language} /> : null}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
{!language ? <MultiLanguageSection /> : null}
{language ? <TranslationListSection language={language} /> : null}
{language ? <TranslationListSection language={language} /> : <MultiLanguageSection />}

const handleLanguageTranslationEditClick = useCallback(
(language: Language) => {
navigate(
`${ADMINFORM_ROUTE}/${formId}/settings/multi-language/${language.toString()}`,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Possible to move this to frontend/src/features/public-form/utils/urls.ts since this might be a little complex and we might want to have some type-safety on the language variable.

  2. Looking at the multi-language path again, I feel that we could use /language instead of /multi-language since we're manipulating the "language" settings.

@@ -109,7 +122,9 @@ const LanguageTranslationRow = ({
colorScheme="secondary"
aria-label={`Add ${unicodeLocale} translations`}
// TODO: Will add redirection to translation section in next PR
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suppose this comment can now be removed 😆

// check if translation row is not disabled
if (!isTranslationRowDisabled)
navigate(
`${ADMINFORM_ROUTE}/${formId}/settings/multi-language/${language}`,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To share the url function with comments above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants