Skip to content

Commit

Permalink
Sync changes
Browse files Browse the repository at this point in the history
Squashed commit of the following:

commit 724e7f4
Author: Edison Jwa <[email protected]>
Date:   Mon Sep 25 13:02:58 2023 +0900

    Fix typo

commit be70395
Author: jiting <[email protected]>
Date:   Thu Oct 12 12:39:58 2023 +0800

    update 3.6.2

commit ffd3f90
Author: jiting <[email protected]>
Date:   Thu Oct 12 12:39:35 2023 +0800

    update scripts

commit 1727599
Author: EdisonJwa <[email protected]>
Date:   Thu Jun 29 13:17:51 2023 +0900

    Support 3.6.0

commit fb93f37
Author: EdisonJwa <[email protected]>
Date:   Sun Dec 25 23:27:37 2022 +0900

    Update build.yml

commit 84ada64
Author: Edison Jwa <[email protected]>
Date:   Fri Sep 16 00:44:46 2022 +0900

    去除部分第二人称

commit ecc60c2
Author: Edison Jwa <[email protected]>
Date:   Fri Sep 16 00:21:25 2022 +0900

    修正大量语法错误, 移除第二人称

commit 5ef38f3
Author: Edison Jwa <[email protected]>
Date:   Thu Sep 15 23:56:57 2022 +0900

    Fix Typo

commit fcacfbc
Author: EdisonJwa <[email protected]>
Date:   Wed Aug 17 01:48:29 2022 +0900

    Update lagos_zh.ts

commit 489f072
Author: Edison Jwa <[email protected]>
Date:   Tue Aug 16 00:54:12 2022 +0900

    更新翻译内容
  • Loading branch information
jitingcn committed Oct 12, 2023
1 parent d1bd9c9 commit b5eb34b
Show file tree
Hide file tree
Showing 9 changed files with 105 additions and 86 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
run: |
export TZ=Asia/Shanghai
sudo apt-get update -q
sudo apt-get install qt5-default qttools5-dev-tools -y -q
sudo apt-get install qtbase5-dev qtchooser qt5-qmake qtbase5-dev-tools qttools5-dev-tools -y -q
- env:
TG_API: ${{ secrets.TG_API }}
Expand Down
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

source "https://rubygems.org"

git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }

gem "rubyzip"
13 changes: 13 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
GEM
remote: https://rubygems.org/
specs:
rubyzip (2.3.2)

PLATFORMS
x86_64-linux

DEPENDENCIES
rubyzip

BUNDLED WITH
2.4.19
1 change: 1 addition & 0 deletions VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.6.2
6 changes: 3 additions & 3 deletions maker.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from urllib import request, parse, error
from time import strftime, localtime

target_version = "3.5.6"
target_version = open("VERSION", "r", encoding="utf-8").read().strip()
language = "zh"
cwd = sys.path[0]
src = f"{cwd + os.sep}src{os.sep}"
Expand All @@ -34,8 +34,8 @@ def make_release():
print("Warning: \"dist\" folder not found. Creating folder...\n")
os.makedirs(dist)

translated = re.compile(r"(?:Generated\s)(\d+)(?: translation)")
untranslated = re.compile(r"(?:Ignored\s)(\d+)(?: untranslated)")
translated = re.compile(r"(?:Generated|生成)\s(\d+)\s(?:translation|条翻译)")
untranslated = re.compile(r"(?:Ignored|忽略)\s(\d+)\s(?:untranslated|条未翻译源文本)")

error = False

Expand Down
81 changes: 41 additions & 40 deletions maker.rb
Original file line number Diff line number Diff line change
@@ -1,47 +1,47 @@
#!/usr/bin/env ruby

require "zip"
require 'net/http'
require "net/http"
require "open3"

Zip.setup do |c|
c.on_exists_proc = true
c.continue_on_exists_proc = true
c.unicode_names = true
c.default_compression = Zlib::BEST_COMPRESSION
c.force_entry_names_encoding = 'UTF-8'
c.force_entry_names_encoding = "UTF-8"
end

build_version = ENV["TRAVIS_BUILD_NUMBER"]
log_url = ENV["TRAVIS_JOB_WEB_URL"]
target_version = "3.5.0"
#language = "zh"
TARGET_VERSION = File.read("VERSION").chomp
# language = "zh"
pwd = Dir.pwd
Dir.mkdir("dist") unless Dir.exist?("dist")
package_name = "Chinese_Translation_zh-CN.ts3_translation"

