Commit 81c86ffb authored by Victor Yacovlev's avatar Victor Yacovlev

Implemented russian/english kumir2-run usage message

parent c7845e92
...@@ -13,11 +13,51 @@ ...@@ -13,11 +13,51 @@
int usage(const char * programName) int usage(const char * programName)
{ {
std::cerr << "Usage: " << std::endl; using namespace Kumir;
std::cerr << "\t" << programName << " FILENAME.kod | FILENAME.ks [ARG1 [ARG2 ... [ARGn]]]" << std::endl << std::endl;
std::cerr << "\tFILENAME.kod\tKumir runtime code file name" << std::endl; bool russianLanguage = false;
std::cerr << "\tFILENAME.ks\tKumir assembler input file name" << std::endl;
std::cerr << "\tARG1...ARGn\tKumir program main algorithm arguments" << std::endl; #if defined(WIN32) || defined(_WIN32)
russianLanguage = true;
Char _n = Char('\r\n');
#else
char * env = getenv("LANG");
if (env) {
std::string LANG(env);
russianLanguage = LANG.find("ru")!=std::string::npos;
}
Char _n = Char('\n');
#endif
String message;
if (russianLanguage) {
message = Core::fromUtf8("Вызов:");
message.push_back(_n);
message += Core::fromUtf8("\t")+Core::fromUtf8(std::string(programName));
message += Core::fromUtf8(" [-ansi] ИМЯФАЙЛА.kod [ПАРАМ1 [ПАРАМ2 ... [ПАРАМn]]]");
message.push_back(_n);
message.push_back(_n);
message += Core::fromUtf8("\t-ansi\t\tИспользовть кодировку 1251 вместо 866 в терминале (только для Windows)");
message.push_back(_n);
message += Core::fromUtf8("\tИМЯФАЙЛА.kod\tИмя выполнеяемой программы)");
message.push_back(_n);
message += Core::fromUtf8("\tПАРАМ1...ПАРАМn\tАргументы главного алгоритма Кумир-программы");
message.push_back(_n);
}
else {
message = Core::fromUtf8("Usage:");
message.push_back(_n);
message += Core::fromUtf8("\t")+Core::fromUtf8(std::string(programName));
message += Core::fromUtf8(" [-ansi] FILENAME.kod [ARG1 [ARG2 ... [ARGn]]]");
message.push_back(_n);
message.push_back(_n);
message += Core::fromUtf8("\t-ansi\t\tUse codepage 1251 instead of 866 in console (Windows only)");
message.push_back(_n);
message += Core::fromUtf8("\tFILENAME.kod\tKumir runtime file name)");
message.push_back(_n);
message += Core::fromUtf8("\tARG1...ARGn\tKumir program main algorithm arguments");
message.push_back(_n);
}
std::cerr << Coder::encode(LOCALE, message);
return 127; return 127;
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment