From d63a41323e92855502d9338530d143d05bdd6d42 Mon Sep 17 00:00:00 2001 From: totoro Date: Tue, 25 May 2021 08:56:15 +0900 Subject: [PATCH] introduce the translate function with list of a key value which will be used to replace the key into translated sentence by the values associated with this key. example: the key = "{1}" , value = "404" the sentence = "The load result code is {1}" after call of the translate_with_key_value_function the result sentence will be "The load result code is 404" --- web_controllers/language/language_management.anubis | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/web_controllers/language/language_management.anubis b/web_controllers/language/language_management.anubis index c39e33f..2ab4888 100644 --- a/web_controllers/language/language_management.anubis +++ b/web_controllers/language/language_management.anubis @@ -61,7 +61,17 @@ public define (String symbolic_name) -> String make_translate_function(_session, (LogLevel level, String txt) |-> println(txt)) . - +public define (String symbolic_name, List((String, String)) list_key_value) -> String + make_translate_with_key_value_function + ( + WEB_Session _session + ) = + (String symbolic_name, List((String, String)) list_key_value) |-> + with translated_sentence = make_translate_function(_session, (LogLevel level, String txt) |-> println(txt))(symbolic_name), + find_and_replace_dict(translated_sentence, list_key_value) +. + + public define List((List(CoreAttrs),WebArgValue, String)) language_list_for_combo ( -- libgit2 0.21.4