Skip to content

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

Merged
merged 3 commits into from
Jul 17, 2025

Conversation

HardyNLee
Copy link

@HardyNLee HardyNLee commented Jul 16, 2025

介绍

fix #443
修复 easeType 的翻译无法生效的问题

主要更改

  • 将常量 easeType 改为函数 getEaseType() , 每次调用返回新 Map<string, string>
  • 使用 useMemo 记忆每次获取的 easeType (gemini-code-assist 建议)

Copy link

@gemini-code-assist gemini-code-assist bot left a 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 constant Map in src/pages/editor/GraphicalEditor/utils/constants.ts has been refactored into a getEaseType() function. This function now returns a new Map<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, and SetTransform.tsx) that previously relied on the static easeType constant have been updated. They now import and call the new getEaseType() 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 the easeType related strings within src/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

  1. 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.

Copy link

@gemini-code-assist gemini-code-assist bot left a 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.

Hardy--Lee and others added 2 commits July 17, 2025 00:11
- 创建 useEaseTypeOptions hook 用于获取翻译后的缓动类型选项
- 更新 ChangeBg、ChangeFigure、SetTransform 组件使用新 hook
- 删除不再需要的 constants.ts 文件
- 修复 easeType 翻译无法生效的问题
@MakinoharaShoko MakinoharaShoko merged commit 0956f5c into OpenWebGAL:dev Jul 17, 2025
6 checks passed
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