140 lines
3.0 KiB
C++
140 lines
3.0 KiB
C++
#ifndef headerfilelanguages
|
|
#define headerfilelanguages
|
|
|
|
#include <string>
|
|
#include <map>
|
|
#include <vector>
|
|
|
|
#include <ttmath/ttmathtypes.h>
|
|
|
|
|
|
class Languages
|
|
{
|
|
public:
|
|
|
|
enum GuiMsg
|
|
{
|
|
button_ok,
|
|
button_cancel,
|
|
message_box_caption,
|
|
dialog_box_add_variable_caption,
|
|
dialog_box_edit_variable_caption,
|
|
dialog_box_add_variable_incorrect_name,
|
|
dialog_box_add_variable_incorrect_value,
|
|
dialog_box_add_variable_variable_exists,
|
|
dialog_box_edit_variable_unknown_variable,
|
|
dialog_box_delete_variable_confirm,
|
|
dialog_box_variable_not_all_deleted,
|
|
dialog_box_add_function_caption,
|
|
dialog_box_edit_function_caption,
|
|
dialog_box_add_function_function_exists,
|
|
dialog_box_edit_function_unknown_function,
|
|
dialog_box_delete_function_confirm,
|
|
dialog_box_function_not_all_deleted,
|
|
list_variables_header_1,
|
|
list_variables_header_2,
|
|
list_functions_header_1,
|
|
list_functions_header_2,
|
|
list_functions_header_3,
|
|
button_add,
|
|
button_edit,
|
|
button_delete,
|
|
button_clear,
|
|
tab_standard,
|
|
tab_variables,
|
|
tab_functions,
|
|
tab_precision,
|
|
tab_display,
|
|
radio_precision_1,
|
|
radio_precision_2,
|
|
radio_precision_3,
|
|
precision_1_info,
|
|
precision_2_info,
|
|
precision_3_info,
|
|
overflow_during_printing,
|
|
combo_rounding_none,
|
|
combo_rounding_cut_last_digits,
|
|
combo_rounding_integer,
|
|
combo_rounding_to_number,
|
|
combo_rounding_after_comma,
|
|
display_input,
|
|
display_output,
|
|
display_rounding,
|
|
display_always_scientific,
|
|
display_not_always_scientific,
|
|
menu_view,
|
|
menu_edit,
|
|
menu_help,
|
|
menu_language,
|
|
menu_view_new_window,
|
|
menu_view_normal_view,
|
|
menu_view_compact_view,
|
|
menu_view_always_on_top,
|
|
menu_view_lang_english,
|
|
menu_view_lang_polish,
|
|
menu_view_close_program,
|
|
menu_view_edit_undo,
|
|
menu_view_edit_paste,
|
|
menu_view_edit_copy_result,
|
|
menu_view_help_about,
|
|
cant_init_calculations,
|
|
message_box_error_caption,
|
|
cant_create_thread,
|
|
cant_create_main_window,
|
|
cant_init_common_controls,
|
|
about_text,
|
|
about_box_title,
|
|
display_digit,
|
|
display_group_scientific
|
|
};
|
|
|
|
// the first item must be with zero index
|
|
// and next items must be about one greater (0,1,2,3..)
|
|
// (after conversion to 'int' we pass it into the std::vector)
|
|
enum Country
|
|
{
|
|
en = 0, pl
|
|
};
|
|
|
|
private:
|
|
|
|
Country current_country;
|
|
|
|
std::vector<std::map<ttmath::ErrorCode, std::string> > error_messages_tab;
|
|
std::vector<std::map<GuiMsg, std::string> > gui_messages_tab;
|
|
|
|
void InsertErrorPair(ttmath::ErrorCode code, const char * message);
|
|
void InitErrorMessagesTab();
|
|
|
|
void InsertGuiPair(GuiMsg code, const char * message);
|
|
void InitGuiMessagesTab();
|
|
|
|
public:
|
|
|
|
|
|
|
|
Languages()
|
|
{
|
|
current_country = en;
|
|
}
|
|
|
|
void SetCurrentLanguage(Country c)
|
|
{
|
|
current_country = c;
|
|
}
|
|
|
|
Country GetCurrentLanguage()
|
|
{
|
|
return current_country;
|
|
}
|
|
|
|
const char * ErrorMessage(Country country, ttmath::ErrorCode code);
|
|
const char * ErrorMessage(ttmath::ErrorCode code);
|
|
const char * GuiMessage(Country country, GuiMsg code);
|
|
const char * GuiMessage(GuiMsg code);
|
|
|
|
};
|
|
|
|
|
|
#endif
|