Changeset View
Changeset View
Standalone View
Standalone View
ps/trunk/source/third_party/tinygettext/src/po_parser.cpp
Show First 20 Lines • Show All 304 Lines • ▼ Show 20 Lines | |||||
POParser::is_empty_line() | POParser::is_empty_line() | ||||
{ | { | ||||
if (current_line.empty()) | if (current_line.empty()) | ||||
{ | { | ||||
return true; | return true; | ||||
} | } | ||||
else if (current_line[0] == '#') | else if (current_line[0] == '#') | ||||
{ // handle comments as empty lines | { // handle comments as empty lines | ||||
if (current_line.size() == 1 || (current_line.size() >= 2 && isspace(current_line[1]))) | return (current_line.size() == 1 || (current_line.size() >= 2 && isspace(current_line[1]))); | ||||
return true; | |||||
else | |||||
return false; | |||||
} | } | ||||
else | else | ||||
{ | { | ||||
for(std::string::iterator i = current_line.begin(); i != current_line.end(); ++i) | for(std::string::iterator i = current_line.begin(); i != current_line.end(); ++i) | ||||
{ | { | ||||
if (!isspace(*i)) | if (!isspace(*i)) | ||||
return false; | return false; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 110 Lines • ▼ Show 20 Lines | if (msgstr_num.size() != dict.get_plural_forms().get_nplural()) | ||||
} | } | ||||
if (has_msgctxt) | if (has_msgctxt) | ||||
dict.add_translation(msgctxt, msgid, msgid_plural, msgstr_num); | dict.add_translation(msgctxt, msgid, msgid_plural, msgstr_num); | ||||
else | else | ||||
dict.add_translation(msgid, msgid_plural, msgstr_num); | dict.add_translation(msgid, msgid_plural, msgstr_num); | ||||
} | } | ||||
if (0) | if ((false)) | ||||
{ | { | ||||
std::cout << (fuzzy?"fuzzy":"not-fuzzy") << std::endl; | std::cout << (fuzzy?"fuzzy":"not-fuzzy") << std::endl; | ||||
std::cout << "msgid \"" << msgid << "\"" << std::endl; | std::cout << "msgid \"" << msgid << "\"" << std::endl; | ||||
std::cout << "msgid_plural \"" << msgid_plural << "\"" << std::endl; | std::cout << "msgid_plural \"" << msgid_plural << "\"" << std::endl; | ||||
for(std::vector<std::string>::size_type i = 0; i < msgstr_num.size(); ++i) | for(std::vector<std::string>::size_type i = 0; i < msgstr_num.size(); ++i) | ||||
std::cout << "msgstr[" << i << "] \"" << conv.convert(msgstr_num[i]) << "\"" << std::endl; | std::cout << "msgstr[" << i << "] \"" << conv.convert(msgstr_num[i]) << "\"" << std::endl; | ||||
std::cout << std::endl; | std::cout << std::endl; | ||||
} | } | ||||
Show All 12 Lines | std::cout << "msgstr[" << i << "] \"" << conv.convert(msgstr_num[i]) << "\"" << std::endl; | ||||
if (use_fuzzy || !fuzzy) | if (use_fuzzy || !fuzzy) | ||||
{ | { | ||||
if (has_msgctxt) | if (has_msgctxt) | ||||
dict.add_translation(msgctxt, msgid, conv.convert(msgstr)); | dict.add_translation(msgctxt, msgid, conv.convert(msgstr)); | ||||
else | else | ||||
dict.add_translation(msgid, conv.convert(msgstr)); | dict.add_translation(msgid, conv.convert(msgstr)); | ||||
} | } | ||||
if (0) | if ((false)) | ||||
{ | { | ||||
std::cout << (fuzzy?"fuzzy":"not-fuzzy") << std::endl; | std::cout << (fuzzy?"fuzzy":"not-fuzzy") << std::endl; | ||||
std::cout << "msgid \"" << msgid << "\"" << std::endl; | std::cout << "msgid \"" << msgid << "\"" << std::endl; | ||||
std::cout << "msgstr \"" << conv.convert(msgstr) << "\"" << std::endl; | std::cout << "msgstr \"" << conv.convert(msgstr) << "\"" << std::endl; | ||||
std::cout << std::endl; | std::cout << std::endl; | ||||
} | } | ||||
} | } | ||||
} | } | ||||
Show All 20 Lines |
Wildfire Games · Phabricator