1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-09-30 19:22:14 +00:00

Add multilang test to testtranslations

This commit is contained in:
y5nw 2025-02-24 15:45:21 +01:00 committed by y5nw
parent e8370769a9
commit d669b0a3bd
3 changed files with 22 additions and 1 deletions

View file

@ -5,12 +5,18 @@ local function send_compare(name, text)
core.get_translated_string("", text), text, core.get_translated_string("fr", text)))
end
local function send_multilang_compare(name, text)
core.chat_send_player(name, ("%s | %s | %s | %s"):format(
core.get_translated_string("", text), text,
core.get_translated_string("fr_CH:fr", text), core.get_translated_string("fr:fr_CH", text)))
end
core.register_chatcommand("testtranslations", {
params = "",
description = "Test translations",
privs = {},
func = function(name, param)
core.chat_send_player(name, "Please ensure your locale is set to \"fr\"")
core.chat_send_player(name, "Please ensure your locale is set to \"fr_CH\"")
core.chat_send_player(name, "Untranslated | Client-side translation | Server-side translation (fr)")
send_compare(name, S("Testing .tr files: untranslated"))
send_compare(name, S("Testing .po files: untranslated"))
@ -22,5 +28,9 @@ core.register_chatcommand("testtranslations", {
send_compare(name, NS("@1: .po singular", "@1: .po plural", i, tostring(i)))
send_compare(name, NS("@1: .mo singular", "@1: .mo plural", i, tostring(i)))
end
core.chat_send_player(name, "Untranslated | Client-side translations" ..
" | Server-side translation (fr_CH:fr) | Server-side translation (fr:fr_CH)")
send_multilang_compare(name, S("Testing translation with multiple languages"))
send_multilang_compare(name, S("Testing French-only translation: untranslated"))
end
})

View file

@ -20,3 +20,11 @@ msgstr "Testing fuzzy .po entry: translated (wrong)"
msgid "Testing .po without context: untranslated"
msgstr "Testing .po without context: translated"
msgctxt "testtranslations"
msgid "Testing translation with multiple languages"
msgstr" Testing translation: translated in standard French"
msgctxt "testtranslations"
msgid "Testing French-only translation: untranslated"
msgstr "Testing French-only translation: translated"

View file

@ -0,0 +1,3 @@
msgctxt "testtranslations"
msgid "Testing translation with multiple languages"
msgstr "Testing translation: translated in Swiss French"