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

How to Make ProviderGlobalSettings Component Support i18n? #91

Open
1 task done
iRedScarf opened this issue Aug 26, 2023 · 0 comments
Open
1 task done

How to Make ProviderGlobalSettings Component Support i18n? #91

iRedScarf opened this issue Aug 26, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@iRedScarf
Copy link
Contributor

Describe the feature

I've added translation text for the Provider (mainly OpenAI) in the files under the src/locale/lang directory. I've also used useI18n in src/providers/openai/index.ts to translate the name and description in globalSettings.

After deployment, the default English display works fine, but when I switch to the Chinese language setting, the ProviderGlobalSettings component's language doesn't get translated into Chinese.

I suspect this might be because the providerOpenAI function performs translation once during initialization and stores the translated strings in an object, rather than dynamically translating during rendering. These translated strings are stored in the provider object and returned as constants. When the page's language setting changes, these stored strings don't automatically update. Interestingly, even when I set the default language to Chinese, the language rendered in the ProviderGlobalSettings component is still English, which is puzzling. I've tried various methods, including storing only the translation keys in src/providers/openai/index.ts and then using useI18n for translation in src/components/settings/SettingsUIComponent.tsx (the result was that the entire SettingsSidebar didn't render at all).

I really like the app you've developed, and I want to contribute to making Anse even better. However, I'm still a noob and would appreciate your guidance. Could you please point me in the right direction for implementing translation in the ProviderGlobalSettings component so that it follows the system settings? Thank you!

Additional context

No response

Participation

  • I am willing to submit a pull request for this feature.
@iRedScarf iRedScarf added the enhancement New feature or request label Aug 26, 2023
@ddiu8081 ddiu8081 added bug Something isn't working and removed enhancement New feature or request labels Aug 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants