You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by ur...@apache.org on 2022/10/09 05:52:08 UTC

[pulsar-site] branch clean-i18n created (now 5d127640451)

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

urfree pushed a change to branch clean-i18n
in repository https://gitbox.apache.org/repos/asf/pulsar-site.git


      at 5d127640451 clean i18n build scripts

This branch includes the following new commits:

     new 5d127640451 clean i18n build scripts

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[pulsar-site] 01/01: clean i18n build scripts

Posted by ur...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

urfree pushed a commit to branch clean-i18n
in repository https://gitbox.apache.org/repos/asf/pulsar-site.git

commit 5d127640451a71322ee5b570a614522102bfae7b
Author: Li Li <ur...@apache.org>
AuthorDate: Sun Oct 9 13:51:57 2022 +0800

    clean i18n build scripts
    
    Signed-off-by: Li Li <ur...@apache.org>
---
 site2/tools/publish-website.sh                    |  2 +-
 site2/website-next/docusaurus.config.js           | 18 --------
 site2/website-next/scripts/split-version-build.sh | 56 ++---------------------
 3 files changed, 4 insertions(+), 72 deletions(-)

diff --git a/site2/tools/publish-website.sh b/site2/tools/publish-website.sh
index ec74006c20b..3cf7b4aefc6 100755
--- a/site2/tools/publish-website.sh
+++ b/site2/tools/publish-website.sh
@@ -53,7 +53,7 @@ PULSAR_SITE_TMP=/tmp/pulsar-site
   fi
 
   echo "BUILD_ALL:"$BUILD_ALL
-  if [[ $BUILD_ALL"" == "11" ]]; then
+  if [[ $BUILD_ALL"" == "1" ]]; then
     echo "clean all the old content"
     find $PULSAR_SITE_TMP/content -print \
       | grep -v $PULSAR_SITE_TMP/content$ \
diff --git a/site2/website-next/docusaurus.config.js b/site2/website-next/docusaurus.config.js
index ab70d6ffe20..ccac386be70 100644
--- a/site2/website-next/docusaurus.config.js
+++ b/site2/website-next/docusaurus.config.js
@@ -21,17 +21,11 @@ const versionsMap = {
 };
 
 let buildVersions = ["current"];
-let buildLanguages = ["en"];
 try {
   buildVersions = require("./.build-versions.json");
 } catch (error) {
   //do nothing
 }
-try {
-  buildLanguages = require("./.build-languages.json");
-} catch (error) {
-  //do nothing
-}
 
 const oldUrl = "https://pulsar.apache.org";
 const url = "https://pulsar.apache.org";
@@ -142,18 +136,6 @@ module.exports = {
     githubUrl,
     oldUrl,
   },
