Fixed names utf8ToWide and wideToUtf8; added convenience functions
taking std:;string and core::stringw as parameter (removed .c_str() in many function calls).
This commit is contained in:
parent
2f126ab226
commit
f81bd5d0c5
@ -607,11 +607,13 @@ core::dimension2d<u32> ScalableFont::getDimension(const wchar_t* text) const
|
||||
|
||||
if (gp_creator->newchar.size() > 0 && !m_is_hollow_copy && m_scale == 1)
|
||||
{
|
||||
Log::debug("ScalableFont::getDimension", "New character(s) %s discoverd, perform lazy loading",
|
||||
StringUtils::wide_to_utf8(gp_creator->getNewChar().c_str()).c_str());
|
||||
Log::debug("ScalableFont::getDimension",
|
||||
"New character(s) %s discoverd, perform lazy loading",
|
||||
StringUtils::wideToUtf8(gp_creator->getNewChar()).c_str());
|
||||
|
||||
if (!GUIEngine::getFont()->lazyLoadChar())
|
||||
Log::error("ScalableFont::lazyLoadChar", "Can't insert new char into glyph pages.");
|
||||
Log::error("ScalableFont::lazyLoadChar",
|
||||
"Can't insert new char into glyph pages.");
|
||||
}
|
||||
}
|
||||
|
||||
@ -736,19 +738,24 @@ void ScalableFont::doDraw(const core::stringw& text,
|
||||
[GUIEngine::getFont()->getSpriteNoFromChar(&c)].Frames[0].textureNumber
|
||||
== SpriteBank->getTextureCount() - 1) //Prevent overwriting texture used by billboard text
|
||||
{
|
||||
Log::debug("ScalableFont::doDraw", "Character used by billboard text is in the last glyph page of normal font."
|
||||
" Create a new glyph page for new characters inserted later to prevent it from being removed.");
|
||||
Log::debug("ScalableFont::doDraw",
|
||||
"Character used by billboard text is in the last "
|
||||
"glyph page of normal font. Create a new glyph "
|
||||
"page for new characters inserted later to prevent "
|
||||
"it from being removed.");
|
||||
GUIEngine::getFont()->forceNewPage();
|
||||
}
|
||||
}
|
||||
|
||||
if (gp_creator->newchar.size() > 0 && !m_is_hollow_copy && m_scale == 1)
|
||||
{
|
||||
Log::debug("ScalableFont::doDraw", "New character(s) %s discoverd, perform lazy loading",
|
||||
StringUtils::wide_to_utf8(gp_creator->getNewChar().c_str()).c_str());
|
||||
Log::debug("ScalableFont::doDraw",
|
||||
"New character(s) %s discoverd, perform lazy loading",
|
||||
StringUtils::wideToUtf8(gp_creator->getNewChar()).c_str());
|
||||
|
||||
if (!GUIEngine::getFont()->lazyLoadChar())
|
||||
Log::error("ScalableFont::lazyLoadChar", "Can't insert new char into glyph pages.");
|
||||
Log::error("ScalableFont::lazyLoadChar",
|
||||
"Can't insert new char into glyph pages.");
|
||||
}
|
||||
}
|
||||
|
||||
@ -773,27 +780,29 @@ void ScalableFont::doDraw(const core::stringw& text,
|
||||
if (charCollector == NULL)
|
||||
{
|
||||
//floor is used to prevent negligible movement when m_scale changes with resolution
|
||||
int Hpadding = floor((float) area.bearingx*
|
||||
(fallback[i] ? m_scale*m_fallback_font_scale : m_scale));
|
||||
int Vpadding = floor((float) area.offsety*
|
||||
(fallback[i] ? m_scale*m_fallback_font_scale : m_scale));
|
||||
int Hpadding = int(floor((float) area.bearingx*
|
||||
(fallback[i] ? m_scale*m_fallback_font_scale : m_scale)) );
|
||||
int Vpadding = int(floor((float) area.offsety*
|
||||
(fallback[i] ? m_scale*m_fallback_font_scale : m_scale)) );
|
||||
offset.X += Hpadding;
|
||||
offset.Y += Vpadding + floor(m_type == T_DIGIT ? 20*m_scale : 0); //Additional offset for digit text
|
||||
// Additional offset for digit text
|
||||
offset.Y += int(Vpadding + floor(m_type == T_DIGIT ? 20*m_scale : 0));
|
||||
offsets.push_back(offset);
|
||||
offset.X -= Hpadding;
|
||||
offset.Y -= Vpadding + floor(m_type == T_DIGIT ? 20*m_scale : 0);
|
||||
offset.Y -= int(Vpadding + floor(m_type == T_DIGIT ? 20*m_scale : 0));
|
||||
}
|
||||
else //Billboard text specific
|
||||
{
|
||||
int Hpadding = floor((float) area.bearingx*
|
||||
(fallback[i] ? m_scale*m_fallback_font_scale : m_scale));
|
||||
int Vpadding = floor((float) area.offsety_bt*
|
||||
(fallback[i] ? m_scale*m_fallback_font_scale : m_scale));
|
||||
int Hpadding = int(floor((float) area.bearingx*
|
||||
(fallback[i] ? m_scale*m_fallback_font_scale : m_scale)) );
|
||||
int Vpadding = int(floor((float) area.offsety_bt*
|
||||
(fallback[i] ? m_scale*m_fallback_font_scale : m_scale)) );
|
||||
offset.X += Hpadding;
|
||||
offset.Y += Vpadding + floor(m_type == T_DIGIT ? 20*m_scale : 0); //Additional offset for digit text
|
||||
// Additional offset for digit text
|
||||
offset.Y += int(Vpadding + floor(m_type == T_DIGIT ? 20*m_scale : 0));
|
||||
offsets.push_back(offset);
|
||||
offset.X -= Hpadding;
|
||||
offset.Y -= Vpadding + floor(m_type == T_DIGIT ? 20*m_scale : 0);
|
||||
offset.Y -= int(Vpadding + floor(m_type == T_DIGIT ? 20*m_scale : 0));
|
||||
}
|
||||
// Invisible character. add something to the array anyway so that
|
||||
// indices from the various arrays remain in sync
|
||||
|
@ -282,7 +282,7 @@ bool CGUIEditBox::processKey(const SEvent& event)
|
||||
|
||||
core::stringw s;
|
||||
s = Text.subString(realmbgn, realmend - realmbgn).c_str();
|
||||
Operator->copyToClipboard(StringUtils::wide_to_utf8(s.c_str()).c_str());
|
||||
Operator->copyToClipboard(StringUtils::wideToUtf8(s).c_str());
|
||||
}
|
||||
break;
|
||||
case KEY_KEY_X:
|
||||
@ -295,7 +295,7 @@ bool CGUIEditBox::processKey(const SEvent& event)
|
||||
// copy
|
||||
core::stringw sc;
|
||||
sc = Text.subString(realmbgn, realmend - realmbgn).c_str();
|
||||
Operator->copyToClipboard(StringUtils::wide_to_utf8(sc.c_str()).c_str());
|
||||
Operator->copyToClipboard(StringUtils::wideToUtf8(sc).c_str());
|
||||
|
||||
if (isEnabled())
|
||||
{
|
||||
@ -331,13 +331,13 @@ bool CGUIEditBox::processKey(const SEvent& event)
|
||||
{
|
||||
// insert text
|
||||
core::stringw s = Text.subString(0, CursorPos);
|
||||
s.append(StringUtils::utf8_to_wide(p));
|
||||
s.append(StringUtils::utf8ToWide(p));
|
||||
s.append( Text.subString(CursorPos, Text.size()-CursorPos) );
|
||||
|
||||
if (!Max || s.size()<=Max) // thx to Fish FH for fix
|
||||
{
|
||||
Text = s;
|
||||
s = StringUtils::utf8_to_wide(p);
|
||||
s = StringUtils::utf8ToWide(p);
|
||||
CursorPos += s.size();
|
||||
}
|
||||
}
|
||||
@ -346,13 +346,13 @@ bool CGUIEditBox::processKey(const SEvent& event)
|
||||
// replace text
|
||||
|
||||
core::stringw s = Text.subString(0, realmbgn);
|
||||
s.append(StringUtils::utf8_to_wide(p));
|
||||
s.append(StringUtils::utf8ToWide(p));
|
||||
s.append( Text.subString(realmend, Text.size()-realmend) );
|
||||
|
||||
if (!Max || s.size()<=Max) // thx to Fish FH for fix
|
||||
{
|
||||
Text = s;
|
||||
s = StringUtils::utf8_to_wide(p);
|
||||
s = StringUtils::utf8ToWide(p);
|
||||
CursorPos = realmbgn + s.size();
|
||||
}
|
||||
}
|
||||
|
@ -176,7 +176,7 @@ Online::XMLRequest* ServersManager::getLANRefreshRequest() const
|
||||
uint8_t name_len = s.getUInt8(0);
|
||||
std::string name = s.getString(1, name_len);
|
||||
irr::core::stringw name_w =
|
||||
StringUtils::utf8_to_wide(name.c_str());
|
||||
StringUtils::utf8ToWide(name);
|
||||
uint8_t max_players = s.getUInt8(1+name_len );
|
||||
uint8_t players = s.getUInt8(1+name.size()+1);
|
||||
uint32_t my_ip = s.getUInt32(1+name.size()+2);
|
||||
|
@ -515,8 +515,7 @@ void STKHost::handleLANRequests()
|
||||
{
|
||||
Log::verbose("STKHost", "Received LAN server query");
|
||||
std::string name =
|
||||
StringUtils::wide_to_utf8(NetworkConfig::get()
|
||||
->getServerName().c_str());
|
||||
StringUtils::wideToUtf8(NetworkConfig::get()->getServerName());
|
||||
// Avoid buffer overflows
|
||||
if (name.size() > 255)
|
||||
name = name.substr(0, 255);
|
||||
|
@ -55,14 +55,14 @@ namespace Scripting
|
||||
DeviceConfig* config = device->getConfiguration();
|
||||
PlayerAction ScriptAction = (PlayerAction)Enum_value;
|
||||
irr::core::stringw control = config->getBindingAsString(ScriptAction);
|
||||
std::string key = StringUtils::wide_to_utf8(control.c_str());
|
||||
std::string key = StringUtils::wideToUtf8(control);
|
||||
return key;
|
||||
}
|
||||
|
||||
/** Show the specified message in a popup */
|
||||
void displayModalMessage(std::string* input)
|
||||
{
|
||||
irr::core::stringw out = StringUtils::utf8_to_wide(input->c_str());
|
||||
irr::core::stringw out = StringUtils::utf8ToWide(*input);
|
||||
new TutorialMessageDialog((out), true);
|
||||
}
|
||||
|
||||
@ -74,7 +74,7 @@ namespace Scripting
|
||||
/** Display text in the center of the screen for a few seconds */
|
||||
void displayOverlayMessage(std::string* input)
|
||||
{
|
||||
irr::core::stringw msg = StringUtils::utf8_to_wide(input->c_str());
|
||||
irr::core::stringw msg = StringUtils::utf8ToWide(*input);
|
||||
std::vector<core::stringw> parts =
|
||||
StringUtils::split(msg, '\n', false);
|
||||
|
||||
@ -92,7 +92,7 @@ namespace Scripting
|
||||
{
|
||||
irr::core::stringw out = translations->fribidize(translations->w_gettext(input->c_str()));
|
||||
|
||||
return StringUtils::wide_to_utf8(out.c_str());
|
||||
return StringUtils::wideToUtf8(out);
|
||||
}
|
||||
|
||||
/** Translate string and insert values. e.g. GUI::translate("Hello %s !", "John") */
|
||||
@ -101,11 +101,11 @@ namespace Scripting
|
||||
irr::core::stringw out = translations->w_gettext(formatString->c_str());
|
||||
|
||||
out = StringUtils::insertValues(out,
|
||||
StringUtils::utf8_to_wide(arg1->c_str()));
|
||||
StringUtils::utf8ToWide(*arg1));
|
||||
|
||||
out = translations->fribidize(out);
|
||||
|
||||
return StringUtils::wide_to_utf8(out.c_str());
|
||||
return StringUtils::wideToUtf8(out);
|
||||
}
|
||||
|
||||
/** Translate string and insert values. e.g. GUI::translate("Hello %s !", "John") */
|
||||
@ -114,12 +114,12 @@ namespace Scripting
|
||||
irr::core::stringw out = translations->w_gettext(formatString->c_str());
|
||||
|
||||
out = StringUtils::insertValues(out,
|
||||
StringUtils::utf8_to_wide(arg1->c_str()),
|
||||
StringUtils::utf8_to_wide(arg2->c_str()));
|
||||
StringUtils::utf8ToWide(*arg1),
|
||||
StringUtils::utf8ToWide(*arg2));
|
||||
|
||||
out = translations->fribidize(out);
|
||||
|
||||
return StringUtils::wide_to_utf8(out.c_str());
|
||||
return StringUtils::wideToUtf8(out);
|
||||
}
|
||||
|
||||
/** Translate string and insert values. e.g. GUI::translate("Hello %s !", "John") */
|
||||
@ -129,13 +129,13 @@ namespace Scripting
|
||||
irr::core::stringw out = translations->w_gettext(formatString->c_str());
|
||||
|
||||
out = StringUtils::insertValues(out,
|
||||
StringUtils::utf8_to_wide(arg1->c_str()),
|
||||
StringUtils::utf8_to_wide(arg2->c_str()),
|
||||
StringUtils::utf8_to_wide(arg3->c_str()));
|
||||
StringUtils::utf8ToWide(*arg1),
|
||||
StringUtils::utf8ToWide(*arg2),
|
||||
StringUtils::utf8ToWide(*arg3));
|
||||
|
||||
out = translations->fribidize(out);
|
||||
|
||||
return StringUtils::wide_to_utf8(out.c_str());
|
||||
return StringUtils::wideToUtf8(out);
|
||||
}
|
||||
/** @}*/
|
||||
/** @}*/
|
||||
|
@ -86,7 +86,7 @@ namespace Scripting
|
||||
|
||||
void createTextBillboard(std::string* text, SimpleVec3* location)
|
||||
{
|
||||
core::stringw wtext = StringUtils::utf8_to_wide(text->c_str());
|
||||
core::stringw wtext = StringUtils::utf8ToWide(*text);
|
||||
core::dimension2d<u32> textsize = GUIEngine::getHighresDigitFont()
|
||||
->getDimension(wtext.c_str());
|
||||
|
||||
|
@ -52,53 +52,58 @@ namespace Scripting
|
||||
/** Replaces placeholders with values. Note, in angelscript, omit the trailing number.
|
||||
* e.g. Utils::insertValues("Hello %s !", "world");
|
||||
*/
|
||||
std::string insertValues(std::string* formatString, std::string* arg1)
|
||||
std::string insertValues(std::string* format_string, std::string* arg1)
|
||||
{
|
||||
irr::core::stringw out = StringUtils::insertValues(StringUtils::utf8_to_wide(formatString->c_str()),
|
||||
StringUtils::utf8_to_wide(arg1->c_str()));
|
||||
irr::core::stringw out =
|
||||
StringUtils::insertValues(StringUtils::utf8ToWide(*format_string),
|
||||
StringUtils::utf8ToWide(*arg1));
|
||||
|
||||
return StringUtils::wide_to_utf8(out.c_str());
|
||||
return StringUtils::wideToUtf8(out);
|
||||
}
|
||||
|
||||
/** Replaces placeholders with values. Note, in angelscript, omit the trailing number.
|
||||
* e.g. Utils::insertValues("Hello %s %s !", "John", "Doe");
|
||||
*/
|
||||
std::string insertValues(std::string* formatString, std::string* arg1, std::string* arg2)
|
||||
std::string insertValues(std::string* format_string, std::string* arg1, std::string* arg2)
|
||||
{
|
||||
irr::core::stringw out = StringUtils::insertValues(StringUtils::utf8_to_wide(formatString->c_str()),
|
||||
StringUtils::utf8_to_wide(arg1->c_str()),
|
||||
StringUtils::utf8_to_wide(arg2->c_str()));
|
||||
irr::core::stringw out =
|
||||
StringUtils::insertValues(StringUtils::utf8ToWide(*format_string),
|
||||
StringUtils::utf8ToWide(*arg1),
|
||||
StringUtils::utf8ToWide(*arg2));
|
||||
|
||||
return StringUtils::wide_to_utf8(out.c_str());
|
||||
return StringUtils::wideToUtf8(out);
|
||||
}
|
||||
|
||||
/** Replaces placeholders with values. Note, in angelscript, omit the trailing number.
|
||||
* e.g. Utils::insertValues("Hello %s %s %s !", "Mr", "John", "Doe");
|
||||
*/
|
||||
std::string insertValues(std::string* formatString, std::string* arg1, std::string* arg2,
|
||||
std::string insertValues(std::string* format_string, std::string* arg1, std::string* arg2,
|
||||
std::string* arg3)
|
||||
{
|
||||
irr::core::stringw out = StringUtils::insertValues(StringUtils::utf8_to_wide(formatString->c_str()),
|
||||
StringUtils::utf8_to_wide(arg1->c_str()),
|
||||
StringUtils::utf8_to_wide(arg2->c_str()),
|
||||
StringUtils::utf8_to_wide(arg3->c_str()));
|
||||
irr::core::stringw out =
|
||||
StringUtils::insertValues(StringUtils::utf8ToWide(*format_string),
|
||||
StringUtils::utf8ToWide(*arg1),
|
||||
StringUtils::utf8ToWide(*arg2),
|
||||
StringUtils::utf8ToWide(*arg3));
|
||||
|
||||
return StringUtils::wide_to_utf8(out.c_str());
|
||||
return StringUtils::wideToUtf8(out);
|
||||
}
|
||||
|
||||
/** Replaces placeholders with values. Note, in angelscript, omit the trailing number.
|
||||
* e.g. Utils::insertValues("%s %s %s %s !", "Hello", "Mr", "John", "Doe");
|
||||
*/
|
||||
std::string insertValues(std::string* formatString, std::string* arg1, std::string* arg2,
|
||||
std::string* arg3, std::string* arg4)
|
||||
std::string insertValues(std::string* format_string, std::string* arg1,
|
||||
std::string* arg2, std::string* arg3,
|
||||
std::string* arg4)
|
||||
{
|
||||
irr::core::stringw out = StringUtils::insertValues(StringUtils::utf8_to_wide(formatString->c_str()),
|
||||
StringUtils::utf8_to_wide(arg1->c_str()),
|
||||
StringUtils::utf8_to_wide(arg2->c_str()),
|
||||
StringUtils::utf8_to_wide(arg3->c_str()),
|
||||
StringUtils::utf8_to_wide(arg4->c_str()));
|
||||
irr::core::stringw out =
|
||||
StringUtils::insertValues(StringUtils::utf8ToWide(*format_string),
|
||||
StringUtils::utf8ToWide(*arg1),
|
||||
StringUtils::utf8ToWide(*arg2),
|
||||
StringUtils::utf8ToWide(*arg3),
|
||||
StringUtils::utf8ToWide(*arg4));
|
||||
|
||||
return StringUtils::wide_to_utf8(out.c_str());
|
||||
return StringUtils::wideToUtf8(out);
|
||||
}
|
||||
|
||||
/** Runs the script function specified by the given string */
|
||||
|
@ -198,7 +198,7 @@ void OptionsScreenUI::init()
|
||||
{
|
||||
std::string code_name = (*lang_list)[n];
|
||||
std::string s_name = tinygettext::Language::from_name(code_name).get_name();
|
||||
core::stringw nice_name = StringUtils::utf8_to_wide(s_name.c_str());
|
||||
core::stringw nice_name = StringUtils::utf8ToWide(s_name);
|
||||
nice_lang_list.push_back(nice_name);
|
||||
nice_name_2_id[nice_name] = code_name;
|
||||
}
|
||||
|
@ -221,7 +221,7 @@ std::set<wchar_t> Dictionary::get_all_used_chars()
|
||||
const std::vector<std::string>& msgstrs = i->second;
|
||||
for (unsigned int k = 0; k < msgstrs.size(); k++)
|
||||
{
|
||||
irr::core::stringw ws = translations->fribidize((StringUtils::utf8_to_wide(msgstrs[k].c_str())).c_str());
|
||||
irr::core::stringw ws = translations->fribidize((StringUtils::utf8ToWide(msgstrs[k])).c_str());
|
||||
for (unsigned int l = 0; l < ws.size(); ++l)
|
||||
UsedChars.insert(ws[l]);
|
||||
}
|
||||
@ -234,7 +234,7 @@ std::set<wchar_t> Dictionary::get_all_used_chars()
|
||||
const std::vector<std::string>& msgstrs = j->second;
|
||||
for (unsigned int k = 0; k < msgstrs.size(); k++)
|
||||
{
|
||||
irr::core::stringw ws = translations->fribidize((StringUtils::utf8_to_wide(msgstrs[k].c_str())).c_str());
|
||||
irr::core::stringw ws = translations->fribidize((StringUtils::utf8ToWide(msgstrs[k])).c_str());
|
||||
for (unsigned int l = 0; l < ws.size(); ++l)
|
||||
UsedChars.insert(ws[l]);
|
||||
}
|
||||
|
@ -686,7 +686,7 @@ namespace StringUtils
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
std::string wide_to_utf8(const wchar_t* input)
|
||||
std::string wideToUtf8(const wchar_t* input)
|
||||
{
|
||||
static std::vector<char> utf8line;
|
||||
utf8line.clear();
|
||||
@ -695,11 +695,11 @@ namespace StringUtils
|
||||
utf8line.push_back(0);
|
||||
|
||||
return std::string(&utf8line[0]);
|
||||
}
|
||||
} // wideToUtf8
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
irr::core::stringw utf8_to_wide(const char* input)
|
||||
irr::core::stringw utf8ToWide(const char* input)
|
||||
{
|
||||
static std::vector<wchar_t> utf16line;
|
||||
utf16line.clear();
|
||||
@ -708,7 +708,7 @@ namespace StringUtils
|
||||
utf16line.push_back(0);
|
||||
|
||||
return irr::core::stringw(&utf16line[0]);
|
||||
}
|
||||
} // utf8ToWide
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
/** Converts a version string (in the form of 'X.Y.Za-rcU' into an
|
||||
|
@ -226,8 +226,20 @@ namespace StringUtils
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
std::string wide_to_utf8(const wchar_t* input);
|
||||
irr::core::stringw utf8_to_wide(const char* input);
|
||||
irr::core::stringw utf8ToWide(const char* input);
|
||||
std::string wideToUtf8(const wchar_t* input);
|
||||
// ------------------------------------------------------------------------
|
||||
/** Converts a utf8-encoded std::string into an irrlicht wide string. */
|
||||
static irr::core::stringw utf8ToWide(const std::string &input)
|
||||
{
|
||||
return utf8ToWide(input.c_str());
|
||||
} // utf8ToWide
|
||||
// ------------------------------------------------------------------------
|
||||
/** Converts the irrlicht wide string to an utf8-encoded std::string. */
|
||||
static std::string wideToUtf8(const irr::core::stringw& input)
|
||||
{
|
||||
return wideToUtf8(input.c_str());
|
||||
} // wideToUtf8
|
||||
|
||||
} // namespace StringUtils
|
||||
|
||||
|
@ -449,7 +449,7 @@ bool Translations::isRTLText(const wchar_t *in_ptr)
|
||||
*/
|
||||
const wchar_t* Translations::w_gettext(const wchar_t* original, const char* context)
|
||||
{
|
||||
std::string in = StringUtils::wide_to_utf8(original);
|
||||
std::string in = StringUtils::wideToUtf8(original);
|
||||
return w_gettext(in.c_str(), context);
|
||||
}
|
||||
|
||||
@ -473,7 +473,7 @@ const wchar_t* Translations::w_gettext(const char* original, const char* context
|
||||
if (original_t == original)
|
||||
{
|
||||
static irr::core::stringw converted_string;
|
||||
converted_string = StringUtils::utf8_to_wide(original);
|
||||
converted_string = StringUtils::utf8ToWide(original);
|
||||
|
||||
#if TRANSLATE_VERBOSE
|
||||
std::wcout << L" translation : " << converted_string << std::endl;
|
||||
@ -485,7 +485,7 @@ const wchar_t* Translations::w_gettext(const char* original, const char* context
|
||||
//for (int n=0;; n+=4)
|
||||
|
||||
static core::stringw original_tw;
|
||||
original_tw = StringUtils::utf8_to_wide(original_t.c_str());
|
||||
original_tw = StringUtils::utf8ToWide(original_t);
|
||||
|
||||
const wchar_t* out_ptr = original_tw.c_str();
|
||||
if (REMOVE_BOM) out_ptr++;
|
||||
@ -506,8 +506,8 @@ const wchar_t* Translations::w_gettext(const char* original, const char* context
|
||||
*/
|
||||
const wchar_t* Translations::w_ngettext(const wchar_t* singular, const wchar_t* plural, int num, const char* context)
|
||||
{
|
||||
std::string in = StringUtils::wide_to_utf8(singular);
|
||||
std::string in2 = StringUtils::wide_to_utf8(plural);
|
||||
std::string in = StringUtils::wideToUtf8(singular);
|
||||
std::string in2 = StringUtils::wideToUtf8(plural);
|
||||
return w_ngettext(in.c_str(), in2.c_str(), num, context);
|
||||
}
|
||||
|
||||
@ -524,8 +524,7 @@ const wchar_t* Translations::w_ngettext(const char* singular, const char* plural
|
||||
m_dictionary.translate_plural(singular, plural, num) :
|
||||
m_dictionary.translate_ctxt_plural(context, singular, plural, num));
|
||||
|
||||
static core::stringw str_buffer;
|
||||
str_buffer = StringUtils::utf8_to_wide(res.c_str());
|
||||
static core::stringw str_buffer = StringUtils::utf8ToWide(res);
|
||||
const wchar_t* out_ptr = str_buffer.c_str();
|
||||
if (REMOVE_BOM) out_ptr++;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user