From 24273fc8972eae2dfb65e1d342f02fbb053a83b2 Mon Sep 17 00:00:00 2001 From: Alexander Medvednikov Date: Sat, 16 May 2026 11:18:26 +0300 Subject: [PATCH] tools: vwatch picks up .tr translation file edits for veb live reload The compiler's -print-watched-files only reports .v files and $tmpl() template paths, so the translations/ directory was never scanned and .tr edits did not trigger reload (despite *.tr being in default_veb_suffixes). When a veb project is detected, also add the translations/ subdirectory of each watched path. --- cmd/tools/vwatch.v | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/cmd/tools/vwatch.v b/cmd/tools/vwatch.v index 2f5f56917..06f2ca14d 100644 --- a/cmd/tools/vwatch.v +++ b/cmd/tools/vwatch.v @@ -198,6 +198,16 @@ fn (mut context Context) get_stats_for_affected_vfiles() []VFileStat { println(' Add your own --only-watch filter, if you wish to override that choice.') println('') } + // .tr translation files are loaded at runtime by veb (see vlib/veb/tr.v), + // so the compiler never reports them via -print-watched-files. Explicitly + // add `translations/` subdirectories of each project path, so edits to + // .tr files trigger a reload like .html does. + for path in apaths.keys() { + tr_dir := os.join_path_single(path, 'translations') + if os.is_dir(tr_dir) { + apaths[os.real_path(tr_dir)] = true + } + } } context.affected_paths = apaths.keys() // context.elog('vfiles paths to be scanned: ${context.affected_paths}') -- 2.39.5