Skip to content

Commit

Permalink
Add placeholder for "AUDIO / ZOOM OPTIONS" message
Browse files Browse the repository at this point in the history
* add support for optional delimiter "\n" to show message on two lines
  so that it can be translated correctly within a 640x480 pixel window
  (that is, the minium screen resolution)
* only process the first delimiter, ignoring all others that may follow
* note that the messages's translation must not begin or end with "\n"
  (otherwise msgfmt will terminate with a fatal error)

Refs ticket:4629
Fixes #345
  • Loading branch information
Forgon2100 authored and past-due committed Jun 11, 2019
1 parent 0ec2355 commit 7073993
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
16 changes: 14 additions & 2 deletions src/frontend.cpp
Expand Up @@ -921,8 +921,20 @@ static bool startAudioAndZoomOptionsMenu()
addMultiBut(psWScreen, FRONTEND_BOTFORM, FRONTEND_QUIT, 10, 10, 30, 29, P_("menu", "Return"), IMAGE_RETURN, IMAGE_RETURN_HI, IMAGE_RETURN_HI);

//add some text down the side of the form
addSideText(FRONTEND_SIDETEXT, FRONTEND_SIDEX, FRONTEND_SIDEY, _("AUDIO / ZOOM OPTIONS"));

// TRANSLATORS: "AUDIO" options determine the volume of game sounds.
// "OPTIONS" means "SETTINGS".
// To break this message into two lines, you can use the delimiter "\n",
// e.g. "AUDIO / ZOOM\nOPTIONS" would show "OPTIONS" in a second line.
WzString messageString = WzString::fromUtf8(_("AUDIO / ZOOM OPTIONS"));
std::vector<WzString> messageStringLines = messageString.split("\n");
addSideText(FRONTEND_SIDETEXT, FRONTEND_SIDEX, FRONTEND_SIDEY, messageStringLines[0].toUtf8().c_str());
// show a second sidetext line if the translation requires it
if (messageStringLines.size() > 1)
{
messageString.remove(0, messageStringLines[0].length() + 1);
addSideText(FRONTEND_MULTILINE_SIDETEXT, FRONTEND_SIDEX + 22, \
FRONTEND_SIDEY, messageString.toUtf8().c_str());
}

return true;
}
Expand Down
1 change: 1 addition & 0 deletions src/frontend.h
Expand Up @@ -159,6 +159,7 @@ enum
FRONTEND_BOTFORM,
FRONTEND_LOGO,
FRONTEND_SIDETEXT, // sideways text
FRONTEND_MULTILINE_SIDETEXT, // sideways text
FRONTEND_SIDETEXT1, // sideways text
FRONTEND_SIDETEXT2, // sideways text
FRONTEND_SIDETEXT3, // sideways text
Expand Down

0 comments on commit 7073993

Please sign in to comment.