-
Notifications
You must be signed in to change notification settings - Fork 134
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
UI: Add a whitelist in i18next to fix the issue #675 #677
UI: Add a whitelist in i18next to fix the issue #675 #677
Conversation
@baurine PTAL :) |
So by this way, 'zh-HK' / 'zh-TW' / 'zh-SG' (https://www.andiamo.co.uk/resources/iso-language-codes/) will be fallback to 'en' as well (need extra tests to confirm), not sure whether i18next has a customized fallback strategy. |
Seems no customized fallback provided in i18next but has custom Detector. I tried it but do not figure it out :( |
According to the document: https://www.i18next.com/principles/fallback
I prefer to use the way 1. We can change all places used by 'zh-CN' to 'zh'. (for example, zh-CN.yaml to zh.yaml), this can prevent 'zh' / 'zh-HK' / 'zh-TW' / 'zh-SG' / 'zh-XXX' except 'zh-CN' fallback to 'en' with no more configuration. (need test to confirm) @breeswish , how do you think about it? |
Or I can try the custom detector later. |
Yes, I also think solution 1 looks best |
Thanks for your contribution! LGTM, I will have a test soon. |
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.
Works fine as expected.
@baurine,Thanks for your review. |
/merge |
Sorry @baurine, you don't have permission to trigger auto merge event on this branch. The number of |
@@ -0,0 +1,5 @@ | |||
dashboard_settings: |
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.
We no longer have this file, you can remove it
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.
I see, you moved dashboard setting to the user profile page in previous commit. I will remove it.
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.
Push a new commit 436817d to remove the dashboard setting page.
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.
The rest LGTM, thanks!
/merge |
/run-all-tests |
@all-contributors please add @ericsyh for code |
@breeswish I've put up a pull request to add @ericsyh! 🎉 |
* ui: Fix TiFlash log searching (#680) * ui: Add a whitelist in i18next to fix the issue #675 (#677) * docs: add ericsyh as a contributor (#681) * ui: refine code and error handle (#662) * *: Rename disable_telemetry to enable_telemetry (#684) * ui: Update space behaviour in statement / slow log search (#682) * ui: No need to generate ui library (#687) * forwarder: evict invalid current picked remote (#689) * keyviz: support to merge cold logical range (#674) * Update release version
Why for change
To fix #675.
The root cause of issue is we declare two languages as
zh-CN
anden
in i18next while some situations browser will returnzh
(Under my case the browser isChrome 83
the OS isWindows 10
) which is out of our language definition.What did i do
I added a whitelist only for
zh-CN
anden
in i18next to block other cases. With the whitelist i18next will fallback toen
by default if browser return language out of our definition likezh
oren-US
.Test
Passed on my environment. Now i18next got
en
asi18nextLng