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: language automatic detection #4114

Merged
merged 1 commit into from Oct 19, 2023
Merged

feat: language automatic detection #4114

merged 1 commit into from Oct 19, 2023

Conversation

zjy365
Copy link
Contributor

@zjy365 zjy365 commented Oct 19, 2023

πŸ€– Generated by Copilot at 965cf62

Summary

🌐πŸͺπŸ› οΈ

This pull request changes the default locale from 'en' to 'zh' for the frontend desktop application and several providers, such as applaunchpad, costcenter, cronjob, dbprovider, and license. It also updates the cookie names, the function parameters, and the data properties to use the NEXT_LOCALE value or 'zh' as the language preference. These changes are to support Chinese as the primary language for the sealos platform.

Sing, O Muse, of the mighty pull request
That changed the default locale to 'zh'
And made the frontend desktop application
Speak the language of the dragon and the phoenix.

Walkthrough

  • Change the default locale for the next-i18next configuration from 'en' to 'zh' in the frontend desktop application and the applaunchpad, costcenter, cronjob, dbprovider, and license providers (link, link, link, link, link, link)
  • Add a cookie header to the getServerSideProps functions in the index and signin pages of the frontend desktop application to set the NEXT_LOCALE value to the local variable derived from the request cookies or the default locale (link, link)
  • Change the local variable in the getServerSideProps function in the license page of the frontend desktop application from defaulting to 'en' to defaulting to 'zh' (link)
  • Change the data returned by the MasterSDK class in the client-sdk package to use the NEXT_LOCALE cookie value or 'zh' as the lng property instead of 'en' (link)
  • Change the type of the data parameter in the changeI18n function in the _app.tsx page of the applaunchpad provider from any to { currentLanguage: string } (link)
  • Change the lang variable in the useEffect hooks in the _app.tsx pages of the applaunchpad, cronjob, and dbprovider providers from defaulting to 'en' to defaulting to 'zh' (link, link, link)
  • Change the LANG_KEY constant in the cookieUtils modules of the applaunchpad and cronjob providers from 'NEXT_LOCALE_LANG' to 'NEXT_LOCALE' (link, link)
  • Change the first argument of the serverSideTranslations function in the serviceSideProps function in the i18n modules of the applaunchpad, cronjob, and dbprovider providers from defaulting to 'en' to defaulting to 'zh' (link, link, link)
  • Remove the 'zh-Hans' locale from the locales array in the next-i18next configuration in the costcenter and dbprovider providers as it is redundant with 'zh' (link, link)
  • Change the locale property in the useSessionStore hook in the session module of the costcenter provider from 'en' to 'zh' (link)

@sealos-ci-robot
Copy link
Member

sealos-ci-robot commented Oct 19, 2023

πŸ€– Generated by lychee action

Summary

Status Count
πŸ” Total 952
βœ… Successful 371
⏳ Timeouts 0
πŸ”€ Redirected 0
πŸ‘» Excluded 580
❓ Unknown 0
🚫 Errors 0

Full action output

Full Github Actions output

Signed-off-by: jingyang <3161362058@qq.com>
@sweep-ai
Copy link

sweep-ai bot commented Oct 19, 2023

Apply Sweep Rules to your PR?

  • Apply: Leftover TODOs in the code should be handled.
  • Apply: All new business logic should have corresponding unit tests in the tests/ directory.
  • Apply: Any clearly inefficient or repeated code should be optimized or refactored.

@codecov
Copy link

codecov bot commented Oct 19, 2023

Codecov Report

All modified lines are covered by tests βœ…

πŸ“’ Thoughts on this report? Let us know!.

@c121914yu c121914yu merged commit b6ef217 into labring:main Oct 19, 2023
23 of 24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants