mirror of
https://github.com/VigorousPro/TS3-Translation_zh-CN
synced 2024-12-29 02:35:09 +08:00
更改项目结构,测试自动构建
This commit is contained in:
parent
eca0039fd9
commit
c938db7344
3
.gitignore
vendored
3
.gitignore
vendored
@ -1,3 +1,2 @@
|
||||
*.qm
|
||||
*.bat
|
||||
qt_zh.ts
|
||||
*.exe
|
26
.travis.yml
Normal file
26
.travis.yml
Normal file
@ -0,0 +1,26 @@
|
||||
dist: xenial
|
||||
language: python
|
||||
python: 3.7
|
||||
sudo: required
|
||||
|
||||
before_install:
|
||||
- export TZ=Asia/Shanghai
|
||||
- mkdir dist -p
|
||||
- chmod +x ./maker.py
|
||||
- sudo apt-get update -q
|
||||
|
||||
install:
|
||||
- sudo apt-get install qt5-default qttools5-dev-tools -y
|
||||
|
||||
script:
|
||||
- ./maker.py
|
||||
- rm dist/*
|
||||
|
||||
deploy:
|
||||
provider: releases
|
||||
prerelease: true
|
||||
api_key:
|
||||
secure: evVNKg4vC9SRdxh6rIaKkIDKLCqgOvPmdrjWEnN/Vb6gRjUMJ+bfey71ee8OXpkjDtmj9omH9D5P+YeM9O4VeEPZwXImJ41EmMhoy1mky0XQkVShUfnMnBPO/AbaWYBREuS1b13XsTEvU6LiePoRHgJL05G76UKXjD9EqUiHBdc6rxwvZn4AFuNx5Bzj1VpH1Go8IQhFGWSeABXDZiB8yHhqRDowa6Fq3Olc2zvjtLFu2kHO9oWKQ4SWTD5yTXC8o8pzWUWoodxvb8TkAWq52CC0sWkrI/c0x0aodTFY4z+/kjuipxzWhpID3xmmz7ApLcgKgYUeD9zmGTqp0T4MeFAeCbVL6h8JRJDSHIDe8dBd0KIC4eZPRXBKGsNbPZNVaEHBFehx5B33rm2jtW7OpJhQSeNH42icALsZ6OPn2Y6TuaePTT8iXQ0s4DH9rzdksMDb/lzs6TC9p/0vKWUp8hKW+MsgOXjES/oKAzeoF/vc4wjTeuuhnBJbybKQBqJ5sr+T8g6RZtFdo3zP2dMEuX1NpPS8Dja8FvUuUMFXftf+uwum0cF6nFvZO9NO5pgLToa7/ZIei3nKdic8R+H8HkQViTH4yVXs2aktELvdWy977A8zkVbgcsf9akfdYTMNiTjXXDBdgoPmD3wdPU3pZtzKeT2phvGMuetwJtHIvN4=
|
||||
file: "Chinese Translation (zh-CN).ts3_translation"
|
||||
on:
|
||||
repo: jitingcn/TS3-Translation_zh-CN
|
68
maker.py
Normal file
68
maker.py
Normal file
@ -0,0 +1,68 @@
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import os
|
||||
import sys
|
||||
import zipfile
|
||||
import subprocess
|
||||
from time import strftime, localtime
|
||||
|
||||
target_version = "3.2.3"
|
||||
language = "zh"
|
||||
cwd = sys.path[0]
|
||||
src = f"{cwd + os.sep}src{os.sep}"
|
||||
dist = f"{cwd + os.sep}dist{os.sep}"
|
||||
ini = f"{dist}package.ini"
|
||||
|
||||
|
||||
def make_release():
|
||||
if os.name == 'nt':
|
||||
lrelease = 'C:/Qt/Qt5.6.3/5.6.3/msvc2015_64/bin/lrelease.exe' # On my laptop.
|
||||
else: # os.name == 'posix'
|
||||
lrelease = subprocess.run(['whereis', 'lrelease', '-b'], stdout=subprocess.PIPE).stdout[11:]
|
||||
# source_file = [f[:-3] for f in os.listdir(src) if os.path.isfile(os.path.join(src, f)) and f[-5:-3] == language]
|
||||
source_file = [f[:-3] for f in os.listdir(src) if f[-5:-3] == language]
|
||||
release_file = []
|
||||
for i in source_file:
|
||||
print(i)
|
||||
result = subprocess.run([lrelease, f'{src+i}.ts', '-qm', f'{dist+i}.qm'],
|
||||
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||
print(result.stdout.decode("utf-8"))
|
||||
if result.returncode == 0:
|
||||
release_file.append(i+".qm")
|
||||
else:
|
||||
print(result.stderr.decode("utf-8"))
|
||||
|
||||
#except subprocess.CalledProcessError as err:
|
||||
# print("lrelease error:")
|
||||
# print(err)'''
|
||||
|
||||
return release_file
|
||||
|
||||
|
||||
def make_package(release_list):
|
||||
timestamp = strftime("%Y%m%d%H%M%S", localtime())
|
||||
print("Write package info to package.ini ...")
|
||||
with open(ini, "w", encoding="utf-8") as f:
|
||||
package_info = [f"Name = TeamSpeak 3 简体中文汉化包 软件版本:{target_version}",
|
||||
"Type = Translation",
|
||||
"Author = 寂听",
|
||||
f"Version = Beta-{timestamp}",
|
||||
"Platforms = ",
|
||||
'Description = Source Code: https://github.com/jitingcn/TS3-Translation_zh-CN']
|
||||
f.write("\n".join(package_info))
|
||||
|
||||
file_name = 'Chinese Translation (zh-CN).ts3_translation'
|
||||
print("Zip package ...")
|
||||
with zipfile.ZipFile(file_name, 'w', zipfile.ZIP_DEFLATED) as release:
|
||||
release.write(ini, "package.ini")
|
||||
for i in release_list:
|
||||
release.write(dist+i, f"translations/{i}")
|
||||
print("Complete.")
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
print("Making .qm translations file ...")
|
||||
release_file_list = make_release()
|
||||
print("Making .ts3_translation release package ...")
|
||||
make_package(release_file_list)
|
7967
src/qt_zh.ts
Normal file
7967
src/qt_zh.ts
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user