# -*- coding: utf-8 -*- """追加 BOM 模块的语言翻译 key(zh-CN 与 en-US)。""" import os root = r"d:\开发\leantime-master\leantime-master" zh = ''' # BOM (OneBot) menu.bom = "BOM" menu.bom_tooltip = "BOM 物料清单" text.bom_subtitle = "物料清单(BOM)管理" notification.bom_not_found = "BOM 不存在" label.new_bom = "新建 BOM" text.no_boms = "暂无 BOM,点击“新建 BOM”开始。" label.bom_no = "BOM编号" label.product_name = "产品名称" label.specification = "规格型号" label.drawing_no = "图号" label.column_key = "列标识(英文或中文,用于存储)" label.column_label = "列显示名" label.add_row = "新增行" label.add_column = "增加列" label.teable_sources = "Teable 数据源" text.no_sources = "未配置数据源" label.source_name = "表名/别名" text.teable_import_confirm = "从 Teable 拉取最新数据并导入为明细?" text.imported = "已导入" label.rows = "行" text.no_items = "暂无明细" links.open = "打开" links.back = "返回" links.add = "添加" ''' en = ''' # BOM (OneBot) menu.bom = "BOM" menu.bom_tooltip = "Bill of Materials" text.bom_subtitle = "Bill of Materials (BOM) management" notification.bom_not_found = "BOM not found" label.new_bom = "New BOM" text.no_boms = "No BOM yet. Click \"New BOM\" to start." label.bom_no = "BOM No." label.product_name = "Product Name" label.specification = "Specification" label.drawing_no = "Drawing No." label.column_key = "Column key (used for storage)" label.column_label = "Column label" label.add_row = "Add Row" label.add_column = "Add Column" label.teable_sources = "Teable Sources" text.no_sources = "No source configured" label.source_name = "Table name / alias" text.teable_import_confirm = "Fetch latest data from Teable and import as items?" text.imported = "Imported" label.rows = "rows" text.no_items = "No items" links.open = "Open" links.back = "Back" links.add = "Add" ''' for code, block in (("zh-CN", zh), ("en-US", en)): p = os.path.join(root, "app", "Language", code + ".ini") with open(p, "r", encoding="utf-8") as f: content = f.read() if not content.endswith("\n"): content += "\n" content += block with open(p, "w", encoding="utf-8") as f: f.write(content) print(code, "appended")