Encapsulate some Pango markup in WHISPER and ASIDE macros...

...so these conventions can be tweaked without changing translatable
strings.
This commit is contained in:
Eric S. Raymond 2009-03-29 22:11:52 +00:00
parent dfbd3e029b
commit 770b17e98d
5 changed files with 18 additions and 7 deletions

View file

@ -128,11 +128,11 @@
[/message]
[message]
speaker=Wak-Rano
message= _ "Hmm... I know. We will make a pact to destroy these men, and continue our fight later. (Perhaps he will die, and I will win our battle without fighting.)"
message= _ "Hmm... I know. We will make a pact to destroy these men, and continue our fight later. " + {ASIDE "Perhaps he will die, and I will win our battle without fighting."}
[/message]
[message]
speaker=Mal-Arnai
message= _ "Very well, we are allies, for now. (This foolish orc will surely perish.)"
message= _ "Very well, we are allies, for now. " + {ASIDE _"This foolish orc will surely perish."}
[/message]
[/event]

View file

@ -163,12 +163,12 @@
[message]
speaker="Aiglondur"
message=_"<small>(Psst, Angarthing...Karrag and those dwarves on the dais, they're all masked.)</small>"
message={WHISPER _"Psst, Angarthing...Karrag and those dwarves on the dais, they're all <i>masked</i>."}
[/message]
[message]
speaker="Angarthing"
message=_"<small>(I see it. There is something very wrong here.)</small>"
message={WHISPER _"I see it. There is something very wrong here."}
[/message]
[message]

View file

@ -210,7 +210,7 @@
[/message]
[message]
speaker=Lady Jessica
message= _ "(whispered) I don't think diplomacy is going to work."
message={WHISPER "I don't think diplomacy is going to work."}
[/message]
[message]
speaker=Gerrick

View file

@ -495,3 +495,14 @@
message={TEXT}
[/wml_message]
#enddef
# Encapsulate text in conventional markup for characters whispering.
# We do this so whispers can be restyled by tweaking this markup
#define WHISPER TEXT
"<small>(" + {TEXT} + ")</small>"#enddef
# Encapsulate text in conventional markup for characters speaking aside.
# We do this so whispers can be restyled by tweaking this markup
#define ASIDE TEXT
"<i>(" + {TEXT} + ")</i>"#enddef

View file

@ -669,7 +669,7 @@ def pangoize(message, filename, line):
"Pango conversion of old-style Wesnoth markup."
if '&' in message:
amper = message.find('&')
if message[amper:amper+5] != "&amp;":
if message[amper:amper+1].isspace():
message = message[:amper] + "&amp;" + message[amper+1:]
if re.search("<[0-9]+,[0-9]+,[0-9]+>", message):
print '"%s", line %d: color spec in line requires manual fix.' % (filename, line)
@ -1015,7 +1015,7 @@ def sanity_check(filename, lines):
# Doing a better job would require tokenizing to pick up the
# string boundaries. I'd do it, but AI0867 is already working
# on a parser-based wmllint.
if '{' in value and "+" not in value:
if '{' in value and "+" not in value and value.find('{') > value.find("_"):
print '"%s", line %d: macro reference in translatable string'\
% (filename, i+1)
#if future and re.search("[.,!?] ", lines[i]):