def make_release()
def make_release
case RUBY_PLATFORM
when /ix/i, /ux/i, /gnu/i, /bsd/i
# "unix"
lrelease = `which lrelease`.split[0]
when /win/i, /ming/i
# "windows"
lrelease = `where lrelease`.split[0]
else
# "other"
exit(1)
when /ix/i, /ux/i, /gnu/i, /bsd/i
# "unix"
lrelease = `which lrelease`.split[0]
when /win/i, /ming/i
# "windows"
lrelease = `where lrelease`.split[0]
else
# "other"
exit(1)
end
translated_count = 0
total_count = 0
translated = /(?:Generated\s)(\d+)(?: translation)/.freeze
untranslated = /(?:Ignored\s)(\d+)(?: untranslated)/.freeze
translated = /(?:Generated|生成)\s(\d+)\s(?:translation|条翻译)/
untranslated = /(?:Ignored|忽略)\s(\d+)\s(?:untranslated|条未翻译源文本)/
Dir.glob("src/*_zh.ts") do |file|
puts file
output = "dist/#{file[4...-3]}.qm"
stdin, stdout, stderr = Open3.popen3(lrelease, file, "-qm", output)
index = 0
stdout.each_line do |line|
stdout.each_line do |line|
unless /qt_zh/.match?(file)
if index == 1
translated_count += translated.match(line)[1].to_i
Expand All @@ -51,7 +51,7 @@ def make_release()
total_count += untranslated.match(line)[1].to_i
end
end
puts line
puts line
index += 1
end
stdout.close
Expand All @@ -61,57 +61,58 @@ def make_release()
end
puts "" # new line
end
send_progress(translated_count, total_count)
# send_progress(translated_count, total_count)
end

def send_progress(done, total)
percentage = Rational(done*100,total).round(2).to_f
info = "当前进度:\n#{done}/#{total}\n#{percentage}%\n".freeze
percentage = Rational(done * 100, total).round(2).to_f
info = "当前进度:\n#{done}/#{total}\n#{percentage}%\n".freeze
puts info
telegram_push(info) unless ARGV[0] == "debug"
end

def telegram_push(string)
tg_api = ENV['TG_API']
group_id = ENV['TG_GROUP_ID']
tg_api = ENV["TG_API"]
group_id = ENV["TG_GROUP_ID"]
uri = URI("https://api.telegram.org/bot#{tg_api}/sendMessage")
querystring = {chat_id: group_id ,text: string}
querystring = {chat_id: group_id, text: string}
uri.query = URI.encode_www_form(querystring)
res = Net::HTTP.get_response(uri)
puts res.code == '200' ? "\n推送成功" : "\n推送失败"
puts (res.code == "200") ? "\n推送成功" : "\n推送失败"
end

def make_package(zipfile_name, build_version=nil, log_url=nil)
File.open('dist/package.ini', 'w') do |file|
def make_package(zipfile_name, build_version = nil, log_url = nil)
File.open("dist/package.ini", "w") do |file|
package_info = [
"Name = TeamSpeak 3 简体中文汉化包 目标软件版本: #{target_version}",
"Name = TeamSpeak 3 简体中文汉化包 目标软件版本: #{TARGET_VERSION}",
"Type = Translation",
"Author = 寂听 & EdisonJwa",
"Version = travis-dev-build##{build_version}",
"Version = snapshot##{build_version}",
"Platforms = ",
"Description = 源代码: https://github.com/jitingcn/TS3-Translation_zh-CN" +
" 构建日志: #{log_url unless log_url.nil?}"]
"Description = 源代码: https://github.com/jitingcn/TS3-Translation_zh-CN" +
" 构建日志: #{log_url unless log_url.nil?}"
]
file.write(package_info.join("\n"))
end
Zip::File.open(zipfile_name, Zip::File::CREATE) do |zipfile|
qm_files = Dir.glob("dist/*.qm")
qm_files.each do |file|
file = file.split("/")
zipfile.add("translations/"+file[1], File.join(file))
zipfile.add("translations/" + file[1], File.join(file))
end
zipfile.add("package.ini", File.join(["dist","package.ini"]))
zipfile.add("package.ini", File.join(["dist", "package.ini"]))
end
end

def debug()
def debug
case RUBY_PLATFORM
when /ix/i, /ux/i, /gnu/i, /bsd/i
FileUtils.cp Dir.glob("dist/*.qm"), "#{Dir.home}/.ts3client/translations", :verbose => true
else
exit
when /ix/i, /ux/i, /gnu/i, /bsd/i
FileUtils.cp Dir.glob("dist/*.qm"), "#{Dir.home}/.ts3client/translations", verbose: true
else
exit
end
end

make_release()
make_release
make_package(package_name) unless ARGV[0] == "debug"
debug() if ARGV[0] == "debug"
debug if ARGV[0] == "debug"
Loading

0 comments on commit b5eb34b

Please sign in to comment.