/* * This file is a part of TTCalc - a mathematical calculator * and is distributed under the (new) BSD licence. * Author: Tomasz Sowa */ /* * Copyright (c) 2006-2007, Tomasz Sowa * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name Tomasz Sowa nor the names of contributors to this * project may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef headerfilelanguages #define headerfilelanguages #include #include #include #include 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, dialog_box_add_function_incorrect_name, 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_edit_undo, menu_edit_paste, menu_edit_copy_result, menu_help_help, menu_help_project_page, menu_help_about, cant_init_calculations, message_box_error_caption, cant_create_thread, cant_create_main_window, cant_init_common_controls, cant_find_help, cant_open_project_page, about_text, about_box_title, about_box_button_close, display_group_scientific, unknown_error }; // 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 > error_messages_tab; std::vector > 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