This is an automated email from the ASF dual-hosted git repository.

chaokunyang pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/fury-site.git


The following commit(s) were added to refs/heads/main by this push:
     new 7d97126b Fix: HomePageLanguageCard Route redirection bug (#198)
7d97126b is described below

commit 7d97126b36fb70556b0cb788ed11949a8d3121c3
Author: LofiSu <[email protected]>
AuthorDate: Thu Oct 31 09:12:33 2024 +0800

    Fix: HomePageLanguageCard Route redirection bug (#198)
    
    ```js
      const locale = navigator.language || "en-US";
    
      const getLanguageUrl = (language: string) => {
        const baseUrl = locale.startsWith("zh-CN")
          ? "https://fury.apache.org/zh-CN/docs/start/usage/#";
          : "https://fury.apache.org/docs/start/usage/#";;
        return `${baseUrl}${language}`;
      };
    ```
    The previous function is a bit problematic, setting Chinese to default,
    should be set according to the user's navigator.language
---
 src/pages/home/components/HomePageLanguageCard.tsx | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/src/pages/home/components/HomePageLanguageCard.tsx 
b/src/pages/home/components/HomePageLanguageCard.tsx
index 58fa049d..8749bfc1 100644
--- a/src/pages/home/components/HomePageLanguageCard.tsx
+++ b/src/pages/home/components/HomePageLanguageCard.tsx
@@ -3,13 +3,12 @@ import { Card } from "antd";
 import useBaseUrl from "@docusaurus/useBaseUrl";
 
 export default function HomePageLanguageCard() {
-  const locale = "zh-CN";
+  const locale = navigator.language || "en-US";
 
-  const getLanguageUrl = (language) => {
-    const baseUrl =
-      locale === "zh-CN"
-        ? "https://fury.apache.org/zh-CN/docs/start/usage/#";
-        : "https://fury.apache.org/docs/start/usage/#";;
+  const getLanguageUrl = (language: string) => {
+    const baseUrl = locale.startsWith("zh-CN")
+      ? "https://fury.apache.org/zh-CN/docs/start/usage/#";
+      : "https://fury.apache.org/docs/start/usage/#";;
     return `${baseUrl}${language}`;
   };
 


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to