mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-23 11:04:44 +00:00
GLK: More usage of translations
- Add helpers in Advsys, Comprehend & ZCode to match functionality provided for strings.
This commit is contained in:
parent
dd31b45be3
commit
d2da98d3b0
@ -37,6 +37,13 @@ void GlkInterface::print(const Common::String &msg) {
|
||||
glk_put_string_stream(glk_window_get_stream(_window), msg.c_str());
|
||||
}
|
||||
|
||||
void GlkInterface::print(const Common::U32String &msg) {
|
||||
// Don't print out text if loading a savegame directly from the launcher, since we don't
|
||||
// want any of the intro text displayed by the startup code to show
|
||||
if (_saveSlot == -1)
|
||||
glk_put_string_stream_uni(glk_window_get_stream(_window), msg.c_str());
|
||||
}
|
||||
|
||||
void GlkInterface::print(int number) {
|
||||
Common::String s = Common::String::format("%d", number);
|
||||
print(s);
|
||||
|
@ -50,6 +50,12 @@ protected:
|
||||
*/
|
||||
void print(const Common::String &msg);
|
||||
|
||||
/**
|
||||
* Print a unicode string
|
||||
* @param msg U32String
|
||||
*/
|
||||
void print(const Common::U32String &msg);
|
||||
|
||||
/**
|
||||
* Print a number
|
||||
* @param number Number to print
|
||||
|
@ -22,6 +22,7 @@
|
||||
|
||||
#include "glk/advsys/vm.h"
|
||||
#include "common/translation.h"
|
||||
#include "common/ustr.h"
|
||||
|
||||
namespace Glk {
|
||||
namespace AdvSys {
|
||||
@ -593,7 +594,7 @@ bool VM::getWord(Common::String &line) {
|
||||
_words.push_back(iw);
|
||||
return true;
|
||||
} else {
|
||||
Common::String msg = Common::String::format("I don't know the word \"%s\".\n", iw._text.c_str());
|
||||
Common::U32String msg = Common::U32String::format(_("I don't know the word \"%s\".\n"), iw._text.c_str());
|
||||
print(msg);
|
||||
return false;
|
||||
}
|
||||
|
@ -32,6 +32,8 @@
|
||||
#include "glk/comprehend/pics.h"
|
||||
#include "glk/quetzal.h"
|
||||
#include "common/config-manager.h"
|
||||
#include "common/translation.h"
|
||||
#include "common/ustr.h"
|
||||
#include "engines/util.h"
|
||||
|
||||
namespace Glk {
|
||||
@ -128,6 +130,18 @@ void Comprehend::print(const char *fmt, ...) {
|
||||
msg.c_str());
|
||||
}
|
||||
|
||||
void Comprehend::print(const Common::U32String fmt, ...) {
|
||||
Common::U32String outputMsg;
|
||||
|
||||
va_list argp;
|
||||
va_start(argp, fmt);
|
||||
Common::U32String::vformat(fmt.begin(), fmt.end(), outputMsg, argp);
|
||||
va_end(argp);
|
||||
|
||||
glk_put_string_stream_uni(glk_window_get_stream(_bottomWindow),
|
||||
outputMsg.c_str());
|
||||
}
|
||||
|
||||
void Comprehend::readLine(char *buffer, size_t maxLen) {
|
||||
event_t ev;
|
||||
|
||||
|
@ -131,6 +131,11 @@ public:
|
||||
*/
|
||||
void print(const char *fmt, ...);
|
||||
|
||||
/**
|
||||
* Print unicode-string to the buffer window
|
||||
*/
|
||||
void print(const Common::U32String fmt, ...);
|
||||
|
||||
/**
|
||||
* Read an input line
|
||||
*/
|
||||
|
@ -1330,7 +1330,7 @@ void ComprehendGame::read_input() {
|
||||
|
||||
// Empty line, so toggle picture window visibility
|
||||
g_comprehend->toggleGraphics();
|
||||
g_comprehend->print("Picture window toggled\n");
|
||||
g_comprehend->print(_("Picture window toggled\n"));
|
||||
|
||||
_updateFlags |= UPDATE_GRAPHICS;
|
||||
update_graphics();
|
||||
|
@ -60,7 +60,7 @@ GlkAPI::GlkAPI(OSystem *syst, const GlkGameDescription &gameDesc) :
|
||||
}
|
||||
|
||||
void GlkAPI::glk_exit(void) {
|
||||
glk_put_string("[ press any key to exit ]");
|
||||
glk_put_string_uni(_("[ press any key to exit ]").c_str());
|
||||
_events->waitForPress();
|
||||
|
||||
// Trigger a ScumMVM shutdown of game
|
||||
|
@ -179,6 +179,11 @@ protected:
|
||||
*/
|
||||
void print_string(const char *s);
|
||||
|
||||
/*
|
||||
* Print a unicode string.
|
||||
*/
|
||||
void print_string_uni(const uint32 *s);
|
||||
|
||||
/**
|
||||
* Print an unsigned 32bit number in decimal or hex.
|
||||
*/
|
||||
|
@ -132,6 +132,16 @@ void Processor::print_string(const char *s) {
|
||||
}
|
||||
}
|
||||
|
||||
void Processor::print_string_uni(const uint32 *s) {
|
||||
uint32 c;
|
||||
while ((c = *s++) != 0) {
|
||||
if (c == '\n')
|
||||
new_line();
|
||||
else
|
||||
print_char(c);
|
||||
}
|
||||
}
|
||||
|
||||
void Processor::print_long(uint value, int base) {
|
||||
unsigned long i;
|
||||
char c;
|
||||
|
@ -141,7 +141,7 @@ Common::Error ZCode::saveGameState(int slot, const Common::String &desc, bool is
|
||||
bool success = q.save(*file, this, desc);
|
||||
|
||||
if (!success)
|
||||
print_string("Error writing save file\n");
|
||||
print_string_uni(_("Error writing save file\n").c_str());
|
||||
|
||||
return Common::kNoError;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user