Add overloaded translate() that takes CharPointer_UTF8

This commit is contained in:
Vinnie Falco
2013-08-01 09:58:00 -07:00
parent ed82643faf
commit 57b2c3c2e4
2 changed files with 14 additions and 23 deletions

View File

@@ -150,26 +150,12 @@ LocalisedStrings* LocalisedStrings::getCurrentMappings()
return currentMappings; return currentMappings;
} }
String LocalisedStrings::translateWithCurrentMappings (const String& text) String LocalisedStrings::translateWithCurrentMappings (const String& text) { return beast::translate (text); }
{ String LocalisedStrings::translateWithCurrentMappings (const char* text) { return beast::translate (text); }
return beast::translate (text);
}
String LocalisedStrings::translateWithCurrentMappings (const char* text) String translate (const String& text) { return beast::translate (text, text); }
{ String translate (const char* text) { return beast::translate (String (text)); }
return beast::translate (String (text)); String translate (CharPointer_UTF8 text) { return beast::translate (String (text)); }
}
String translate (const String& text)
{
return translate (text, text);
}
String translate (const char* const literal)
{
const String text (literal);
return translate (text, text);
}
String translate (const String& text, const String& resultIfNotFound) String translate (const String& text, const String& resultIfNotFound)
{ {

View File

@@ -65,12 +65,12 @@
printSomething (TRANS("hello")); printSomething (TRANS("hello"));
@endcode @endcode
This macro is used in the Beast classes themselves, so your application has a chance to This macro is used in the Juce classes themselves, so your application has a chance to
intercept and translate any internal Beast text strings that might be shown. (You can easily intercept and translate any internal Juce text strings that might be shown. (You can easily
get a list of all the messages by searching for the TRANS() macro in the Beast source get a list of all the messages by searching for the TRANS() macro in the Juce source
code). code).
*/ */
class BEAST_API LocalisedStrings : LeakChecked <LocalisedStrings> class BEAST_API LocalisedStrings : LeakChecked <LocalisedStrings>
{ {
public: public:
//============================================================================== //==============================================================================
@@ -208,6 +208,11 @@ String translate (const String& stringLiteral);
*/ */
String translate (const char* stringLiteral); String translate (const char* stringLiteral);
/** Uses the LocalisedStrings class to translate the given string literal.
@see LocalisedStrings
*/
String translate (CharPointer_UTF8 stringLiteral);
/** Uses the LocalisedStrings class to translate the given string literal. /** Uses the LocalisedStrings class to translate the given string literal.
@see LocalisedStrings @see LocalisedStrings
*/ */