diff --git a/GameData/Benjee10_sharedAssets/Localization/en-us.cfg b/GameData/Benjee10_sharedAssets/Localization/en-us.cfg new file mode 100644 index 0000000..0ba5324 --- /dev/null +++ b/GameData/Benjee10_sharedAssets/Localization/en-us.cfg @@ -0,0 +1,33 @@ +Localization +{ + en-us + { + #LOC_B10_APASv2_title = C-100 Androgynous Docking Mechanism + #LOC_B10_APASv2_description = This intermediate-sized docking mechanism is great for bringing people together. + + #LOC_B10_hybrid_female_title = C-150 Hybrid Docking Mechanism (Female) + #LOC_B10_hybrid_female_description = The result of an experimental cross-breeding program between two docking ports who love each other very much is this abomination, a combination of a capture drogue with a sturdy structural ring for permanent connections between modules. Compatible with standard SSVP ports. + + #LOC_B10_hybrid_male_title = C-150 Hybrid Docking Mechanism (Male) + #LOC_B10_hybrid_male_description = The result of an experimental cross-breeding program between two docking ports who love each other very much is this abomination, a combination of a capture probe with a sturdy structural ring for permanent connections between modules. Compatible with standard SSVP ports. + + #LOC_B10_IDA_title = C-100 Mk II Androgynous Docking Mechanism (Passive) + #LOC_B10_IDA_description = This moderately upgraded version of the C-100 is still compatible with Mk I versions of the port. + + #LOC_B10_NDS_title = C-100 Mk II Androgynous Docking Mechanism (Active) + #LOC_B10_NDS_description = A slightly upgraded version of the C-100 port, with lower mass. + + #LOC_ht2_CBM_title = C-200 Common Berthing Mechanism (Passive) + #LOC_ht2_CBM_description = A structural ring designed for rigidly connecting together space station modules. + + #LOC_ht2_CBM_active1_title = C-200 Common Berthing Mechanism (Active Type I) + #LOC_ht2_CBM_active1_description = A structural ring designed for rigidly connecting together space station modules. + + #LOC_ht2_CBM_active2_title = C-200 Common Berthing Mechanism (Active Type II) + #LOC_ht2_CBM_active2_description = A structural ring designed for rigidly connecting together space station modules. + + #LOC_benjee10_AJ10_v2_title = KJ-10b "Viking" Orbital Manoeuvring Engine + #LOC_benjee10_AJ10_v2_description = A no-nonsense service engine designed for... pretty much anything really. + + } +} \ No newline at end of file diff --git a/GameData/Benjee10_sharedAssets/Localization/zh-cn.cfg b/GameData/Benjee10_sharedAssets/Localization/zh-cn.cfg new file mode 100644 index 0000000..95b32d7 --- /dev/null +++ b/GameData/Benjee10_sharedAssets/Localization/zh-cn.cfg @@ -0,0 +1,33 @@ +Localization +{ + zh-cn + { + #LOC_B10_APASv2_title = C-100 雌雄同体对接机构 + #LOC_B10_APASv2_description = 这种中型对接装置非常适合将人们聚集在一起。 + + #LOC_B10_hybrid_female_title = C-150 混合对接机构 (Female) + #LOC_B10_hybrid_female_description = 这是两个相亲相爱的对接口进行杂交实验的结果,它结合了捕获锥和坚固的结构环,用于模块之间的永久连接。兼容标准SSVP端口。 + + #LOC_B10_hybrid_male_title = C-150 混合对接机构 (Male) + #LOC_B10_hybrid_male_description = 这是两个相亲相爱的对接口进行杂交实验的结果,它结合了捕获探针和坚固的结构环,用于模块之间的永久连接。兼容标准SSVP端口。 + + #LOC_B10_IDA_title = C-100 Mk II 雌雄同体对接机构 (Passive) + #LOC_B10_IDA_description = 这种C-100的中等升级版本仍然与Mk I版本的端口兼容。 + + #LOC_B10_NDS_title = C-100 Mk II 雌雄同体对接机构 (Active) + #LOC_B10_NDS_description = C-100端口的略微升级版本,质量更轻。 + + #LOC_ht2_CBM_title = C-200 通用停泊机构 (Passive) + #LOC_ht2_CBM_description = 一个用于将空间站模块刚性连接在一起的结构环。 + + #LOC_ht2_CBM_active1_title = C-200 通用停泊机构 (Active Type I) + #LOC_ht2_CBM_active1_description = 一个用于将空间站模块刚性连接在一起的结构环。 + + #LOC_ht2_CBM_active2_title = C-200 通用停泊机构 (Active Type II) + #LOC_ht2_CBM_active2_description = 一个用于将空间站模块刚性连接在一起的结构环。 + + #LOC_benjee10_AJ10_v2_title = KJ-10b "Viking" 轨道机动引擎 + #LOC_benjee10_AJ10_v2_description = 这是一款简单易用的服务引擎,可用于......几乎任何用途。 + + } +} \ No newline at end of file diff --git a/program_changeFile.py b/program_changeFile.py new file mode 100644 index 0000000..d9b44a6 --- /dev/null +++ b/program_changeFile.py @@ -0,0 +1,38 @@ +#Modify the cfg text for each part. +import os + +folder_path = r'C:\Games\KSP\1.12.5 Stock\GameData\Benjee10_sharedAssets\Parts' +field_name_1 = 'title' +field_name_2 = 'description' +field_name_3 = 'name' + +for dirpath, dirnames, filenames in os.walk(folder_path): + folder_name = os.path.basename(dirpath) + for filename in filenames: + if filename.endswith('.cfg'): + with open(os.path.join(dirpath, filename), 'r') as file: + content = file.read() + lines = content.split('\n') + field_value_3 = '' + found_field_1 = False + found_field_2 = False + found_field_3 = False + flag = False + for i, line in enumerate(lines): + if field_name_1 in line and not found_field_1: + lines[i] = f'\ttitle = #LOC_{field_value_3}_title' + found_field_1 = True + if field_name_2 in line and not found_field_2: + lines[i] = f'\tdescription = #LOC_{field_value_3}_description' + found_field_2 = True + if flag == False: + if field_name_3 in line and not found_field_3: + field_value_3 = line.split('=')[1].strip() + found_field_3 = True + flag = True + if found_field_1 and found_field_2 and found_field_3: + break + content = '\n'.join(lines) + with open(os.path.join(dirpath, filename), 'w') as file: + file.write(content) + diff --git a/program_en-us.py b/program_en-us.py new file mode 100644 index 0000000..f6dce5d --- /dev/null +++ b/program_en-us.py @@ -0,0 +1,41 @@ +#Extraction of titles and abstracts. +import os + +folder_path = r'C:\Games\KSP\1.12.5 Stock\GameData\Benjee10_sharedAssets\Parts' +field_name_1 = 'title' +field_name_2 = 'description' +field_name_3 = 'name' +output_file = 'en-us.cfg' + +with open(output_file, 'w') as out: + out.write('Localization\n{\n\ten-us\n\t{\n') + for dirpath, dirnames, filenames in os.walk(folder_path): + folder_name = os.path.basename(dirpath) + for filename in filenames: + if filename.endswith('.cfg'): + with open(os.path.join(dirpath, filename), 'r') as file: + found_field_1 = False + found_field_2 = False + found_field_3 = False + field_value_3 = '' + flag = False + for line in file: + if field_name_1 in line: + field_value = line.split('=')[1].strip() + out.write(f'\t\t#LOC_{field_value_3}_title = {field_value}\n') + found_field_1 = True + if field_name_2 in line: + field_value = line.split('=')[1].strip() + out.write(f'\t\t#LOC_{field_value_3}_description = {field_value}\n\n') + found_field_2 = True + if flag == False: + if field_name_3 in line: + field_value_3 = line.split('=')[1].strip() + found_field_3 = True + flag = True + if found_field_1 and found_field_2 and found_field_3: + break + out.write('\t}\n}') + + +