NetSurf
|
Localised message support (interface). More...
Go to the source code of this file.
Functions | |
nserror | messages_add_from_file (const char *path) |
Read keys and values from messages file into the standard Messages hash. More... | |
nserror | messages_add_from_inline (const uint8_t *data, size_t data_size) |
Read keys and values from inline message data into the standard Messages hash. More... | |
const char * | messages_get (const char *key) |
Fast lookup of a message by key from the standard Messages hash. More... | |
const char * | messages_get_errorcode (nserror code) |
lookup of a message by errorcode from the standard Messages hash. More... | |
const char * | messages_get_sslcode (ssl_cert_err code) |
lookup of a message by SSL error code from the standard Messages hash. More... | |
char * | messages_get_buff (const char *key,...) |
Formatted message from a key in the global message hash. More... | |
void | messages_destroy (void) |
Free memory used by the standard Messages hash. More... | |
Localised message support (interface).
The messages module loads a file of keys and associated strings, and provides fast lookup by key. The messages file consists of key:value lines, comment lines starting with #, and other lines are ignored. Use messages_load() to read the file into memory. To lookup a key, use messages_get("key").
It can also load additional messages files into different contexts and allow you to look up values in it independantly from the standard shared Messages file table. Use the _ctx versions of the functions to do this.
Definition in file messages.h.
nserror messages_add_from_file | ( | const char * | path | ) |
Read keys and values from messages file into the standard Messages hash.
The messages are merged with any previously loaded messages. Any keys which are present already are replaced with the new value. The file may be gzip compressed.
path | pathname of messages file. |
Definition at line 177 of file messages.c.
References messages_hash, messages_load_ctx(), NSERROR_BAD_PARAMETER, NSLOG, and path().
Referenced by ami_theme_init(), gui_init_replicant(), main(), nsgtk_messages_init(), and nsw32_messages_init().
nserror messages_add_from_inline | ( | const uint8_t * | data, |
size_t | data_size | ||
) |
Read keys and values from inline message data into the standard Messages hash.
The messages are merged with any previously loaded messages. Any keys which are present already are replaced with the new value. The data may be gzip compressed.
data | The inline message data. |
data_size | The length of the message data. |
Definition at line 190 of file messages.c.
References hash_add_inline(), HASH_SIZE, messages_create_ctx(), messages_hash, NSERROR_NOMEM, and NSLOG.
Referenced by main(), nsgtk_messages_init(), and nsw32_messages_init().
void messages_destroy | ( | void | ) |
Free memory used by the standard Messages hash.
Definition at line 463 of file messages.c.
References messages_destroy_ctx(), and messages_hash.
Referenced by netsurf_exit().
const char * messages_get | ( | const char * | key | ) |
Fast lookup of a message by key from the standard Messages hash.
key | key of message |
Definition at line 241 of file messages.c.
References messages_get_ctx(), and messages_hash.
Referenced by ami_cookies_present(), ami_datatype_object_from_bitmap(), ami_download_check_overwrite(), ami_file_open(), ami_file_save_req(), ami_font_scan_gui_open(), ami_get_theme_filename(), ami_gui_close_tabs(), ami_gui_hotlist_scan(), ami_gui_opts_setup(), ami_history_global_present(), ami_history_local_present(), ami_hotlist_present(), ami_menu_alloc_item(), ami_menu_scan(), ami_misc_req(), ami_pageinfo_open(), ami_print_progress(), ami_print_ui_setup(), ami_quit_netsurf_delayed(), ami_search_open(), ami_theme_throbber_setup(), amiga_warn_user(), amiga_warn_user_multi(), atari_cookie_manager_init(), atari_global_history_init(), atari_hotlist_init(), atari_warn_user(), box_input(), box_select(), browser_window__handle_error(), content__init(), content_llcache_callback(), content_update_status(), cookie_manager_init_common_values(), cookie_manager_init_entry_fields(), cookie_manager_set_treeview_field_data(), cutomize_button_clicked_cb(), dcgettext(), default_mouse_action(), die(), dirlist_generate_headings(), dirlist_generate_parent_link(), dirlist_generate_row(), editor_init(), fetch_curl_process_headers(), fetch_curl_progress(), fetch_file_process_error(), fetch_resource_notfound_handler(), form__select_process_selection(), form_select_mouse_action(), gadget_mouse_action(), gen_nice_title(), global_history_create_dir(), global_history_create_treeview_field_data(), global_history_initialise_entry_fields(), gui_download_window_create(), gui_download_window_data(), gui_download_window_done(), gui_download_window_error(), gui_file_gadget_open(), gui_init2(), gui_launch_url(), gui_window_create(), gui_window_save_link(), hlcache_migrate_ctx(), HOOKF(), hotlist_add_folder_internal(), hotlist_add_url(), hotlist_generate(), hotlist_initialise_entry_fields(), hotlist_load(), hotlist_load_entry(), html_encoding(), html_finish_conversion(), html_redraw_file(), human_friendly_bytesize(), init_about_dialog(), llcache_fetch_cert_error(), llcache_fetch_redirect(), llcache_fetch_ssl_error(), make_menu_item(), make_toolbar_item_button(), make_toolbar_item_history(), make_toolbar_item_throbber(), menu_open_file(), navigate_internal_real(), nsbeos_new_scaffolding(), nsfont_check_fonts(), nsgtk_about_dialog_init(), nsgtk_check_for_downloads(), nsgtk_download_change_status(), nsgtk_download_dialog_show(), nsgtk_download_handle_error(), nsgtk_download_info_to_string(), nsgtk_download_tree_view_new(), nsgtk_download_update(), nsgtk_menu_add_image_item(), nsgtk_menu_developer_submenu(), nsgtk_menu_edit_submenu(), nsgtk_menu_export_submenu(), nsgtk_menu_file_submenu(), nsgtk_menu_help_submenu(), nsgtk_menu_nav_submenu(), nsgtk_menu_scaleview_submenu(), nsgtk_menu_tabs_submenu(), nsgtk_menu_toolbars_submenu(), nsgtk_menu_tools_submenu(), nsgtk_menu_view_submenu(), nsgtk_on_viewdata_save_as_activate(), nsgtk_saveas_dialog(), nsgtk_viewdata_file_save(), nsgtk_viewsource(), nsgtk_warning(), nsw32_about_dialog_init(), nsws_download_update_label(), nsws_prefs_font_prepare(), plaintext_button_clicked_cb(), print_button_clicked_cb(), print_fonts_callback(), process_dir_ent(), query_user_xy(), riscos_bitmap_save(), ro_cookie_init(), ro_global_history_init(), ro_gui_configure_register(), ro_gui_configure_translate(), ro_gui_download_save(), ro_gui_download_update_status(), ro_gui_hotlist_remove_page(), ro_gui_interactive_help_broadcast(), ro_gui_menu_translate(), ro_gui_options_fonts_init_menu(), ro_gui_options_language_name(), ro_gui_save_content(), ro_gui_save_set_state(), ro_gui_search_init(), ro_gui_search_set_status(), ro_gui_url_file_parse(), ro_gui_window_prepare_form_select_menu(), ro_gui_window_prepare_pageinfo(), ro_hotlist_init(), ro_warn_user(), savepage_button_clicked_cb(), scrollbar_mouse_status_to_message(), select_filepath(), set_item_action(), tab_init(), textplain_convert(), textplain_mouse_action(), theme_install_callback(), theme_install_start(), wimp_MENU(), and win32_warning().
char * messages_get_buff | ( | const char * | key, |
... | |||
) |
Formatted message from a key in the global message hash.
key | key of message |
... | message parameters |
Definition at line 205 of file messages.c.
References hash_get(), and messages_hash.
Referenced by gif_convert(), nsbmp_convert(), nsico_convert(), nsjpeg_convert(), nsjpegxl_convert(), nspng_convert(), and nssprite_convert().
const char * messages_get_errorcode | ( | nserror | code | ) |
lookup of a message by errorcode from the standard Messages hash.
code | errorcode of message |
Definition at line 248 of file messages.c.
References messages_get_ctx(), messages_hash, NSERROR_BAD_AUTH, NSERROR_BAD_CERTS, NSERROR_BAD_CONTENT, NSERROR_BAD_ENCODING, NSERROR_BAD_PARAMETER, NSERROR_BAD_REDIRECT, NSERROR_BAD_SIZE, NSERROR_BAD_URL, NSERROR_BMP_ERROR, NSERROR_BOX_CONVERT, NSERROR_CLONE_FAILED, NSERROR_CSS, NSERROR_CSS_BASE, NSERROR_DOM, NSERROR_ENCODING_CHANGE, NSERROR_FRAME_DEPTH, NSERROR_GIF_ERROR, NSERROR_ICO_ERROR, NSERROR_INIT_FAILED, NSERROR_INVALID, NSERROR_NEED_DATA, NSERROR_NO_FETCH_HANDLER, NSERROR_NOMEM, NSERROR_NOSPACE, NSERROR_NOT_DIRECTORY, NSERROR_NOT_FOUND, NSERROR_NOT_IMPLEMENTED, NSERROR_OK, NSERROR_PERMISSION, NSERROR_PNG_ERROR, NSERROR_SAVE_FAILED, NSERROR_SPRITE_ERROR, NSERROR_STOPPED, NSERROR_SVG_ERROR, NSERROR_TIMEOUT, and NSERROR_UNKNOWN.
Referenced by about_open(), ami_gui_event(), ami_gui_new_blank_tab(), ami_handle_applib(), atari_about_show(), atari_treeview_create(), browser_window__handle_error(), contents_button_clicked_cb(), context_popup(), fb_url_enter(), gadget_mouse_action(), gui_download_window_create(), gui_init(), gui_init2(), guide_button_clicked_cb(), home_button_clicked_cb(), HOOKF(), html_drop_file_at_point(), html_mouse_action(), html_redraw_box(), info_button_clicked_cb(), initialise(), llcache_fetch_callback(), main(), menu_new_win(), menu_open_file(), monkey_window_handle_go(), monkey_window_handle_new(), navigate_internal_real(), newtab_button_clicked_cb(), newwindow_button_clicked_cb(), nsbeos_scaffolding_dispatch_event(), nsgtk_completion_match_select(), nsgtk_cw_keypress_event(), nsgtk_finalise(), nsgtk_init(), nsgtk_on_link_opentab_activate_menu(), nsgtk_on_link_openwin_activate_menu(), nsgtk_on_savelink_activate_menu(), nsgtk_page_info(), nsws_window_command(), openfile_button_clicked_cb(), ro_gui_dialog_openurl_apply(), ro_gui_iconbar_click(), ro_gui_iconbar_menu_select(), ro_gui_url_bar_menu_select(), ro_gui_window_action_home(), ro_gui_window_action_local_history(), ro_gui_window_action_new_window(), ro_gui_window_handle_local_keypress(), ro_gui_window_launch_url(), ro_gui_window_menu_select(), ro_gui_window_toolbar_click(), ro_msg_dataload(), ro_msg_dataopen(), ro_uri_message_received(), ro_url_message_received(), url_entry_activate_cb(), viewsource_button_clicked_cb(), websearch_entry_activate_cb(), win32_report_nserror(), win32_window_set_title(), and WinMain().
const char * messages_get_sslcode | ( | ssl_cert_err | code | ) |
lookup of a message by SSL error code from the standard Messages hash.
code | ssl error code |
Definition at line 405 of file messages.c.
References messages_get_ctx(), messages_hash, SSL_CERT_ERR_BAD_ISSUER, SSL_CERT_ERR_BAD_SIG, SSL_CERT_ERR_CERT_MISSING, SSL_CERT_ERR_CHAIN_SELF_SIGNED, SSL_CERT_ERR_HOSTNAME_MISMATCH, SSL_CERT_ERR_OK, SSL_CERT_ERR_REVOKED, SSL_CERT_ERR_SELF_SIGNED, SSL_CERT_ERR_TOO_OLD, SSL_CERT_ERR_TOO_YOUNG, and SSL_CERT_ERR_UNKNOWN.
Referenced by browser_window__handle_bad_certs().