diff options
| author | ruki <[email protected]> | 2024-07-03 15:13:53 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2024-07-03 15:13:53 +0800 |
| commit | dbd3925e287ee6355b2999fc6f8c69ef95ac80ef (patch) | |
| tree | 1e308242e280a59611b663fa8c480049db410cb3 | |
| parent | 9c8de1ea614260d6b703d79923cd35e984e0249d (diff) | |
| parent | 7b5299b4f83923bed32654d5cfb4b37c1d40776f (diff) | |
Merge pull request #5298 from 1143910315/add-configuration-for-ts-file
add prefixdir configuration for ts file
| -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) |