-  i18n: {
-    defaultLocale: "en",
-    locales: buildLanguages,
-    localeConfigs: {
-      "zh-CN": {
-        label: "简体中文",
-      },
-      "zh-TW": {
-        label: "繁体中文",
-      },
-    },
-  },
   themeConfig: {
     announcementBar: {
       id: "summit",
diff --git a/site2/website-next/scripts/split-version-build.sh b/site2/website-next/scripts/split-version-build.sh
index b3736a881ae..9d28788066a 100755
--- a/site2/website-next/scripts/split-version-build.sh
+++ b/site2/website-next/scripts/split-version-build.sh
@@ -4,32 +4,22 @@ set -x -e
 
 node scripts/split-version.js
 
-locals=("en" "zh-CN" "zh-TW" "ja" "ko" "fr")
 latest=$(cat scripts/.latest)
-BUILD_ALL_LANGUAGE="0"
 buildVersion="next"
 
 echo "changed files: "
 echo $@
 
 function _build() {
-    if [[ "$BUILD_ALL_LANGUAGE" == "0" ]]; then
-        echo "only build en"
-        yarn build --locale en
-    else
-        echo "build all"
-        yarn build
-    fi
+    yarn build --locale en
 }
 
 function _buildVersion() {
     if [[ $buildVersion = "next" ]]; then
         echo "..." ${buildVersion} "and" $latest" begin build..."
-        echo "[\"en\", \"zh-CN\", \"zh-TW\", \"ja\", \"fr\", \"ko\"]" >./.build-languages.json
         echo "[\"current\", \"${latest}\"]" >.build-versions.json
     else
         echo "..." $buildVersion "begin build..."
-        echo "[\"en\", \"zh-CN\"]" >./.build-languages.json
         echo "[\"${buildVersion}\"]" >.build-versions.json
     fi
 
@@ -41,24 +31,13 @@ function _buildVersion() {
         cp -r build/docs/${buildVersion}/* build-${buildVersion}/${buildVersion}
         cp -r build/assets/* build-assets/
         rm -rf build/docs/${buildVersion}
-        for language in ${locals[@]}; do
-            if [ -d "build/${language}/docs/${buildVersion}" ]; then
-                mkdir -p build-${language}-${buildVersion}/${buildVersion}
-                cp -r build/${language}/docs/${buildVersion}/* build-${language}-${buildVersion}/${buildVersion}
-                rm -rf build/${language}/docs/${buildVersion}
-            fi
-        done
     fi
     echo "..." $buildVersion "build done..."
 }
 
 COMMIT_MSG=$(git show -s --format=%s)
-FORCE_BUILD_ALL_LANGUAGE=$(echo $COMMIT_MSG | sed 's/.*BUILD_ALL_LANGUAGE=\([0-1]*\).*/\1/g')
 FORCE_BUILD_ALL_VERSION=$(echo $COMMIT_MSG | sed 's/.*BUILD_ALL_VERSION=\([0-1]*\).*/\1/g')
 FORCE_BUILD_VERSIONS=$(echo $COMMIT_MSG | sed 's/.*BUILD_VERSIONS=\([0-9\.x,]*\).*/\1/g')
-FORCE_CROWDIN_ALL=$(echo $COMMIT_MSG | sed 's/.*CROWDIN_ALL=\([0-1]*\).*/\1/g')
-FORCE_CROWDIN_UP=$(echo $COMMIT_MSG | sed 's/.*CROWDIN_UP=\([0-1]*\).*/\1/g')
-FORCE_CROWDIN_DOWN=$(echo $COMMIT_MSG | sed 's/.*CROWDIN_DOWN=\([0-1]*\).*/\1/g')
 if [[ $FORCE_BUILD_VERSIONS =~ ^[0-9\.x,]+$ ]]; then
     SUPPLEMENT_VERSIONS=$FORCE_BUILD_VERSIONS
 else
@@ -71,36 +50,14 @@ CURRENT_HOUR=$(date +%H)
 CURRENT_HOUR=${CURRENT_HOUR#0}
 echo "CURRENT_HOUR: "$CURRENT_HOUR
 
-if [[ $FORCE_BUILD_ALL_LANGUAGE"" == "1" ]] || [[ $FORCE_BUILD_ALL_LANGUAGE"" == "0" ]]; then
-    BUILD_ALL_LANGUAGE=$FORCE_BUILD_ALL_LANGUAGE""
-    echo "force build all languages"
-fi
 if [[ $FORCE_BUILD_ALL_VERSION"" == "1" ]] || [[ $FORCE_BUILD_ALL_VERSION"" == "0" ]]; then
     BUILD_ALL_VERSION=$FORCE_BUILD_ALL_VERSION""
     echo "force build all versions"
 fi
 
-if [[ $CURRENT_HOUR -eq 0 ]] || [[ $FORCE_CROWDIN_ALL"" == "1" ]] || [[ $FORCE_CROWDIN_UP"" == "1" ]]; then
-    echo "exec crowdin upload"
-    yarn run crowdin-upload
-else
-    echo "skip crowdin upload"
-fi
-
-if [[ $CURRENT_HOUR -eq 18 ]] || [[ $BUILD_ALL_LANGUAGE"" == "1" ]] || [[ $FORCE_CROWDIN_ALL"" == "1" ]] || [[ $FORCE_CROWDIN_DOWN"" == "1" ]]; then
-    echo "exec crowdin download"
-    # too much crowdin docs error, skip download, will auto copy en docs to build
-    # yarn crowdin-download
-else
-    echo "skip crowdin download"
-fi
-
 cp scripts/code.json i18n/en/
 
-# node scripts/fix-i18n.js
-
-# Build only the versions that has changed
-# Build next version that has any changed
+# Build only the versions that has changed and build next version that has any changed
 while read version; do
     buildVersion=$version
     if [[ $@ == *website-next/versioned_docs/version-$version* || $buildVersion == "next" || $BUILD_ALL_VERSION == "1" || $BUILD_VERSION == *$buildVersion* || $SUPPLEMENT_VERSIONS == *$buildVersion* ]]; then
@@ -114,17 +71,10 @@ while read version; do
     if [ -d "build-$version" ]; then
         mv -f build-$version/* build/docs
         rm -rf build-$version
-
-        for language in ${locals[@]}; do
-            if [ -d "build-$language-$version" ]; then
-                mv -f build-$language-$version/* build/$language/docs
-                rm -rf build-$language-$version
-            fi
-        done
     fi
 done <scripts/.versions
 
 cp -r build-assets/* build/assets/
 rm -rf build-assets
 
-echo $BUILD_ALL_VERSION""$BUILD_ALL_LANGUAGE >scripts/.build
+echo $BUILD_ALL_VERSION >scripts/.build