/* * 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. */ #include "compileconfig.h" #include "languages.h" const char * Languages::ErrorMessage(Country country, ttmath::ErrorCode code) { const char * unk_err = "unknown error"; if( error_messages_tab.empty() ) InitErrorMessagesTab(); unsigned int cid = static_cast( country ); if( cid >= error_messages_tab.size() ) return unk_err; std::map::const_iterator i; i = error_messages_tab[cid].find( code ); if( i == error_messages_tab[cid].end() ) return unk_err; return i->second.c_str(); } const char * Languages::ErrorMessage(ttmath::ErrorCode code) { return ErrorMessage(current_country, code); } void Languages::InsertErrorPair(ttmath::ErrorCode code, const char * message) { if( error_messages_tab.empty() ) return; error_messages_tab.back().insert( std::make_pair(code, message) ); } void Languages::InitErrorMessagesTab() { error_messages_tab.push_back( std::map() ); InsertErrorPair(ttmath::err_ok,"ok"); InsertErrorPair(ttmath::err_nothing_has_read,""); InsertErrorPair(ttmath::err_unknown_character,"An unknown character"); InsertErrorPair(ttmath::err_unexpected_final_bracket,"An unexpected final bracket"); InsertErrorPair(ttmath::err_stack_not_clear,"An unknown character has left"); InsertErrorPair(ttmath::err_unknown_variable,"An unknown variable"); InsertErrorPair(ttmath::err_division_by_zero,"Division by zero"); InsertErrorPair(ttmath::err_interrupt,"The calculating has been broken"); InsertErrorPair(ttmath::err_overflow,"Overflow"); InsertErrorPair(ttmath::err_unknown_function,"An unknown function"); InsertErrorPair(ttmath::err_unknown_operator,"An unknown operator"); InsertErrorPair(ttmath::err_unexpected_semicolon_operator,"An unexpected semicolon operator"); InsertErrorPair(ttmath::err_improper_amount_of_arguments,"Improper amount of arguments"); InsertErrorPair(ttmath::err_improper_argument,"Improper argument"); InsertErrorPair(ttmath::err_unexpected_end,"Unexpected end"); InsertErrorPair(ttmath::err_internal_error,"An internal error"); InsertErrorPair(ttmath::err_incorrect_name,"Incorrect name of a variable or function"); InsertErrorPair(ttmath::err_incorrect_value,"Incorrect value of a variable or function"); InsertErrorPair(ttmath::err_variable_exists,"This variable already exists"); InsertErrorPair(ttmath::err_variable_loop,"There's a recurrence between variables"); InsertErrorPair(ttmath::err_functions_loop,"There's a recurrence between functions"); InsertErrorPair(ttmath::err_must_be_only_one_value,"Variables or functions must return only one value"); InsertErrorPair(ttmath::err_still_calculating,"Calculating..."); InsertErrorPair(ttmath::err_too_big_factorial,"A too big argument for the factorial() function"); // pl error_messages_tab.push_back( std::map() ); InsertErrorPair(ttmath::err_ok,"ok"); InsertErrorPair(ttmath::err_nothing_has_read,""); InsertErrorPair(ttmath::err_unknown_character,"Nieznany znak"); InsertErrorPair(ttmath::err_unexpected_final_bracket,"Nieoczekiwany nawias zamykający"); InsertErrorPair(ttmath::err_stack_not_clear,"Pozostał nieznany znak"); InsertErrorPair(ttmath::err_unknown_variable,"Nieznana zmienna"); InsertErrorPair(ttmath::err_division_by_zero,"Dzielenie przez zero"); InsertErrorPair(ttmath::err_interrupt,"Obliczenia zostały przerwane"); InsertErrorPair(ttmath::err_overflow,"Przekroczony zakres"); InsertErrorPair(ttmath::err_unknown_function,"Nieznana funkcja"); InsertErrorPair(ttmath::err_unknown_operator,"Nieznany operator"); InsertErrorPair(ttmath::err_unexpected_semicolon_operator,"Nieoczekiwany operator 'średnik'"); InsertErrorPair(ttmath::err_improper_amount_of_arguments,"Niewłaściwa liczba argumentów"); InsertErrorPair(ttmath::err_improper_argument,"Niewłaściwy argument"); InsertErrorPair(ttmath::err_unexpected_end,"Nieoczekiwany koniec"); InsertErrorPair(ttmath::err_internal_error,"Błąd wewnętrzny programu!"); InsertErrorPair(ttmath::err_incorrect_name,"Nieprawidłowa nazwa zmiennej lub funkcji"); InsertErrorPair(ttmath::err_incorrect_value,"Nieprawidłowa wartość zmiennej lub funkcji"); InsertErrorPair(ttmath::err_variable_exists,"Ta zmienna juz istnieje"); InsertErrorPair(ttmath::err_variable_loop,"Pomiędzy zmiennymi zachodzi wywołanie rekurencyjne"); InsertErrorPair(ttmath::err_functions_loop,"Pomiędzy funkcjami zachodzi wywołanie rekurencyjne"); InsertErrorPair(ttmath::err_must_be_only_one_value,"Zmienne albo funkcje mogą posiadać (zwracać) tylko jedną wartość"); InsertErrorPair(ttmath::err_still_calculating,"Obliczanie..."); InsertErrorPair(ttmath::err_too_big_factorial,"Zbyt duży argument dla funkcji factorial()"); } // for gui messages const char * Languages::GuiMessage(Country country, GuiMsg code) { const char * unk_msg = "unknown"; if( gui_messages_tab.empty() ) InitGuiMessagesTab(); unsigned int cid = static_cast( country ); if( cid >= gui_messages_tab.size() ) return unk_msg; std::map::const_iterator i; i = gui_messages_tab[cid].find( code ); if( i == gui_messages_tab[cid].end() ) return unk_msg; return i->second.c_str(); } const char * Languages::GuiMessage(GuiMsg code) { return GuiMessage(current_country, code); } void Languages::InsertGuiPair(GuiMsg code, const char * message) { if( gui_messages_tab.empty() ) return; gui_messages_tab.back().insert( std::make_pair(code, message) ); } void Languages::InitGuiMessagesTab() { // en gui_messages_tab.push_back( std::map() ); InsertGuiPair(button_ok,"Ok"); InsertGuiPair(button_cancel,"Cancel"); InsertGuiPair(message_box_caption,"TTCalc"); InsertGuiPair(dialog_box_add_variable_caption,"Add a new variable"); InsertGuiPair(dialog_box_edit_variable_caption,"Edit a variable"); InsertGuiPair(dialog_box_add_variable_incorrect_name,"An incorrect name of the variable"); InsertGuiPair(dialog_box_add_variable_incorrect_value,"An incorrect value of the variable"); InsertGuiPair(dialog_box_add_variable_variable_exists,"This variable already exists"); InsertGuiPair(dialog_box_edit_variable_unknown_variable,"There isn't this variable in my table. There's probably an internal error!"); InsertGuiPair(dialog_box_delete_variable_confirm,"Do you want to delete these variables?"); InsertGuiPair(dialog_box_variable_not_all_deleted,"There are some variables which I was not able to delete. Probably an internal error!"); InsertGuiPair(dialog_box_add_function_caption,"Add a new function"); InsertGuiPair(dialog_box_edit_function_caption,"Edit a function"); InsertGuiPair(dialog_box_add_function_function_exists,"This function already exists"); InsertGuiPair(dialog_box_edit_function_unknown_function,"There isn't this function in my table. There's probably an internal error!"); InsertGuiPair(dialog_box_delete_function_confirm,"Do you want to delete these functions?"); InsertGuiPair(dialog_box_function_not_all_deleted,"There are some functions which I was not able to delete. Probably an internal error!"); InsertGuiPair(dialog_box_add_function_incorrect_name,"An incorrect name of the function"); InsertGuiPair(list_variables_header_1,"Name"); InsertGuiPair(list_variables_header_2,"Value"); InsertGuiPair(list_functions_header_1,"Name"); InsertGuiPair(list_functions_header_2,"Param."); InsertGuiPair(list_functions_header_3,"Value"); InsertGuiPair(button_add,"Add"); InsertGuiPair(button_edit,"Edit"); InsertGuiPair(button_delete,"Delete"); InsertGuiPair(button_clear,"C"); InsertGuiPair(tab_standard,"Standard"); InsertGuiPair(tab_variables,"Variables"); InsertGuiPair(tab_functions,"Functions"); InsertGuiPair(tab_precision,"Precision"); InsertGuiPair(tab_display,"Display"); InsertGuiPair(radio_precision_1,"Small - 96 bits for mantissa, 32 bits for exponent"); InsertGuiPair(radio_precision_2,"Medium - 192 bits for mantissa, 64 bits for exponent"); InsertGuiPair(radio_precision_3,"Big - 288 bits for mantissa, 96 bits for exponent"); InsertGuiPair(precision_1_info,"(+/-)6.9 e+646457021, 26 valid digits (decimal)"); InsertGuiPair(precision_2_info,"(+/-)4.3 e+2776511644261678623, 56 valid digits"); InsertGuiPair(precision_3_info,"(+/-)2.5 e+11925026709067095507636213441, 85 valid digits"); InsertGuiPair(overflow_during_printing,"Overflow during printing"); InsertGuiPair(combo_rounding_none,"None"); InsertGuiPair(combo_rounding_cut_last_digits,"Cut off last non-valid digits"); InsertGuiPair(combo_rounding_integer,"Round to the nearest integer"); InsertGuiPair(combo_rounding_to_number,"to"); InsertGuiPair(combo_rounding_after_comma,"digit(s) after comma"); InsertGuiPair(display_input, "Input"); InsertGuiPair(display_output, "Output"); InsertGuiPair(display_rounding, "Rounding"); InsertGuiPair(display_always_scientific,"Always"); InsertGuiPair(display_not_always_scientific,"When the exponent is greater than:"); InsertGuiPair(display_group_scientific, "Print the result as the scientific value"); InsertGuiPair(menu_view, "&View"); InsertGuiPair(menu_edit, "&Edit"); InsertGuiPair(menu_help, "&Help"); InsertGuiPair(menu_language, "&Language"); InsertGuiPair(menu_view_new_window, "&New window"); InsertGuiPair(menu_view_normal_view, "No&rmal view"); InsertGuiPair(menu_view_compact_view, "C&ompact view"); InsertGuiPair(menu_view_always_on_top, "&Always on top"); InsertGuiPair(menu_view_lang_english, "&English"); InsertGuiPair(menu_view_lang_polish, "&Polish"); InsertGuiPair(menu_view_close_program, "&Close"); InsertGuiPair(menu_edit_undo, "&Undo"); InsertGuiPair(menu_edit_paste, "&Paste"); InsertGuiPair(menu_edit_copy_result, "&Copy the result"); InsertGuiPair(menu_help_help, "&Help"); InsertGuiPair(menu_help_project_page, "&Project page"); InsertGuiPair(menu_help_about, "&About"); InsertGuiPair(cant_init_calculations, "I could not initialize the module of calculations"); InsertGuiPair(message_box_error_caption,"TTCalc"); InsertGuiPair(cant_create_thread, "I could not create the second thread for calculating"); InsertGuiPair(cant_create_main_window, "I could not create the main window of the application"); InsertGuiPair(cant_init_common_controls,"I could not initialize the common controls (InitCommonControlsEx)"); InsertGuiPair(about_text, "Mathematical calculator TTCalc %d.%d.%d%s\r\n" "Author: Tomasz Sowa\r\n" "Contact: t.sowa@slimaczek.pl\r\n" "Licence: (New) BSD licence\r\n" "Project page: http://sourceforge.net/projects/ttcalc\r\n" "Bignum library: TTMath %d.%d.%d%s\r\n" "Programming language: C++\r\n" "Compiler: %s\r\n" "\r\n" "This program uses the TTMath bignum library" " which can be found at http://sourceforge.net/projects/ttmath\r\n" "\r\n" "If you have any questions, advices or interesting ideas about" " this program or if you want to join to this project as" " a developer or programmer feel free to contant with the author." ); InsertGuiPair(about_box_title, "About"); InsertGuiPair(about_box_button_close, "Close"); InsertGuiPair(unknown_error, "An unknown error has occurred"); InsertGuiPair(cant_find_help, "I can't find any help files"); InsertGuiPair(cant_open_project_page, "I can't open the project webpage"); // pl gui_messages_tab.push_back( std::map() ); InsertGuiPair(button_ok,"Ok"); InsertGuiPair(button_cancel,"Anuluj"); InsertGuiPair(message_box_caption,"TTCalc"); InsertGuiPair(dialog_box_add_variable_caption,"Dodaj nową zmienną"); InsertGuiPair(dialog_box_edit_variable_caption,"Zmień wartość zmiennej"); InsertGuiPair(dialog_box_add_variable_incorrect_name,"Nie prawidłowa nazwa zmiennej"); InsertGuiPair(dialog_box_add_variable_incorrect_value,"Nie prawidłowa wartość zmiennej"); InsertGuiPair(dialog_box_add_variable_variable_exists,"Podana zmienna już istnieje"); InsertGuiPair(dialog_box_edit_variable_unknown_variable,"Podanej zmiennej nie ma w tablicy. Prawdopodobnie błąd wewnętrzny programu."); InsertGuiPair(dialog_box_delete_variable_confirm,"Czy napewno usunąć zaznaczone zmienne?"); InsertGuiPair(dialog_box_variable_not_all_deleted,"Zostało kilka zmiennych których nie można było skasować. Prawdopodobnie błąd wewnętrzny programu."); InsertGuiPair(dialog_box_add_function_caption,"Dodaj nową funkcję"); InsertGuiPair(dialog_box_edit_function_caption,"Zmień wartość funkcji"); InsertGuiPair(dialog_box_add_function_function_exists,"Podana funkcja już istnieje"); InsertGuiPair(dialog_box_edit_function_unknown_function,"Podanej funkcji nie ma w tablicy. Prawdopodobnie błąd wewnętrzny programu."); InsertGuiPair(dialog_box_delete_function_confirm,"Czy napewno usunąć zaznaczone funkcje?"); InsertGuiPair(dialog_box_function_not_all_deleted,"Zostało kilka funkcji których nie można było skasować. Prawdopodobnie błąd wewnętrzny programu."); InsertGuiPair(dialog_box_add_function_incorrect_name,"Nieprawidłowa nazwa funkcji"); InsertGuiPair(list_variables_header_1,"Nazwa"); InsertGuiPair(list_variables_header_2,"Wartość"); InsertGuiPair(list_functions_header_1,"Nazwa"); InsertGuiPair(list_functions_header_2,"Parametry"); InsertGuiPair(list_functions_header_3,"Wartość"); InsertGuiPair(button_add,"Dodaj"); InsertGuiPair(button_edit,"Edytuj"); InsertGuiPair(button_delete,"Usuń"); InsertGuiPair(button_clear,"C"); InsertGuiPair(tab_standard,"Standard"); InsertGuiPair(tab_variables,"Zmienne"); InsertGuiPair(tab_functions,"Funkcje"); InsertGuiPair(tab_precision,"Precyzja"); InsertGuiPair(tab_display,"Wyświetlanie"); InsertGuiPair(radio_precision_1,"Mała - 96 bitowa mantysa, 32 bitowy wykładnik"); InsertGuiPair(radio_precision_2,"Średnia - 192 bitowa mantysa, 64 bitowy wykładnik"); InsertGuiPair(radio_precision_3,"Duża - 288 bitowa mantysa, 96 bitowy wykładnik"); InsertGuiPair(precision_1_info,"(+/-)6.9 e+646457021, 26 cyfr znaczących (w rozwinięciu dziesiętnym)"); InsertGuiPair(precision_2_info,"(+/-)4.3 e+2776511644261678623, 56 cyfr znaczących"); InsertGuiPair(precision_3_info,"(+/-)2.5 e+11925026709067095507636213441, 85 cyfr znaczących"); InsertGuiPair(overflow_during_printing,"Przepełnienie podczas wypisywania"); InsertGuiPair(combo_rounding_none,"bez zaokrąglania"); InsertGuiPair(combo_rounding_cut_last_digits,"skasować nie znaczące zera"); InsertGuiPair(combo_rounding_integer,"do najbliższej całkowitej"); InsertGuiPair(combo_rounding_to_number,"do"); InsertGuiPair(combo_rounding_after_comma,"cyfr(y) po przecinku"); InsertGuiPair(display_input,"Wejście"); InsertGuiPair(display_output,"Wyjście"); InsertGuiPair(display_rounding,"Zaokrąglenie"); InsertGuiPair(display_always_scientific,"Zawsze"); InsertGuiPair(display_not_always_scientific,"Jeśli eksponent jest większy niż:"); InsertGuiPair(display_group_scientific, "Wyświetl wynik w postaci naukowej"); InsertGuiPair(menu_view, "&Widok"); InsertGuiPair(menu_edit, "&Edycja"); InsertGuiPair(menu_help, "&Pomoc"); InsertGuiPair(menu_language, "&Język"); InsertGuiPair(menu_view_new_window, "&Nowe okno"); InsertGuiPair(menu_view_normal_view, "Widok no&rmalny"); InsertGuiPair(menu_view_compact_view, "Widok &kompaktowy"); InsertGuiPair(menu_view_always_on_top, "Zawsze na &wierzchu"); InsertGuiPair(menu_view_lang_english, "Język &angielski"); InsertGuiPair(menu_view_lang_polish, "Język &polski"); InsertGuiPair(menu_view_close_program, "&Zamknij"); InsertGuiPair(menu_edit_undo, "&Cofnij"); InsertGuiPair(menu_edit_paste, "&Wklej"); InsertGuiPair(menu_edit_copy_result, "&Kopiuj wynik"); InsertGuiPair(menu_help_help, "&Pomoc"); InsertGuiPair(menu_help_project_page, "&Strona projektu"); InsertGuiPair(menu_help_about, "&O programie"); InsertGuiPair(cant_init_calculations, "Nie udało się zainicjalizować modułu obsługi obliczeń"); InsertGuiPair(message_box_error_caption,"TTCalc"); InsertGuiPair(cant_create_thread, "Nie udało się utworzyć drugiego wątku do obliczeń"); InsertGuiPair(cant_create_main_window, "Nie udało się utworzyć głównego okna aplikacji"); InsertGuiPair(cant_init_common_controls,"Nie udało się zainicjalizować obsługi Common Controls (InitCommonControlsEx)"); InsertGuiPair(about_text, "Kalkulator matematyczny TTCalc %d.%d.%d%s\r\n" "Autor: Tomasz Sowa\r\n" "Kontakt: t.sowa@slimaczek.pl\r\n" "Licencja: (New) BSD\r\n" "Strona projektu: http://sourceforge.net/projects/ttcalc\r\n" "Biblioteka dużych liczb: TTMath %d.%d.%d%s\r\n" "Język programowania: C++\r\n" "Kompilator: %s\r\n" "\r\n" "Ten program używa biblioteki dużych liczb TTMath" " która jest dostępna na http://sourceforge.net/projects/ttmath\r\n" "\r\n" "Jeżeli masz jakieś pytania, rady, ciekawe pomysły dotyczące" " tego programu lub chciałbyś dołączyć jako projektant/programista" " poprostu skontaktuj się z autorem." ); InsertGuiPair(about_box_title, "O programie"); InsertGuiPair(about_box_button_close, "Zamknij"); InsertGuiPair(unknown_error, "Nieznany kod błędu"); InsertGuiPair(cant_find_help, "Nie mogę znależć żadnych plików pomocy"); InsertGuiPair(cant_open_project_page, "Nie mogę otworzyć strony projektu"); }