Message "We lost a %s to the ocean!" cannot easily be translated

Bug #1298309 reported by wl-zocker
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
widelands
Fix Released
Low
Unassigned

Bug Description

Split out from bug 1298011:
The text in question appears in the first Atlantean campaign, when the water begins to raise.
It causes problems in some languages because the article needs to be translated without knowing the noun (it can be any Atlantean building).
For example in German, "a" has to be translated to "ein", "eine" or "einen", depending on the gender of the noun. Other languages might need to decline the noun.

Related branches

Revision history for this message
wl-zocker (wl-zocker) wrote :

The proper solution is probably to define which case we need after "to lose sth.", and then to add this to the translation of every Atlantean building. We would then have "We lost %s to the ocean!", where %s is "a"+noun, that has to be translated sepearately for each building. Since we can give the translators context information and support plural forms, this would be an enhancement of this system. This would also adress the issue discussed at https://wl.widelands.org/forum/topic/1449/?page=5#post-10674
An easier solution is to translate the whole string for every building (approx. 40).

Revision history for this message
SirVer (sirver) wrote :

Gun, how do you want that handled? I think it is feasible to just add a sentence for each building into this mission. We can check that if a building is not translated (in case a new one is added) that the mission cannot be started.

Changed in widelands:
assignee: nobody → GunChleoc (gunchleoc)
status: New → Confirmed
Revision history for this message
Hans Joachim Desserud (hjd) wrote :

I noticed this too when doing translations lately.

Adding separate strings for each building will of course work, though I'm slightly worried making the building names translatable in another place will eventually lead to mismatch/different translations. (Which could still happen today anyways, so it's not a strong argument against this approach.) I'm curious how other games or programs deal with this problem and whether there's a better solution we could apply.

Revision history for this message
SirVer (sirver) wrote :

An easy fix would be to change the message to: 'We lost a building to the ocean: %s' and just show the image of the building.

Revision history for this message
Hans Joachim Desserud (hjd) wrote :

That should solve the issue. Sounds good to me. :)

Revision history for this message
GunChleoc (gunchleoc) wrote :

Exactly what I was thinking too - use a general string and image.

SirVer (sirver)
Changed in widelands:
importance: Undecided → Low
status: Confirmed → Triaged
milestone: none → build19-rc1
Revision history for this message
GunChleoc (gunchleoc) wrote :

In init.lua, I tried:

function send_building_lost_message(f)
   p1:send_message(_"Building lost!", "<rt image=image_line(tribes/atlanteans/".. f.immovable.name .."/menu.png></rt>" ..
      rt(p(
         (_"We lost a building to the ocean: %s"):format(f.immovable.descname)
      )), { field = f, popup = true }
   )
end

which results in:

terminate called after throwing an instance of 'FileNotFound_error'
  what(): Could not find filename: could not find file or directory: image_line(tribes/atlanteans/fishers_house/menu.png
Aborted (core dumped)

I also tried

   p1:send_message(_"Building lost!", "<rt image=image_line(atlanteans/".. f.immovable.name .."/menu.png></rt>" ..

and

   p1:send_message(_"Building lost!", "<rt image=image_line(" .. f.immovable.name .."/menu.png></rt>" ..

Same thing.

Any idea what's wrong here?

Revision history for this message
SirVer (sirver) wrote :

"<rt image=image_line(tribes/atlanteans/".. f.immovable.name .."/menu.png></rt>" should be

"<rt image=" .. image_line("tribes/atlanteans/".. f.immovable.name .."/menu.png")> .. "</rt>"

or similar. image_line is a Lua function, not a function for the rich text renderer.

Revision history for this message
GunChleoc (gunchleoc) wrote :

Duh! Fix is committed in new branch.

Changed in widelands:
status: Triaged → In Progress
SirVer (sirver)
Changed in widelands:
status: In Progress → Fix Committed
GunChleoc (gunchleoc)
Changed in widelands:
assignee: GunChleoc (gunchleoc) → nobody
GunChleoc (gunchleoc)
Changed in widelands:
status: Fix Committed → Fix Released
Revision history for this message
GunChleoc (gunchleoc) wrote :

Fixed in build19-rc1.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.