diff options
| -rw-r--r-- | tests/projects/qt/with_ts/xmake.lua | 5 | ||||
| -rw-r--r-- | xmake/rules/qt/ts/xmake.lua | 11 |
2 files changed, 12 insertions, 4 deletions
diff --git a/tests/projects/qt/with_ts/xmake.lua b/tests/projects/qt/with_ts/xmake.lua index bc9bdaffc..d12ed5606 100644 --- a/tests/projects/qt/with_ts/xmake.lua +++ b/tests/projects/qt/with_ts/xmake.lua @@ -6,4 +6,7 @@ target("demo") add_files("src/*.cpp") add_files("src/mainwindow.ui") add_files("src/mainwindow.h") - add_files("src/*.ts") + add_files("src/demo_zh_CN.ts") + add_files("src/demo_zh_TW.ts", { + prefixdir = "translations" + })
\ No newline at end of file diff --git a/xmake/rules/qt/ts/xmake.lua b/xmake/rules/qt/ts/xmake.lua index 289f1fa60..6ddfeb703 100644 --- a/xmake/rules/qt/ts/xmake.lua +++ b/xmake/rules/qt/ts/xmake.lua @@ -50,9 +50,14 @@ rule("qt.ts") before_buildcmd_file(function (target, batchcmds, sourcefile_ts, opt) -- get lrelease local lrelease = target:data("qt.ts.lrelease") - local outfile = path.join(target:targetdir(), path.basename(sourcefile_ts) .. ".qm") - batchcmds:mkdir(target:targetdir()) + local outputdir = target:targetdir() + local fileconfig = target:fileconfig(sourcefile_ts) + if fileconfig and fileconfig.prefixdir then + outputdir = path.join(target:targetdir(), fileconfig.prefixdir) + end + local outfile = path.join(outputdir, path.basename(sourcefile_ts) .. ".qm") + batchcmds:mkdir(outputdir) batchcmds:show_progress(opt.progress, "${color.build.object}compiling.qt.ts %s", sourcefile_ts) batchcmds:vrunv(lrelease, {path(sourcefile_ts), "-qm", path(outfile)}) batchcmds:add_depfiles(sourcefile_ts) - end)
\ No newline at end of file + end) |
