Commit d63a41323e92855502d9338530d143d05bdd6d42

Authored by David RENÉ
1 parent a2431db2

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"
Showing 1 changed file with 11 additions and 1 deletions   Show diff stats
web_controllers/language/language_management.anubis
@@ -61,7 +61,17 @@ public define (String symbolic_name) -> String @@ -61,7 +61,17 @@ public define (String symbolic_name) -> String
61 make_translate_function(_session, (LogLevel level, String txt) |-> println(txt)) 61 make_translate_function(_session, (LogLevel level, String txt) |-> println(txt))
62 . 62 .
63 63
64 - 64 +public define (String symbolic_name, List((String, String)) list_key_value) -> String
  65 + make_translate_with_key_value_function
  66 + (
  67 + WEB_Session _session
  68 + ) =
  69 + (String symbolic_name, List((String, String)) list_key_value) |->
  70 + with translated_sentence = make_translate_function(_session, (LogLevel level, String txt) |-> println(txt))(symbolic_name),
  71 + find_and_replace_dict(translated_sentence, list_key_value)
  72 +.
  73 +
  74 +
65 public define List((List(CoreAttrs),WebArgValue, String)) 75 public define List((List(CoreAttrs),WebArgValue, String))
66 language_list_for_combo 76 language_list_for_combo
67 ( 77 (