[education/rkward] rkward/autotests: Add test for backend translation

Thomas Friedrichsmeier null at kde.org
Thu Oct 16 20:57:56 BST 2025


Git commit 6771785df6b866deade7e2200aab2fad257f8050 by Thomas Friedrichsmeier.
Committed on 14/10/2025 at 16:13.
Pushed by tfry into branch 'master'.

Add test for backend translation

M  +12   -0    rkward/autotests/core_test.cpp

https://invent.kde.org/education/rkward/-/commit/6771785df6b866deade7e2200aab2fad257f8050

diff --git a/rkward/autotests/core_test.cpp b/rkward/autotests/core_test.cpp
index 76f1db257..9051bf5b3 100644
--- a/rkward/autotests/core_test.cpp
+++ b/rkward/autotests/core_test.cpp
@@ -256,6 +256,18 @@ class RKWardCoreTest : public QObject {
 		waitForAllFinished();
 	}
 
+	void backendI18nTest() {
+		const auto transstring = u"R Console"_s; // A basic string we know to have a German translation
+		runCommandAsync(new RCommand(u"cat(rkward:::.rk.i18n(\"%1\"))"_s.arg(transstring), RCommand::App), nullptr, [transstring](RCommand *command) {
+			QVERIFY(command->fullOutput().contains(transstring));
+		});
+		runCommandAsync(new RCommand(u"local({x <- Sys.setLanguage(\"de\"); cat(rkward:::.rk.i18n(\"%1\")); Sys.setLanguage(x); cat(\"done\")})"_s.arg(transstring), RCommand::App), nullptr, [transstring](RCommand *command) {
+			QVERIFY(!command->fullOutput().contains(transstring));
+			QVERIFY(command->fullOutput().contains(u"done"_s));
+		});
+		waitForAllFinished();
+	}
+
 	void irregularShortNameTest() {
 		QVERIFY(RObject::irregularShortName(u"0x"_s));
 		QVERIFY(RObject::irregularShortName(u".1x"_s));



More information about the rkward-tracker mailing list