ttcalc/src/languages.cpp

356 lines
16 KiB
C++
Raw Normal View History

#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<unsigned int>( country );
if( cid >= error_messages_tab.size() )
return unk_err;
std::map<ttmath::ErrorCode, std::string>::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<ttmath::ErrorCode, std::string>() );
InsertErrorPair(ttmath::err_ok,"ok");
InsertErrorPair(ttmath::err_nothing_has_read,"");
InsertErrorPair(ttmath::err_unknown_character,"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,"?");
InsertErrorPair(ttmath::err_overflow,"Overflow");
InsertErrorPair(ttmath::err_unknown_function,"An unknown function");
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_this_cant_be_used,"?");
// pl
error_messages_tab.push_back( std::map<ttmath::ErrorCode, std::string>() );
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<61>cy");
InsertErrorPair(ttmath::err_stack_not_clear,"Pozosta<EFBFBD> nieznany znak");
InsertErrorPair(ttmath::err_unknown_variable,"Nieznana zmienna");
InsertErrorPair(ttmath::err_division_by_zero,"Dzielenie przez zero");
InsertErrorPair(ttmath::err_interrupt,"?");
InsertErrorPair(ttmath::err_overflow,"Przekroczony zakres");
InsertErrorPair(ttmath::err_unknown_function,"Nieznana funkcja");
InsertErrorPair(ttmath::err_unexpected_semicolon_operator,"Nieoczekiwany operator '<27>rednik'");
InsertErrorPair(ttmath::err_improper_amount_of_arguments,"Niew<EFBFBD>a<EFBFBD>ciwa liczba argument<6E>w");
InsertErrorPair(ttmath::err_improper_argument,"Niew<EFBFBD>a<EFBFBD>ciwy argument");
InsertErrorPair(ttmath::err_unexpected_end,"Nieoczekiwany koniec");
InsertErrorPair(ttmath::err_internal_error,"B<EFBFBD><EFBFBD>d wewn<77>trzny programu!");
InsertErrorPair(ttmath::err_incorrect_name,"Nieprawid<EFBFBD>owa nazwa zmiennej lub funkcji");
InsertErrorPair(ttmath::err_incorrect_value,"Nieprawid<EFBFBD>owa warto<74><6F> zmiennej lub funkcji");
InsertErrorPair(ttmath::err_variable_exists,"Ta zmienna juz istnieje");
InsertErrorPair(ttmath::err_variable_loop,"Pomi<EFBFBD>dzy zmiennymi zachodzi wywo<77>anie rekurencyjne");
InsertErrorPair(ttmath::err_functions_loop,"Pomi<EFBFBD>dzy funkcjami zachodzi wywo<77>anie rekurencyjne");
InsertErrorPair(ttmath::err_must_be_only_one_value,"Zmienne albo funkcje mog<6F> posiada<64> (zwraca<63>) tylko jedn<64> warto<74><6F>");
InsertErrorPair(ttmath::err_this_cant_be_used,"?");
}
// 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<unsigned int>( country );
if( cid >= gui_messages_tab.size() )
return unk_msg;
std::map<GuiMsg, std::string>::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<GuiMsg, std::string>() );
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,"Incorrect name of variable");
InsertGuiPair(dialog_box_add_variable_incorrect_value,"Incorrect value of 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,"Are you sure that you want to delete those 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,"Are you sure that you want to delete those functions?");
InsertGuiPair(dialog_box_function_not_all_deleted,"There are some functions which I was not able to delete. Probably an internal error!");
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 exp is greater than:");
InsertGuiPair(display_digit, "digits");
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_view_edit_undo, "&Undo");
InsertGuiPair(menu_view_edit_paste, "&Paste");
InsertGuiPair(menu_view_edit_copy_result,"&Copy the result");
InsertGuiPair(menu_view_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\r\n"
"Author: Tomasz Sowa\r\n"
"Contact: t.sowa@slimaczek.pl\r\n"
"Licence: (New) BSD licence\r\n"
"Project page: \r\n"
"Mathemathical library: TTMath %d.%d.%d\r\n"
"Programming language: C++\r\n"
"Compiler: %s\r\n"
"\r\n"
"This program uses the TTMath mathematical 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"
" the developer or programmer just contact with me."
);
InsertGuiPair(about_box_title, "About");
// pl
gui_messages_tab.push_back( std::map<GuiMsg, std::string>() );
InsertGuiPair(button_ok,"Ok");
InsertGuiPair(button_cancel,"Anuluj");
InsertGuiPair(message_box_caption,"TTCalc");
InsertGuiPair(dialog_box_add_variable_caption,"Dodaj now<6F> zmienn<6E>");
InsertGuiPair(dialog_box_edit_variable_caption,"Zmie<EFBFBD> warto<74><6F> zmiennej");
InsertGuiPair(dialog_box_add_variable_incorrect_name,"Nie prawid<69>owa nazwa zmiennej");
InsertGuiPair(dialog_box_add_variable_incorrect_value,"Nie prawid<69>owa warto<74><6F> zmiennej");
InsertGuiPair(dialog_box_add_variable_variable_exists,"Podana zmienna ju<6A> istnieje");
InsertGuiPair(dialog_box_edit_variable_unknown_variable,"Podanej zmiennej nie ma w tablicy. Prawdopodobnie b<><62>d wewn<77>trzny programu.");
InsertGuiPair(dialog_box_delete_variable_confirm,"Czy napewno usun<75><6E> zaznaczone zmienne?");
InsertGuiPair(dialog_box_variable_not_all_deleted,"Zosta<EFBFBD>o kilka zmiennych kt<6B>rych nie mo<6D>na by<62>o skasowa<77>. Prawdopodobnie b<><62>d wewn<77>trzny programu.");
InsertGuiPair(dialog_box_add_function_caption,"Dodaj now<6F> funkcj<63>");
InsertGuiPair(dialog_box_edit_function_caption,"Zmie<EFBFBD> warto<74><6F> funkcji");
InsertGuiPair(dialog_box_add_function_function_exists,"Podana funkcja ju<6A> istnieje");
InsertGuiPair(dialog_box_edit_function_unknown_function,"Podanej funkcji nie ma w tablicy. Prawdopodobnie b<><62>d wewn<77>trzny programu.");
InsertGuiPair(dialog_box_delete_function_confirm,"Czy napewno usun<75><6E> zaznaczone funkcje?");
InsertGuiPair(dialog_box_function_not_all_deleted,"Zosta<EFBFBD>o kilka funkcji kt<6B>rych nie mo<6D>na by<62>o skasowa<77>. Prawdopodobnie b<><62>d wewn<77>trzny programu.");
InsertGuiPair(list_variables_header_1,"Nazwa");
InsertGuiPair(list_variables_header_2,"Warto<EFBFBD><EFBFBD>");
InsertGuiPair(list_functions_header_1,"Nazwa");
InsertGuiPair(list_functions_header_2,"Parametry");
InsertGuiPair(list_functions_header_3,"Warto<EFBFBD><EFBFBD>");
InsertGuiPair(button_add,"Dodaj");
InsertGuiPair(button_edit,"Edytuj");
InsertGuiPair(button_delete,"Usu<EFBFBD>");
InsertGuiPair(button_clear,"C");
InsertGuiPair(tab_standard,"Standard");
InsertGuiPair(tab_variables,"Zmienne");
InsertGuiPair(tab_functions,"Funkcje");
InsertGuiPair(tab_precision,"Precyzja");
InsertGuiPair(tab_display,"Wy<EFBFBD>wietlanie");
InsertGuiPair(radio_precision_1,"Ma<EFBFBD>a - 96 bitowa mantysa, 32 bitowy wyk<79>adnik");
InsertGuiPair(radio_precision_2,"<EFBFBD>rednia - 192 bitowa mantysa, 64 bitowy wyk<79>adnik");
InsertGuiPair(radio_precision_3,"Du<EFBFBD>a - 288 bitowa mantysa, 96 bitowy wyk<79>adnik");
InsertGuiPair(precision_1_info,"(+/-)6.9 e+646457021, 26 cyfr znacz<63>cych (w rozwini<6E>ciu dziesi<73>tnym)");
InsertGuiPair(precision_2_info,"(+/-)4.3 e+2776511644261678623, 56 cyfr znacz<63>cych");
InsertGuiPair(precision_3_info,"(+/-)2.5 e+11925026709067095507636213441, 85 cyfr znacz<63>cych");
InsertGuiPair(overflow_during_printing,"Przepe<EFBFBD>nienie podczas wypisywania");
InsertGuiPair(combo_rounding_none,"bez zaokr<6B>glania");
InsertGuiPair(combo_rounding_cut_last_digits,"skasowa<EFBFBD> nie znacz<63>ce zera");
InsertGuiPair(combo_rounding_integer,"do najbli<6C>szej ca<63>kowitej");
InsertGuiPair(combo_rounding_to_number,"do");
InsertGuiPair(combo_rounding_after_comma,"cyfr(y) po przecinku");
InsertGuiPair(display_input,"Wej<EFBFBD>cie");
InsertGuiPair(display_output,"Wyj<EFBFBD>cie");
InsertGuiPair(display_rounding,"Zaokr<EFBFBD>glenie");
InsertGuiPair(display_always_scientific,"Zawsze");
InsertGuiPair(display_not_always_scientific,"Je<EFBFBD>li eksponent wi<77>kszy ni<6E>");
InsertGuiPair(display_digit, "cyfr");
InsertGuiPair(display_group_scientific, "Wy<EFBFBD>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<EFBFBD>zyk &angielski");
InsertGuiPair(menu_view_lang_polish, "J<EFBFBD>zyk &polski");
InsertGuiPair(menu_view_close_program, "&Zamknij");
InsertGuiPair(menu_view_edit_undo, "&Cofnij");
InsertGuiPair(menu_view_edit_paste, "&Wklej");
InsertGuiPair(menu_view_edit_copy_result,"&Kopiuj wynik");
InsertGuiPair(menu_view_help_about, "&O programie");
InsertGuiPair(cant_init_calculations, "Nie uda<64>o si<73> zainicjalizowa<77> modu<64>u obs<62>ugi oblicze<7A>");
InsertGuiPair(message_box_error_caption,"TTCalc");
InsertGuiPair(cant_create_thread, "Nie uda<64>o si<73> utworzy<7A> drugiego w<>tku do oblicze<7A>");
InsertGuiPair(cant_create_main_window, "Nie uda<64>o si<73> utworzy<7A> g<><67>wnego okna aplikacji");
InsertGuiPair(cant_init_common_controls,"Nie uda<64>o si<73> zainicjalizowa<77> obs<62>ugi Common Controls (InitCommonControlsEx)");
InsertGuiPair(about_text,
"Kalkulator matematyczny TTCalc %d.%d.%d\r\n"
"Autor: Tomasz Sowa\r\n"
"Kontakt: t.sowa@slimaczek.pl\r\n"
"Licencja: (New) BSD\r\n"
"Strona projektu: \r\n"
"Biblioteka matematyczna: TTMath %d.%d.%d\r\n"
"J<EFBFBD>zyk programowania: C++\r\n"
"Kompilator: %s\r\n"
"\r\n"
"Ten program u<>ywa biblioteki matematycznej TTMath"
" kt<6B>ra jest dost<73>pna na http://sourceforge.net/projects/ttmath\r\n"
"\r\n"
"Je<EFBFBD>eli masz jakie<69> pytania, rady, ciekawe pomys<79>y dotycz<63>ce"
" tego programu lub chcia<69>by<62> do<64><6F>czy<7A> jako projektant/programista"
" poprostu skontaktuj si<73> ze mn<6D>."
);
InsertGuiPair(about_box_title, "O programie");
}