diff --git a/docs/download&start/Android.md b/docs/download&start/Android.md index 1820ea8..c3237ce 100644 --- a/docs/download&start/Android.md +++ b/docs/download&start/Android.md @@ -99,9 +99,12 @@ ```bash # 首先换源 pip config set global.index-url http://mirrors.aliyun.com/pypi/simple/ - # 然后安装 + # 然后安装(依次执行下面的指令) pip install mido pip install brotli + pip install Musicreater + pip install TrimLog + python -m pip install --upgrade pip setuptools wheel ``` - 如果出现以下情况,真是死了鬼的,我们要来再搞个设置: @@ -121,6 +124,7 @@ pip install brotli pip install Musicreater pip install TrimLog + python -m pip install --upgrade pip setuptools wheel ``` 安装成功后您可能会见到类似下图的提示: diff --git a/languages/lang.py b/languages/lang.py index e3bbee6..c527d28 100644 --- a/languages/lang.py +++ b/languages/lang.py @@ -18,7 +18,7 @@ LANGUAGELIST = { "简体中文 中国大陆", ), "ZH-TW": ( - "繁体中文 中国台湾省", + "繁体中文 中国台湾", "Traditional Chinese - Taiwan Province, China", "正體中文,中国台灣省", ), @@ -85,10 +85,49 @@ languages = { } } + +class Lang: + def __init__(self, lang: str = "ZH-CN", debug: bool = False) -> None: + self.local = lang + self.debug = debug + + def __load_language(self, language_file_name: str): + global logger + with open(language_file_name, "r", encoding="utf-8") as languageFile: + _text = {} + for line in languageFile: + if line.startswith("#"): + continue + line = line.split(" ", 1) + _text[line[0]] = line[1].replace("\n", "") + langkeys = _text.keys() + with open( + language_file_name.replace(language_file_name[-10:-5], "ZH-CN"), + "r", + encoding="utf-8", + ) as defaultLangFile: + for line in defaultLangFile: + if line.startswith("#"): + continue + line = line.split(" ", 1) + if not line[0] in langkeys: + _text[line[0]] = line[1].replace("\n", "") + logger.warning( + f"丢失对于 {line[0]} 的本地化文本", + ) + langkeys = _text.keys() + # print(_text) + return _text + + # 这个函数是不被加载的 def passbt(): - from utils.io import logger, requests + from utils.io import logger + try: + from utils.io import requests + except ImportError: + pass def __loadLanguage(languageFilename: str): with open(languageFilename, "r", encoding="utf-8") as languageFile: diff --git a/llc_cli.py b/llc_cli.py index 85af12b..87bfb15 100644 --- a/llc_cli.py +++ b/llc_cli.py @@ -21,14 +21,14 @@ import os import random import sys -print("小贴:不妨试试Mid-BDX转换网页:在线的多功能Midi转换器") -print("https://dislink.github.io/midi2bdx/") - import Musicreater from utils.io import * from languages.lang import languages +print("小贴:不妨试试Mid-BDX转换网页:在线的多功能Midi转换器") +print("https://dislink.github.io/midi2bdx/") + MainConsole.print( "[#121110 on #F0F2F4] ", style="#121110 on #F0F2F4", diff --git a/llc_installer/llc_installer_Win.py b/llc_installer/llc_installer_Win.py index 7bb024e..d67cbc6 100644 --- a/llc_installer/llc_installer_Win.py +++ b/llc_installer/llc_installer_Win.py @@ -14,7 +14,6 @@ Copyright © 2023 EillesWan & TriM Org. Terms & Conditions: ../Lisense.md """ -# 代码写的并非十分的漂亮,还请大佬多多包涵;本软件源代码依照Apache软件协议公开 # 下面为正文 diff --git a/requirements.txt b/requirements.txt index d304564..7607438 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,4 +2,4 @@ Brotli>=1.0.9 mido>=1.2.10 rich>=10.9.0 Musicreater>=0.5.0 -TrimLog>=0.1.0 +TrimLog>=0.7.2 diff --git a/utils/io.py b/utils/io.py index 5057c05..e95cf8d 100644 --- a/utils/io.py +++ b/utils/io.py @@ -5,10 +5,12 @@ import urllib.error import TrimLog from TrimLog import Console, object_constants +is_logging: bool = True + MainConsole = Console() osc = object_constants.ObjectStateConstant() logger = TrimLog.Logger( - is_logging=True, + is_logging=is_logging, printing=not osc.isRelease, in_suffix=".llc", )