开发背景
项目里不同工程经常会引用同一批公共类,这些类里如果有字段需要翻译,需要在不同的项目里都翻译一遍,比较麻烦冗余。
特此开发了这个小翻译工具,能读取程序目录下的所有ts文件,以类名归类,不同项目里类名相同的字段,只需要有一个项目里翻译过,
就可以对所有其他项目内的同类名下的该字段自动翻译上。避免了大量重复翻译工作。
运行效果
主界面:

功能说明:
写了2个测试工程TestProject1、TestProject2,里面同时引用了2个公共类CommonClassA、CommonClassB。
然后在工程1里翻译了ClassA的部分字段,在工程2里翻译了ClassB的部分字段:




把翻译工具放到项目根目录下,运行会递归查找子目录中的所有ts文件,并进行同类名的同名字段自动翻译:


源码、演示程序下载
此工具源码免费提供,包含整理的测试demo:
链接:https://pan.baidu.com/s/17euid_4MQJVL0ULqpod_Ng?pwd=zy4e
提取码:zy4e

工程说明
AutoTranslator:
Qt多工程同名字段自动翻译工具
收集程序目录下(包含递归子目录)所有ts文件翻译内容,把这些ts中未翻译部分,自动翻译成翻译过的内容(相同类名的)。
Common:
2个测试工程的公共引用类
TestProject1、TestProject2:
只是2个带翻译文件的空工程,其中TestProject1翻译了CommonClassA部分字段,TestProject2翻译了CommonClassB部分字段
使用方法:
把AutoTranslator_boxed.exe(用打包工具打包好的可执行单exe文件)放在你的工程根目录下,运行后点击自动翻译即可。
运行效果:
会搜索目录下的所有ts文件,把这些ts中未翻译部分,自动翻译成翻译过的内容(其他工程内相同类名的)
开发环境:
VS2019、Qt5.15.2