WML doesn't know what plural means
Moderator: Forum Moderators
WML doesn't know what plural means
Hi.
When writing a spoken "message" delivered by a unit, if a unit type that may or may not exist any more is referenced in the message, a coder has to write code to cover the two possible situations: is the unit type there or not there? But a third possibility also needs to be considered: singular or plural.
"Is it safe for my horse?"
"Is it safe for my horses?"
To determine whether or not a word is plural requires counting the units. Ugh.
I suggest that WML be taught how to use
Another option that might work:
Or even:
Thanks.
When writing a spoken "message" delivered by a unit, if a unit type that may or may not exist any more is referenced in the message, a coder has to write code to cover the two possible situations: is the unit type there or not there? But a third possibility also needs to be considered: singular or plural.
"Is it safe for my horse?"
"Is it safe for my horses?"
To determine whether or not a word is plural requires counting the units. Ugh.
I suggest that WML be taught how to use
plural
as a key, so something like this would work:Code: Select all
[if]
[have_unit]
type=Horse
plural=yes
[/have_unit]
[then]
Code: Select all
[if]
[have_unit_plural]
type=Horse
[/have_unit_plural]
[then]
Code: Select all
[if]
[filter_plural]
type=Horse
[/filter_plural]
[then]
Author of:
DIY Campaign, Confederacy of Swamp Creatures: Big Battle 1, Confederacy of Swamp Creatures: Big Battle 2, Frogfolk Delivery Service, The Pool of Ek.
DIY Campaign, Confederacy of Swamp Creatures: Big Battle 1, Confederacy of Swamp Creatures: Big Battle 2, Frogfolk Delivery Service, The Pool of Ek.
Re: WML doesn't know what plural means
Doesn't
ConditionalActionsWML#.5Bhave_unit.5D
count
do basically the same thing? (except count
is more powerful)ConditionalActionsWML#.5Bhave_unit.5D
Re: WML doesn't know what plural means
So, there's a lot to consider here when taking into account localization, since different languages have different pluralization rules. Here are some links:
https://www.gnu.org/software/gettext/manual/html_node/Plural-forms.html
https://perldoc.perl.org/Locale::Maketext::TPJ13
https://www.gnu.org/software/gettext/manual/html_node/Plural-forms.html
https://perldoc.perl.org/Locale::Maketext::TPJ13
Wesnoth-related GitHub repos:
General mods collection, SotBEEE, AToTBWaTD, The Earth's Gut, A Little Adventure, FtF
Social media: Mastodon: @egallager@treehouse.systems, Steam: egallager
General mods collection, SotBEEE, AToTBWaTD, The Earth's Gut, A Little Adventure, FtF
Social media: Mastodon: @egallager@treehouse.systems, Steam: egallager
Re: WML doesn't know what plural means
We have support for it in Lua. There's no WML tag exposing that, but HttT's Test of the Clans scenario shows how to implement
[show_countdown]
which sets the WML variable units_to_slay_obj
.Re: WML doesn't know what plural means
Wow, that article, subtitled "A Localization Horror Story: It Could Happen To You" was interesting (and funny). Within it, toward the bottom, was this quote:
"...concision means that simple common things should be expressible in very few lines...of code..."
I agree with that sentiment. This is exactly why I'd like a simpler method to code dialogue in
message
tags. Just make it simpler. Anything would help.Thanks for the information, and example.
Sometimes it seems to me like WML coders and Lua coders are two different kinds of people.
WML coders are the "peasants," struggling with land, trying to make their code work, milking their dairy cow, while in the adjacent village are found the Lua coders. Yes, they are also peasants struggling with land and milking their dairy cow, but they also have a goat.
Oh my goodness. Does that actually work?
Author of:
DIY Campaign, Confederacy of Swamp Creatures: Big Battle 1, Confederacy of Swamp Creatures: Big Battle 2, Frogfolk Delivery Service, The Pool of Ek.
DIY Campaign, Confederacy of Swamp Creatures: Big Battle 1, Confederacy of Swamp Creatures: Big Battle 2, Frogfolk Delivery Service, The Pool of Ek.
Re: WML doesn't know what plural means
Well, I didn't test it, but if you look in mainline campaigns you'll see it's used in a lot of places...
Re: WML doesn't know what plural means
IT WORKS!
Thank you. I did not know about
count
. It's awesome. Once again, I think I have a useful idea but WML is two steps ahead of me.
Code: Select all
[event]
name=turn 3
[if]
[have_unit]
type=Nibbler
count=1
[/have_unit]
[then]
[message]
speaker=narrator
message="You see a Nibbler in the lake."
[/message]
[/then]
[elseif]
[have_unit]
type=Nibbler
count=2-100
[/have_unit]
[then]
[message]
speaker=narrator
message="You see Nibblers in the lake."
[/message]
[/then]
[/elseif]
[else]
[message]
speaker=narrator
message="You don't see any Nibblers in the lake."
[/message]
[/else]
[/if]
[/event]
Author of:
DIY Campaign, Confederacy of Swamp Creatures: Big Battle 1, Confederacy of Swamp Creatures: Big Battle 2, Frogfolk Delivery Service, The Pool of Ek.
DIY Campaign, Confederacy of Swamp Creatures: Big Battle 1, Confederacy of Swamp Creatures: Big Battle 2, Frogfolk Delivery Service, The Pool of Ek.
Re: WML doesn't know what plural means
A lot of ActionWML is implemented in Lua - the main difference between
With that example that's based on
[show_countdown]
and many other WML tags is that the Lua behind it is in the scenario file, whereas the core ones are in files in the data/lua/
directory.With that example that's based on
count
, it's not going to be translatable to languages whose rules for plurals aren't "zero, one, two-or-more".Re: WML doesn't know what plural means
Ah. Thanks for the explanation.
Hmm. The obvious solution is to never have more than 1 of anything. Problem solved!
Author of:
DIY Campaign, Confederacy of Swamp Creatures: Big Battle 1, Confederacy of Swamp Creatures: Big Battle 2, Frogfolk Delivery Service, The Pool of Ek.
DIY Campaign, Confederacy of Swamp Creatures: Big Battle 1, Confederacy of Swamp Creatures: Big Battle 2, Frogfolk Delivery Service, The Pool of Ek.