diff --git a/.github/workflows/python-app-sync-proto.yml b/.github/workflows/python-app-sync-proto.yml
index 12f16a30591..a92a4dbaff3 100644
--- a/.github/workflows/python-app-sync-proto.yml
+++ b/.github/workflows/python-app-sync-proto.yml
@@ -28,7 +28,7 @@ jobs:
- name: sync proto type (cn to en)
run: |
cd xml2json
- python sync_prototype.py --src_dir ../dita/RTC-NG/API --dest_dir ../en-US/dita/RTC-NG/API
+ python sync_prototype.py --src_dir ../dita/RTC-NG --dest_dir ../en-US/dita/RTC-NG
- name: Create Pull Request
uses: peter-evans/create-pull-request@v4
with:
diff --git a/dita/RTC-NG/config/keys-rtc-ng-api-blueprint.ditamap b/dita/RTC-NG/config/keys-rtc-ng-api-blueprint.ditamap
index 1217401f912..fa808a82ecc 100644
--- a/dita/RTC-NG/config/keys-rtc-ng-api-blueprint.ditamap
+++ b/dita/RTC-NG/config/keys-rtc-ng-api-blueprint.ditamap
@@ -26,21 +26,24 @@
- 参数
+ 参数
+ Parameters
- 返回值
+ 返回值
+ Returns
- Struct 及 Enum
+ Struct 及 Enum
+ Struct and Enum
diff --git a/dita/RTC-NG/config/keys-rtc-ng-api-cpp.ditamap b/dita/RTC-NG/config/keys-rtc-ng-api-cpp.ditamap
index 1d129f06f2b..c9ea0f15234 100644
--- a/dita/RTC-NG/config/keys-rtc-ng-api-cpp.ditamap
+++ b/dita/RTC-NG/config/keys-rtc-ng-api-cpp.ditamap
@@ -26,21 +26,24 @@
- 参数
+ 参数
+ Parameters
- 返回值
+ 返回值
+ Returns
- Struct 及 Enum
+ Struct 及 Enum
+ Struct and Enum
diff --git a/dita/RTC-NG/config/keys-rtc-ng-api-electron.ditamap b/dita/RTC-NG/config/keys-rtc-ng-api-electron.ditamap
index 68d5a43c0be..fb4ce9972a4 100644
--- a/dita/RTC-NG/config/keys-rtc-ng-api-electron.ditamap
+++ b/dita/RTC-NG/config/keys-rtc-ng-api-electron.ditamap
@@ -26,21 +26,24 @@
- 参数
+ 参数
+ Parameters
- 返回值
+ 返回值
+ Returns
- Class 及 Enum
+ Class 及 Enum
+ Class and Enum
diff --git a/dita/RTC-NG/config/keys-rtc-ng-api-flutter.ditamap b/dita/RTC-NG/config/keys-rtc-ng-api-flutter.ditamap
index 90e939672a3..e2d6ad31caf 100644
--- a/dita/RTC-NG/config/keys-rtc-ng-api-flutter.ditamap
+++ b/dita/RTC-NG/config/keys-rtc-ng-api-flutter.ditamap
@@ -26,14 +26,16 @@
- 参数
+ 参数
+ Parameters
- 异常
+ 异常
+ Exceptions
@@ -12103,7 +12105,8 @@
- Class 及 Enum
+ Class 及 Enum
+ Class and Enum
diff --git a/dita/RTC-NG/config/keys-rtc-ng-api-ios.ditamap b/dita/RTC-NG/config/keys-rtc-ng-api-ios.ditamap
index 651122a1843..e1f0e1d32ae 100644
--- a/dita/RTC-NG/config/keys-rtc-ng-api-ios.ditamap
+++ b/dita/RTC-NG/config/keys-rtc-ng-api-ios.ditamap
@@ -26,21 +26,24 @@
- 参数
+ 参数
+ Parameters
- 返回值
+ 返回值
+ Returns
- Class 及 Enum
+ Class 及 Enum
+ Class and Enum
diff --git a/dita/RTC-NG/config/keys-rtc-ng-api-java.ditamap b/dita/RTC-NG/config/keys-rtc-ng-api-java.ditamap
index 4e9b9cd8539..df35adc6cf5 100644
--- a/dita/RTC-NG/config/keys-rtc-ng-api-java.ditamap
+++ b/dita/RTC-NG/config/keys-rtc-ng-api-java.ditamap
@@ -26,14 +26,16 @@
- 参数
+ 参数
+ Parameters
- 返回值
+ 返回值
+ Returns
@@ -11798,7 +11800,8 @@
- Class 及 Enum
+ Class 及 Enum
+ Class and Enum
diff --git a/dita/RTC-NG/config/keys-rtc-ng-api-macos.ditamap b/dita/RTC-NG/config/keys-rtc-ng-api-macos.ditamap
index 19ed36d507d..93686e35ed5 100644
--- a/dita/RTC-NG/config/keys-rtc-ng-api-macos.ditamap
+++ b/dita/RTC-NG/config/keys-rtc-ng-api-macos.ditamap
@@ -26,14 +26,16 @@
- 参数
+ 参数
+ Parameters
- 返回值
+ 返回值
+ Returns
@@ -11664,7 +11666,8 @@
- Class 及 Enum
+ Class 及 Enum
+ Class and Enum
diff --git a/dita/RTC-NG/config/keys-rtc-ng-api-rn.ditamap b/dita/RTC-NG/config/keys-rtc-ng-api-rn.ditamap
index 1bc254cf0a4..d8ad3a7a1f8 100644
--- a/dita/RTC-NG/config/keys-rtc-ng-api-rn.ditamap
+++ b/dita/RTC-NG/config/keys-rtc-ng-api-rn.ditamap
@@ -26,21 +26,24 @@
- 参数
+ 参数
+ Parameters
- 返回值
+ 返回值
+ Returns
- Class 及 Enum
+ Class 及 Enum
+ Class and Enum
diff --git a/dita/RTC-NG/config/keys-rtc-ng-api-unity.ditamap b/dita/RTC-NG/config/keys-rtc-ng-api-unity.ditamap
index a1ab0672e28..3295128b816 100644
--- a/dita/RTC-NG/config/keys-rtc-ng-api-unity.ditamap
+++ b/dita/RTC-NG/config/keys-rtc-ng-api-unity.ditamap
@@ -28,14 +28,16 @@
- 参数
+ 参数
+ Parameters
- 返回值
+ 返回值
+ Returns
@@ -12815,7 +12817,8 @@
- Class 及 Enum
+ Class 及 Enum
+ Class and Enum
diff --git a/dita/RTC-NG/config/keys-rtc-ng-api-unreal.ditamap b/dita/RTC-NG/config/keys-rtc-ng-api-unreal.ditamap
index 6899ea93c1c..7f7786bad49 100644
--- a/dita/RTC-NG/config/keys-rtc-ng-api-unreal.ditamap
+++ b/dita/RTC-NG/config/keys-rtc-ng-api-unreal.ditamap
@@ -26,21 +26,24 @@
- 参数
+ 参数
+ Parameters
- 返回值
+ 返回值
+ Returns
- Struct 及 Enum
+ Struct 及 Enum
+ Struct and Enum
diff --git a/xml2json/sync_prototype.py b/xml2json/sync_prototype.py
index f3ae29dfd20..7630858de70 100644
--- a/xml2json/sync_prototype.py
+++ b/xml2json/sync_prototype.py
@@ -1,40 +1,55 @@
import os
import re
import argparse
-
-parser = argparse.ArgumentParser(description="Prototype syncer")
-
-parser.add_argument("--src_dir",help="src dir",action="store")
-parser.add_argument("--dest_dir", help="dest dir", action="store")
-
-args = vars(parser.parse_args())
-
-src_dir = args['src_dir']
-dest_dir = args['dest_dir']
-
-prefixes = ('api_', 'callback_', 'class_')
-
-for file_name in os.listdir(src_dir):
-
- if file_name.startswith(prefixes):
-
- cn_path = os.path.join(src_dir, file_name)
- with open(cn_path, 'r') as cn_file:
- cn_file_content = cn_file.read()
- pattern = r''
- proto = re.findall(pattern, cn_file_content, flags=re.DOTALL)
- if not proto:
- print(f"No proto in cn file: {cn_path}")
- continue
-
- en_path = os.path.join(dest_dir, file_name)
- try:
- with open(en_path, 'r+') as en_file:
- en_file_content = en_file.read()
- en_file.seek(0)
- updated_content = re.sub(r'', proto[0], en_file_content, flags=re.DOTALL)
- en_file.write(updated_content)
- en_file.truncate()
- except FileNotFoundError:
- print(f"No corresponding en file: {en_path}")
- continue
\ No newline at end of file
+import shutil
+
+def sync_prototype(src_dir, dest_dir):
+ src_api_dir = os.path.join(src_dir, 'API')
+ dest_api_dir = os.path.join(dest_dir, 'API')
+
+ for file_name in os.listdir(src_api_dir):
+ if file_name.startswith(('api_', 'callback_', 'class_')):
+ src_file = os.path.join(src_api_dir, file_name)
+ dest_file = os.path.join(dest_api_dir, file_name)
+
+ with open(src_file, 'r') as file:
+ content = file.read()
+ pattern = r''
+ proto = re.findall(pattern, content, flags=re.DOTALL)
+ if not proto:
+ print(f"No proto in cn file: {src_file}")
+ continue
+
+ if os.path.exists(dest_file):
+ with open(dest_file, 'r+') as file:
+ content = file.read()
+ updated_content = re.sub(r'', proto[0], content, flags=re.DOTALL)
+ file.seek(0)
+ file.write(updated_content)
+ file.truncate()
+ else:
+ print(f"No corresponding en file: {dest_file}")
+
+def sync_keysmap(src_dir, dest_dir):
+ src_config_dir = os.path.join(src_dir, 'config')
+ dest_config_dir = os.path.join(dest_dir, 'config')
+
+ for file_name in os.listdir(src_config_dir):
+ if file_name.startswith('keys-rtc-ng-api'):
+ src_file = os.path.join(src_config_dir, file_name)
+ dest_file = os.path.join(dest_config_dir, file_name)
+ shutil.copy2(src_file, dest_file)
+
+def main():
+ parser = argparse.ArgumentParser(description="Prototype & Keysmap syncer")
+ parser.add_argument("--src_dir", help="source directory", action="store")
+ parser.add_argument("--dest_dir", help="destination directory", action="store")
+ args = vars(parser.parse_args())
+ src_dir = args['src_dir']
+ dest_dir = args['dest_dir']
+
+ sync_prototype(src_dir, dest_dir)
+ sync_keysmap(src_dir, dest_dir)
+
+if __name__ == '__main__':
+ main()
\ No newline at end of file