'''
Author: deng.yinping deng.yinping@muchinfo.cn
Date: 2024-12-06 14:17:53
LastEditors: deng.yinping deng.yinping@muchinfo.cn
LastEditTime: 2025-03-07 16:13:03
FilePath: \MTP20_WEB_GLOBAL_i18n_Tool\src\tools.py
Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
'''

from src.common import CommonUti


class Tools:
        
    @staticmethod
    def generate_excel(oem, inc_file, output_folder, json_folder, oem_json_folder):
        '''
        根据JSON生成excel文件
        '''
        CommonUti.generate_excle(oem, output_folder, json_folder, oem_json_folder)
        # 增量更新，在生成excel里标注新增的key为黄色
        CommonUti.update_excel_by_inc(oem, output_folder, inc_file)
        
    @staticmethod
    def generate_json_files(oem, output_folder, json_folder, oem_json_folder):
        '''
        根据excel生成JSON文件
        '''
        dic_cn, dic_en, dic_th, dic_tw, dic_vi = CommonUti.read_from_excel(oem, output_folder)
        CommonUti.generate_json(oem, dic_cn, 'zh-CN', output_folder, json_folder, oem_json_folder)
        CommonUti.generate_json(oem, dic_en, 'en-US', output_folder, json_folder, oem_json_folder)
        CommonUti.generate_json(oem, dic_th, 'th-TH', output_folder, json_folder, oem_json_folder)
        CommonUti.generate_json(oem, dic_tw, 'zh-TW', output_folder, json_folder, oem_json_folder)
        CommonUti.generate_json(oem, dic_vi, 'vi-VN', output_folder, json_folder, oem_json_folder)
