diff --git a/web_controllers/language/language_management.anubis b/web_controllers/language/language_management.anubis index 3bebda4..7458df8 100644 --- a/web_controllers/language/language_management.anubis +++ b/web_controllers/language/language_management.anubis @@ -6,31 +6,61 @@ * © David RENÉ */ +read system/logger.anubis read locale/L3.anubis +read locale/L3LanguageInfo.anubis +read xlib/web/types/controllers_web_site.anubis read xlib/web/CXM_web_session.anubis -read app/app_loggers.anubis + public define String default_language = "en". public define (String symbolic_name) -> String make_translate_function ( - WEB_Session _session + WEB_Session _session, + (LogLevel, String) -> One logger ) = with lang = _session.language, app_dictionnary = get_String(_session.fields, "AWS_CURRENT_DICTIONARY", ""), if l3_load_base(app_dictionnary) is { - failure then logError(debug_log,"Can't load translation dictionnary for '"+app_dictionnary+"'"); - (String symbolic_name) |-> "<" + symbolic_name + ">", - success(L3 local) then + failure then + logger(logError, "Can't load translation dictionnary for '"+app_dictionnary+"'"); + (String symbolic_name) |-> "<" + symbolic_name + ">", - //now we set the current language - with _l3_object = l3_set_current(local, lang), + success(L3 local) then + //now we set the current language + with _l3_object = l3_set_current(local, lang), l3_object = l3_set_default(_l3_object, default_language), if lang = "symb" then - (String symbolic_name) |-> "[" + l3_get_text(l3_object, symbolic_name) + "]" - else - (String symbolic_name) |-> l3_get_text(l3_object, symbolic_name) + (String symbolic_name) |-> "[" + l3_get_text(l3_object, symbolic_name) + "]" + else + (String symbolic_name) |-> l3_get_text(l3_object, symbolic_name) } . + +public define (String symbolic_name) -> String + make_translate_function + ( + WEB_Session _session + ) = + make_translate_function(_session, (LogLevel level, String txt) |-> println(txt)) +. + + +public define List((List(CoreAttrs),WebArgValue, String)) + language_list_for_combo + ( + String dictionary_collection_name //means application name + ) + = + map((L3LangDicProperty dico_prop) + |-> + since dico_prop is l3LangDicProperty( _, _, lang_code, _, _, _), + with lang_info = l3_get_language_info(lang_code), + ((List(CoreAttrs))[], wav(lang_code), self_name(lang_info)) + , + l3_get_all_dicos(dictionary_collection_name) + ) +. -- libgit2 0.21.4