-
-
Notifications
You must be signed in to change notification settings - Fork 66
fix: missing ease type locale #449
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
fix: missing ease type locale #449
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Summary of Changes
Hello @HardyNLee, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!
This pull request resolves a critical localization bug where 'ease type' options were not displaying translated strings. The solution involves a strategic refactoring of the easeType
data structure from a static constant to a dynamic function, ensuring that translation lookups occur at runtime and correctly reflect the current locale. This change impacts several UI components that consume these ease type definitions, as well as the associated translation files.
Highlights
- Localization Fix: This pull request addresses and fixes issue #443, where 'ease type' translations were not being correctly applied or displayed in the user interface. The change ensures that the correct localized strings are always used for ease type options.
- Refactoring of Ease Type Data Structure: The static
easeType
constantMap
insrc/pages/editor/GraphicalEditor/utils/constants.ts
has been refactored into agetEaseType()
function. This function now returns a newMap<string, string>
on each invocation, which allows the translation utility (t
) to dynamically re-evaluate and provide the most current localized strings based on the active locale. - Component Adaptations: Three UI components (
ChangeBg.tsx
,ChangeFigure.tsx
, andSetTransform.tsx
) that previously relied on the staticeaseType
constant have been updated. They now import and call the newgetEaseType()
function to retrieve the localized ease type options, ensuring consistency with the dynamic translation approach. - Locale File Updates: The
.po
translation files for English (en.po
), Japanese (ja.po
), and Simplified Chinese (zhCn.po
) have been updated. These changes primarily involve adjusting the source code line number references for theeaseType
related strings withinsrc/pages/editor/GraphicalEditor/utils/constants.ts
, reflecting the structural change from a constant to a function.
Using Gemini Code Assist
The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.
Invoking Gemini
You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command>
or @gemini-code-assist <command>
. Below is a summary of the supported commands.
Feature | Command | Description |
---|---|---|
Code Review | /gemini review |
Performs a code review for the current pull request in its current state. |
Pull Request Summary | /gemini summary |
Provides a summary of the current pull request in its current state. |
Comment | @gemini-code-assist | Responds in comments when explicitly tagged, both in issue comments and review comments. |
Help | /gemini help |
Displays a list of available commands. |
Customization
To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/
folder in the base of the repository. Detailed instructions can be found here.
Limitations & Feedback
Gemini Code Assist is currently in preview and may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments to provide feedback.
You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.
Footnotes
-
Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request fixes an issue with translations for easeType
not being applied correctly by converting the constant into a function. To improve performance, consider using the useMemo
hook to memoize the result of getEaseType()
within the components that use it.
packages/origine2/src/pages/editor/GraphicalEditor/SentenceEditor/ChangeBg.tsx
Outdated
Show resolved
Hide resolved
packages/origine2/src/pages/editor/GraphicalEditor/SentenceEditor/ChangeFigure.tsx
Outdated
Show resolved
Hide resolved
packages/origine2/src/pages/editor/GraphicalEditor/SentenceEditor/SetTransform.tsx
Outdated
Show resolved
Hide resolved
- 创建 useEaseTypeOptions hook 用于获取翻译后的缓动类型选项 - 更新 ChangeBg、ChangeFigure、SetTransform 组件使用新 hook - 删除不再需要的 constants.ts 文件 - 修复 easeType 翻译无法生效的问题
介绍
fix #443
修复
easeType
的翻译无法生效的问题主要更改
easeType
改为函数getEaseType()
, 每次调用返回新Map<string, string>
useMemo
记忆每次获取的 easeType (gemini-code-assist 建议)