Enabke wmllint to check for newlines in message strings,
...and implement a new kind of magic comment to suppress the warning.
This commit is contained in:
parent
af814596d1
commit
15187c0e65
14 changed files with 78 additions and 9 deletions
|
@ -60,10 +60,12 @@
|
|||
[/scroll_to]
|
||||
[message]
|
||||
speaker=narrator
|
||||
#wmllint: display on
|
||||
message= _ "The rules of the duel are these:
|
||||
You may recruit or recall up to 6 units.
|
||||
At the end of your first turn, your keep will disappear, and you must battle with whatever troops you have at that time.
|
||||
The first leader to fall loses the duel."
|
||||
#wmllint: display off
|
||||
image=wesnoth-icon.png
|
||||
[/message]
|
||||
[/event]
|
||||
|
|
|
@ -494,8 +494,10 @@
|
|||
[message]
|
||||
speaker=narrator
|
||||
image="scenery/signpost.png"
|
||||
#wmllint: display on
|
||||
message= _ "NE - Dan'Tonk
|
||||
SE - Fort Tahn"
|
||||
#wmllint: display off
|
||||
[/message]
|
||||
[message]
|
||||
description=Konrad
|
||||
|
|
|
@ -392,8 +392,10 @@
|
|||
[/message]
|
||||
[message]
|
||||
description=Keh Ohn
|
||||
#wmllint: display on
|
||||
message= _ "(releasing a torrent of fire towards Konrad and Li'sar)
|
||||
Soooo... It is you who sent your subordinates to attack us. Now when we've destroyed them, you come to do the job yourselves."
|
||||
#wmllint: display off
|
||||
[/message]
|
||||
[message]
|
||||
description=Konrad
|
||||
|
|
|
@ -122,8 +122,7 @@
|
|||
|
||||
[message]
|
||||
description="Aiglondur"
|
||||
message=_"Up axes! We will be the Northern Alliance's arm today,
|
||||
and kill or scatter these invaders."
|
||||
message=_"Up axes! We will be the Northern Alliance's arm today, and kill or scatter these invaders."
|
||||
[/message]
|
||||
[message]
|
||||
description="Bashnark"
|
||||
|
|
|
@ -236,7 +236,7 @@
|
|||
[/message]
|
||||
[message]
|
||||
speaker="Angarthing"
|
||||
message=_"What is your name, masked one? Will you stand behind your deed? I am a witness."
|
||||
message=_"What is your name, masked one? Will you stand behind your deed? I am a witness."
|
||||
[/message]
|
||||
[message]
|
||||
speaker="Masked Dwarf"
|
||||
|
|
|
@ -271,8 +271,7 @@
|
|||
|
||||
[message]
|
||||
speaker=Dulcatulos
|
||||
message=_"Aye. Toils over it in a workshop in the underlevels with his personal followers. He has promised all of us that the Hammer's power
|
||||
will smash and scatter all our enemies."
|
||||
message=_"Aye. Toils over it in a workshop in the underlevels with his personal followers. He has promised all of us that the Hammer's power will smash and scatter all our enemies."
|
||||
[/message]
|
||||
|
||||
[message]
|
||||
|
|
|
@ -153,8 +153,7 @@
|
|||
|
||||
[message]
|
||||
description="Pelias"
|
||||
message=_"I have been on your track for weeks. Word of your rout of
|
||||
Tan-Malgar and his allies spread, and reached Tallin. You did the Alliance better service than you knew that day; Tan-Malgar had exchanged messages with certain orcish chieftains within the Alliance, and your victory prevented a dangerous revolt."
|
||||
message=_"I have been on your track for weeks. Word of your rout of Tan-Malgar and his allies spread, and reached Tallin. You did the Alliance better service than you knew that day; Tan-Malgar had exchanged messages with certain orcish chieftains within the Alliance, and your victory prevented a dangerous revolt."
|
||||
[/message]
|
||||
|
||||
[message]
|
||||
|
|
|
@ -228,8 +228,10 @@
|
|||
[message]
|
||||
speaker=narrator
|
||||
image=scenery/signpost.png
|
||||
#wmllint: display on
|
||||
message= _ "SE - The River Road.
|
||||
SW - The Midlands."
|
||||
#wmllint: display off
|
||||
image=wesnoth-icon.png
|
||||
[/message]
|
||||
[allow_undo]
|
||||
|
|
|
@ -353,8 +353,10 @@
|
|||
|
||||
[message]
|
||||
speaker=narrator
|
||||
#wmllint: display on
|
||||
message= _ "SW - The Oldwood Forest.
|
||||
Enter at Your Own Risk!"
|
||||
#wmllint: display off
|
||||
image=scenery/signpost.png
|
||||
[/message]
|
||||
[allow_undo]
|
||||
|
|
|
@ -230,16 +230,20 @@ For this tutorial, you are playing Li'sar. " +
|
|||
#wmlindent: start ignoring
|
||||
{GENDER ([message]
|
||||
speaker=narrator
|
||||
#wmllint: display on
|
||||
message=_ "*You have selected Konrad.
|
||||
The places he could move to are highlighted." +
|
||||
_ "
|
||||
*Left click or any key to continue..."
|
||||
#wmllint: display off
|
||||
[/message]) ([message]
|
||||
speaker=narrator
|
||||
#wmllint: display on
|
||||
message=_ "*You have selected Li'sar.
|
||||
The places she could move to are highlighted." +
|
||||
_ "
|
||||
*Left click or any key to continue..."
|
||||
#wmllint: display off
|
||||
[/message])}
|
||||
#wmlindent: stop ignoring
|
||||
{LABEL (_ "HERE") {MARKER_LOC}}
|
||||
|
@ -292,9 +296,11 @@ The places she could move to are highlighted." +
|
|||
[redraw][/redraw]
|
||||
[message]
|
||||
speaker=narrator
|
||||
#wmllint: display on
|
||||
message=_ "*Oops!
|
||||
You moved to the wrong place! After this message, you can press 'u' to Undo, then try again.
|
||||
*Left click or any key to continue..."
|
||||
#wmllint: display off
|
||||
[/message]
|
||||
[/then]
|
||||
[/if]
|
||||
|
@ -478,9 +484,11 @@ You moved to the wrong place! After this message, you can press 'u' to Undo, the
|
|||
[/message]
|
||||
[message]
|
||||
description=Delfador
|
||||
#wmllint: display on
|
||||
message=_ "Yes: it's a magical quintain.
|
||||
See the 3-5 in its description? The first number tells you that it does three points of damage when it hits. The second tells you that it gets five chances to hit you per combat round.
|
||||
If it hits every time, you'll drop from $student_hp to $future_hp hit points. Brace yourself!"
|
||||
#wmllint: display off
|
||||
[/message]
|
||||
{PRINT (_ "Click on the End Turn button on the bottom right")}
|
||||
[/event]
|
||||
|
@ -533,8 +541,10 @@ If it hits every time, you'll drop from $student_hp to $future_hp hit points. Br
|
|||
{NODEST}
|
||||
[message]
|
||||
speaker=narrator
|
||||
#wmllint: display on
|
||||
message=_ "You now 'own' this village: you can see it flies your flag, and soon a '1' will appear next to the house icon at the top of screen. Villages give gold: every turn you gain two gold, plus one for every village you own.
|
||||
*Left click or any key to continue..."
|
||||
#wmllint: display off
|
||||
[/message]
|
||||
{PRINT (_"Click on the End Turn button")}
|
||||
[/event]
|
||||
|
@ -605,8 +615,10 @@ If it hits every time, you'll drop from $student_hp to $future_hp hit points. Br
|
|||
[redraw][/redraw]
|
||||
[message]
|
||||
speaker=narrator
|
||||
#wmllint: display on
|
||||
message=_ "Whenever you're on a keep, you can recruit into castle tiles around it, by right-clicking and selecting 'Recruit'. This time you will only be given one type of unit to choose: select it.
|
||||
*Left click or any key to continue..."
|
||||
#wmllint: display off
|
||||
[/message]
|
||||
|
||||
{PRINT (_"Right click on one castle tile and select Recruit")}
|
||||
|
@ -628,9 +640,11 @@ If it hits every time, you'll drop from $student_hp to $future_hp hit points. Br
|
|||
[redraw][/redraw]
|
||||
[message]
|
||||
speaker=narrator
|
||||
#wmllint: display on
|
||||
message=_ "These newly recruited units can do nothing this turn: you will control them next turn.
|
||||
Note: after this dialog, you can move the mouse over a unit to see a description on the right of the screen.
|
||||
*Left click or any key to continue..."
|
||||
#wmllint: display off
|
||||
[/message]
|
||||
# They can move to the village if they're smart
|
||||
{NODEST}
|
||||
|
@ -658,9 +672,11 @@ Note: after this dialog, you can move the mouse over a unit to see a description
|
|||
[redraw][/redraw]
|
||||
[message]
|
||||
speaker=narrator
|
||||
#wmllint: display on
|
||||
message=_ "These newly recruited units can do nothing this turn: you will control them next turn.
|
||||
Note: after this dialog, you can move the mouse over a unit to see a description on the right of the screen.
|
||||
*Left click or any key to continue..."
|
||||
#wmllint: display off
|
||||
[/message]
|
||||
# They can move to the village if they're smart
|
||||
{NODEST}
|
||||
|
@ -684,8 +700,10 @@ Note: after this dialog, you can move the mouse over a unit to see a description
|
|||
[/message]
|
||||
[message]
|
||||
description=Delfador
|
||||
#wmllint: display on
|
||||
message=_ "Yes, if a unit doesn't do anything for a turn, it will slowly heal.
|
||||
But before you send your fighters against the quintain, you should know they have two kinds of attack..."
|
||||
#wmllint: display off
|
||||
[/message]
|
||||
[message]
|
||||
description=student
|
||||
|
@ -738,8 +756,10 @@ But before you send your fighters against the quintain, you should know they hav
|
|||
[else]
|
||||
[message]
|
||||
description=Delfador
|
||||
#wmllint: display on
|
||||
message=_ "Your elf used a sword (5-4, or 5 damage, 4 attacks), which is a melee attack, so the quintain defended with its melee attack (3-5). The ranged attack was safer.
|
||||
End your turn, then attack again."
|
||||
#wmllint: display off
|
||||
[/message]
|
||||
{PRINT (_"Click on the End Turn button")}
|
||||
[/else]
|
||||
|
@ -748,8 +768,10 @@ End your turn, then attack again."
|
|||
[else]
|
||||
[message]
|
||||
description=Delfador
|
||||
#wmllint: display on
|
||||
message=_ "Your elf used a sword (5-4, or 5 damage, 4 attacks), which is a melee attack, so the quintain defended with its melee attack (3-5).
|
||||
You should tell the other Elf to use the bow."
|
||||
#wmllint: display off
|
||||
[/message]
|
||||
{PRINT (_"Attack with the other Elf")}
|
||||
[event]
|
||||
|
@ -787,8 +809,10 @@ You should tell the other Elf to use the bow."
|
|||
[else]
|
||||
[message]
|
||||
description=Delfador
|
||||
#wmllint: display on
|
||||
message=_ "Your elf used a bow, which is a ranged attack (3-3, or 3 damage, 3 attacks). The quintain has no ranged attack, only a melee attack, so it could not defend itself.
|
||||
End your turn, then attack again."
|
||||
#wmllint: display off
|
||||
[/message]
|
||||
{PRINT (_"Click on the End Turn button")}
|
||||
[/else]
|
||||
|
@ -826,8 +850,10 @@ End your turn, then attack again."
|
|||
[/message]
|
||||
[message]
|
||||
speaker=narrator
|
||||
#wmllint: display on
|
||||
message=_ "Note:
|
||||
You can right click on a unit to see a detailed Unit Description."
|
||||
#wmllint: display off
|
||||
[/message]
|
||||
[/event]
|
||||
|
||||
|
@ -841,8 +867,10 @@ You can right click on a unit to see a detailed Unit Description."
|
|||
[then]
|
||||
[message]
|
||||
speaker=narrator
|
||||
#wmllint: display on
|
||||
message=_ "Note:
|
||||
Remember to pull back wounded units into villages, and recruit more if you need. Take special care of units with the highest experience points (XP)."
|
||||
#wmllint: display off
|
||||
[/message]
|
||||
[/then]
|
||||
[/if]
|
||||
|
@ -858,8 +886,10 @@ Remember to pull back wounded units into villages, and recruit more if you need.
|
|||
[then]
|
||||
[message]
|
||||
speaker=narrator
|
||||
#wmllint: display on
|
||||
message=_ "Note:
|
||||
These dummies only attack if you are a single tile away. With care, you should be able to kill them one at a time."
|
||||
#wmllint: display off
|
||||
[/message]
|
||||
[/then]
|
||||
[/if]
|
||||
|
@ -869,8 +899,10 @@ These dummies only attack if you are a single tile away. With care, you should b
|
|||
name="turn 9"
|
||||
[message]
|
||||
speaker=narrator
|
||||
#wmllint: display on
|
||||
message=_ "Note:
|
||||
Each village you own can support a single unit for free. After that, each unit costs you one gold per turn."
|
||||
#wmllint: display off
|
||||
[/message]
|
||||
[/event]
|
||||
|
||||
|
@ -878,8 +910,10 @@ Each village you own can support a single unit for free. After that, each unit c
|
|||
name="turn 10"
|
||||
[message]
|
||||
speaker=narrator
|
||||
#wmllint: display on
|
||||
message=_ "Note:
|
||||
When a unit gets enough experience (the experience bar is the smaller bar on the right), it will go up a level. Elvish Fighters have two options, and you will get to choose which one you want. Note that level 2 units cost you twice as much to support as level 1 units."
|
||||
#wmllint: display off
|
||||
[/message]
|
||||
[/event]
|
||||
|
||||
|
@ -887,8 +921,10 @@ When a unit gets enough experience (the experience bar is the smaller bar on the
|
|||
name="turn 11"
|
||||
[message]
|
||||
speaker=narrator
|
||||
#wmllint: display on
|
||||
message=_ "Note:
|
||||
Once you select a unit, you see percentages for different places: higher means more defensible. For example, defence is good in castles and villages, bad inside rivers. The dummies' attacks are magical, however, so they have a 70% chance of hitting you wherever you stand."
|
||||
#wmllint: display off
|
||||
[/message]
|
||||
[/event]
|
||||
|
||||
|
|
|
@ -1383,8 +1383,10 @@ When 'n' no longer selects a new unit, you can end your turn.")}
|
|||
# FIXME: Abilities.
|
||||
[message]
|
||||
speaker=unit
|
||||
#wmllint: display on
|
||||
message=_"Advancing a level has fully healed me!
|
||||
I always have a 60% chance of hitting with my bow, and 9 hitpoints damage on each of the four attacks. Use me to dislodge hard-to-hit units."
|
||||
#wmllint: display off
|
||||
[/message]
|
||||
[/event]
|
||||
[event]
|
||||
|
@ -1395,8 +1397,10 @@ I always have a 60% chance of hitting with my bow, and 9 hitpoints damage on eac
|
|||
[/filter]
|
||||
[message]
|
||||
speaker=unit
|
||||
#wmllint: display on
|
||||
message=_"Advancing a level has fully healed me!
|
||||
I am good with both bow and sword, but I have a special ability: ambush. I can hide in forests, and enemies can only see me if they are right next to me."
|
||||
#wmllint: display off
|
||||
[/message]
|
||||
[/event]
|
||||
[event]
|
||||
|
@ -1407,8 +1411,10 @@ I am good with both bow and sword, but I have a special ability: ambush. I can h
|
|||
[/filter]
|
||||
[message]
|
||||
speaker=unit
|
||||
#wmllint: display on
|
||||
message=_"Advancing a level has fully healed me!
|
||||
I am good with both bow and sword, but I have a special ability: leadership. Level 1 units around me do 25% more damage, so position me carefully."
|
||||
#wmllint: display off
|
||||
[/message]
|
||||
[/event]
|
||||
[event]
|
||||
|
@ -1420,8 +1426,10 @@ I am good with both bow and sword, but I have a special ability: leadership. Lev
|
|||
# FIXME: Abilities
|
||||
[message]
|
||||
speaker=unit
|
||||
#wmllint: display on
|
||||
message=_"Advancing a level has fully healed me!
|
||||
I am particularly good with the sword: four attacks doing 8 damage each."
|
||||
#wmllint: display off
|
||||
[/message]
|
||||
[/event]
|
||||
|
||||
|
|
|
@ -37,8 +37,7 @@
|
|||
[message]
|
||||
id=WISHINGWELL1
|
||||
speaker=narrator
|
||||
message= _ "You have come across a wishing well.
|
||||
What would you like to wish for?"
|
||||
message= _ "You have come across a wishing well. What would you like to wish for?"
|
||||
image=scenery/well.png
|
||||
[option]
|
||||
id=WISHINGWELL2a
|
||||
|
|
|
@ -1458,6 +1458,7 @@
|
|||
caption= _"Dark Forecast - a random survival scenario"
|
||||
speaker=narrator
|
||||
image=misc/schedule-dawn.png
|
||||
#wmllint: display on
|
||||
message= _ "Your aim is to survive the spawning waves and defeat the final arch-enemies.
|
||||
|
||||
The spawning waves are generated randomly and will different each time Dark Forecast is played.
|
||||
|
@ -1477,6 +1478,7 @@ The weather will also change randomly, affecting the layout of the map.
|
|||
|
||||
@Rhuvaen
|
||||
- WML implementation"
|
||||
#wmllint: display off
|
||||
[/message]
|
||||
[message]
|
||||
side=3
|
||||
|
|
|
@ -72,6 +72,9 @@
|
|||
# bracketing it with "wmllint: unbalanced-on" and "wmllint: unbalanced-off".
|
||||
# Note that this will also disable stack-based validation on the span
|
||||
# of lines they enclose.
|
||||
#
|
||||
# You can suppress warnings about newlines in messages with "wmllint:
|
||||
# display on", and re-enable them with "wmllint: display off".
|
||||
|
||||
import sys, os, re, getopt, string, copy, difflib, time
|
||||
from wesnoth.wmltools import *
|
||||
|
@ -1799,16 +1802,30 @@ def translator(filename, mapxforms, textxform, versions):
|
|||
linecount = 1
|
||||
startline = None
|
||||
depth = quotecount = 0
|
||||
display_state = False
|
||||
singleline = False
|
||||
for i in range(len(transformed)):
|
||||
if transformed[i] == '\n':
|
||||
if singleline:
|
||||
singleline = False
|
||||
if not display_state and quotecount % 2:
|
||||
print >>sys.stderr, '"%s", line %d: newline within string' % (filename, linecount)
|
||||
linecount += 1
|
||||
elif transformed[i] == '{':
|
||||
if depth == 0:
|
||||
unclosed = startline = linecount
|
||||
quotecount = 0
|
||||
depth += 1
|
||||
elif transformed[i-7:i] == "message" and not transformed[i] == ']':
|
||||
singleline = True
|
||||
elif re.match(" *wmllint: *display +on", transformed[i:]):
|
||||
display_state = True
|
||||
elif re.match(" *wmllint: *display +off", transformed[i:]):
|
||||
display_state = False
|
||||
elif transformed[i] == '"':
|
||||
quotecount += 1
|
||||
if quotecount % 2 == 0:
|
||||
singleline = False
|
||||
elif transformed[i] == '}':
|
||||
depth -= 1
|
||||
if depth == 0:
|
||||
|
|
Loading…
Add table
Reference in a new issue