Skip to content

feat: add polish and features to localization modal#959

Merged
stevenle merged 28 commits intomainfrom
feat/localization-modal
Mar 19, 2026
Merged

feat: add polish and features to localization modal#959
stevenle merged 28 commits intomainfrom
feat/localization-modal

Conversation

@jeremydw
Copy link
Member

@jeremydw jeremydw commented Mar 13, 2026

  • improve performance of loading the modal
  • add loader with fun messages for big pages
  • add ability to edit translations directly within modal
  • add ability to deep link to the modal (for sharing with other users)
  • synchronize the locale picker in the doc preview with the selected locale in the modal
  • make the header sticky while you scroll through big translation tables
  • add button to open string in strings editor (to see which tags it has)
  • add ai generate button with progress effects
  • add ability to filter modal by untranslated strings only
  • fix scrollbar placement
  • add icon showing when the doc is fully translated
image

}
setLoadingState('loading');

// SVG files are not supported by the AI vision API, so fetch the SVG
Copy link
Member

Choose a reason for hiding this comment

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

this doesn't seem related to this PR, mind moving it to its own PR?

Copy link
Member Author

Choose a reason for hiding this comment

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

reverted

const localizationModal = useLocalizationModal();

// Read URL params for locale sync and deep linking.
const urlParams = new URLSearchParams(window.location.search);
Copy link
Member

Choose a reason for hiding this comment

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

this doesn't feel like a react-y pattern to me, is it better to move this to a prop?

Copy link
Member Author

Choose a reason for hiding this comment

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

hm, turns out i can switch to useLocation from preact-iso here - is this enough or do you want a bigger change?

Copy link
Member

Choose a reason for hiding this comment

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

yeah i think useLocation() works. the issue with reading from window.location directly is that it doesn't trigger any callbacks and cause reactive state changes if any other part of the app changes the url, so it's better to use some sort of hook or react system that updates the component state whenever it changes.

Copy link
Member Author

Choose a reason for hiding this comment

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

sg - that's done now

@jeremydw jeremydw marked this pull request as ready for review March 17, 2026 18:46
onClick={() =>
onClick={() => {
const params = new URLSearchParams(window.location.search);
const locale = params.get('locale') || undefined;
Copy link
Member

Choose a reason for hiding this comment

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

can this use query.locale (or the urlLocale var defined above)?

@stevenle
Copy link
Member

taking a closer look at the screenshot you provided, i feel like the green circle checkmark is too prominent and it isn't clear to me at a glance what it's for.

i'm wondering if it makes sense to show the % translated as a string instead, maybe next to the "Translations" title, something like (<num>% translated) and the color changes depending on how complete it is. if you prefer the more simple checkmark, i'd suggest lowering the icon size (maybe 20px) and moving to to the right of the "Translations" title instead.

@stevenle
Copy link
Member

i noticed ai injected a lot of styles using the sx prop, can you move those to css?. some other ux feedback:

image image

@jeremydw
Copy link
Member Author

Should be fixed up now:

image image

@stevenle
Copy link
Member

some additional ux feedback. here's what worked well on my end for the icon:

                      <ActionIcon
                        className="LocalizationModal__aiBtn"
                        variant="default"
                        size="sm"
                        onClick={generateAiTranslations}
                      >
                        <IconSparkles size={14} fill="black" />
                      </ActionIcon>
image image

@jeremydw
Copy link
Member Author

done!

@stevenle
Copy link
Member

updates look good, thanks!

@stevenle stevenle merged commit bfa4e41 into main Mar 19, 2026
1 check passed
@stevenle stevenle deleted the feat/localization-modal branch March 19, 2026 16:51
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