Page MenuHomeWildfire Games

Abstract and decouple SessionMessageBox
ClosedPublic

Authored by elexis on Oct 29 2019, 3:21 PM.

Details

Summary

In the course of #5387, all code in session.js, menu.js and messages.js that is logically independent is moved to separate files.
As such, the message boxes that pop up when being defeated, when the replay ended, when the replay went out of sync or when the networked state went out of sync
are moved into classes that subscribe themselves to the according events, rather than hardcoding them in the event handlers.
Aside from the decoupling in session.js, session.xml, messages.js and object notation, there is another benefit in this patch:

The pausegame / closeopendialogs calls when opening a message box, and the resume call when closing the box
are now deduplicated by introducing a new type SessionMessageBox that is inherited by all message boxes in the session.
This has the advantage that the reader doesn't notice this pattern only by chance after reading multiple message boxes but the pattern is manifested in a class.

Prospect: In case someone has enough lifetime to rewrite the entire GUI to use object orientation and not only some pages,
then the other message boxes may use a MessageBox class instead of the messageBox procedure.

Test Plan

Notice that the QuitConfirmationReplay looks like it should use the "Yes", "No", "Confirmation" strings without context, since the other confirmation message boxes use those strings as well.
If I search for the translations of "Confirmation", I see they're the same for any language.
For "Yes", they're all the same except for Irish / Gaeilge / ga:

ga.public-gui-gamesetup.po-msgstr "Sea"
ga.public-gui-ingame.po-msgstr "Sea"
ga.public-gui-ingame.po-msgstr "Tá"
ga.public-gui-lobby.po-msgstr "Sea"
ga.public-gui-other.po-msgstr "Tá"
#: gui/session/session.js:720
msgctxt "replayFinished"
msgid "No"
msgstr "Ní hea"

#: gui/session/session.js:720
msgctxt "replayFinished"
msgid "Yes"
msgstr "Sea"

So this patch conserves the string, as I can't judge whether that translation is incorrect or unfit.

[elexis@elexis l10n]$ grep -R 'msgid "Confirmation"' -A3 | grep msgstr | sort
af.public-gui-ingame.po-msgstr ""
af.public-gui-ingame.po-msgstr ""
af.public-gui-lobby.po-msgstr ""
af.public-gui-other.po-msgstr ""
ar_EG.public-gui-ingame.po-msgstr ""
ar_EG.public-gui-ingame.po-msgstr ""
ar_EG.public-gui-lobby.po-msgstr ""
ar_EG.public-gui-other.po-msgstr ""
ar.public-gui-ingame.po-msgstr "أكّد"
ar.public-gui-ingame.po-msgstr "أكّد"
ar.public-gui-lobby.po-msgstr "أكّد"
ar.public-gui-other.po-msgstr "أكّد"
ar_SA.public-gui-ingame.po-msgstr ""
ar_SA.public-gui-ingame.po-msgstr ""
ar_SA.public-gui-lobby.po-msgstr ""
ar_SA.public-gui-other.po-msgstr ""
ast.public-gui-ingame.po-msgstr "Confirmanza"
ast.public-gui-ingame.po-msgstr "Confirmanza"
ast.public-gui-lobby.po-msgstr "Confirmanza"
ast.public-gui-other.po-msgstr "Confirmanza"
az.public-gui-ingame.po-msgstr ""
az.public-gui-ingame.po-msgstr ""
az.public-gui-lobby.po-msgstr ""
az.public-gui-other.po-msgstr ""
be.public-gui-ingame.po-msgstr ""
be.public-gui-ingame.po-msgstr ""
be.public-gui-lobby.po-msgstr ""
be.public-gui-other.po-msgstr ""
bg.public-gui-ingame.po-msgstr "Потвърждаване"
bg.public-gui-ingame.po-msgstr "Потвърждаване"
bg.public-gui-lobby.po-msgstr "Потвърждение"
bg.public-gui-other.po-msgstr "Потвърждаване"
bn.public-gui-ingame.po-msgstr ""
bn.public-gui-ingame.po-msgstr ""
bn.public-gui-lobby.po-msgstr ""
bn.public-gui-other.po-msgstr ""
br.public-gui-ingame.po-msgstr "Kadarnadenn"
br.public-gui-ingame.po-msgstr "Kadarnadenn"
br.public-gui-lobby.po-msgstr "Kadarnadenn"
br.public-gui-other.po-msgstr "Kadarnadenn"
ca.public-gui-ingame.po-msgstr "Confirmació"
ca.public-gui-ingame.po-msgstr "Confirmació"
ca.public-gui-lobby.po-msgstr "Confirmació"
ca.public-gui-other.po-msgstr "Confirmació"
cs.public-gui-ingame.po-msgstr "Potvrzení"
cs.public-gui-ingame.po-msgstr "Potvrzení"
cs.public-gui-lobby.po-msgstr "Potvrzení"
cs.public-gui-other.po-msgstr "Potvrzení"
cy.public-gui-ingame.po-msgstr "Cadarnhad"
cy.public-gui-ingame.po-msgstr "Cadarnhad"
cy.public-gui-lobby.po-msgstr "Cadarnhad"
cy.public-gui-other.po-msgstr "Cadarnhad"
da.public-gui-ingame.po-msgstr "Bekræftelse"
da.public-gui-ingame.po-msgstr "Bekræftelse"
da.public-gui-lobby.po-msgstr ""
da.public-gui-other.po-msgstr "Bekræftelse"
de.public-gui-ingame.po-msgstr "Bestätigung"
de.public-gui-ingame.po-msgstr "Bestätigung"
de.public-gui-lobby.po-msgstr "Bestätigung"
de.public-gui-other.po-msgstr "Bestätigung"
el.public-gui-ingame.po-msgstr "Επιβεβαίωση"
el.public-gui-ingame.po-msgstr "Επιβεβαίωση"
el.public-gui-lobby.po-msgstr "Επιβεβαίωση"
el.public-gui-other.po-msgstr "Επιβεβαίωση"
en_GB.public-gui-ingame.po-msgstr "Confirmation"
en_GB.public-gui-ingame.po-msgstr "Confirmation"
en_GB.public-gui-lobby.po-msgstr "Confirmation"
en_GB.public-gui-other.po-msgstr "Confirmation"
eo.public-gui-ingame.po-msgstr ""
eo.public-gui-ingame.po-msgstr "Konfirmo"
eo.public-gui-lobby.po-msgstr ""
eo.public-gui-other.po-msgstr "Konfirmo"
es_AR.public-gui-ingame.po-msgstr "Confirmar"
es_AR.public-gui-ingame.po-msgstr "Confirmar"
es_AR.public-gui-lobby.po-msgstr "Confirmar"
es_AR.public-gui-other.po-msgstr "Confirmar"
es_CL.public-gui-ingame.po-msgstr "Confirmación"
es_CL.public-gui-ingame.po-msgstr "Confirmación"
es_CL.public-gui-lobby.po-msgstr ""
es_CL.public-gui-other.po-msgstr "Confirmación"
es_MX.public-gui-ingame.po-msgstr "Confirmación"
es_MX.public-gui-ingame.po-msgstr "Confirmación"
es_MX.public-gui-lobby.po-msgstr ""
es_MX.public-gui-other.po-msgstr "Confirmación"
es.public-gui-ingame.po-msgstr "Confirmación"
es.public-gui-ingame.po-msgstr "Confirmar decisión"
es.public-gui-lobby.po-msgstr "Confirmar decisión"
es.public-gui-other.po-msgstr "Confirmar decisión"
et.public-gui-ingame.po-msgstr ""
et.public-gui-ingame.po-msgstr "Kinnitus"
et.public-gui-lobby.po-msgstr ""
et.public-gui-other.po-msgstr "Kinnitus"
eu.public-gui-ingame.po-msgstr "Berrespena"
eu.public-gui-ingame.po-msgstr "Berrespena"
eu.public-gui-lobby.po-msgstr "Baieztapena"
eu.public-gui-other.po-msgstr "Baieztapena"
fa.public-gui-ingame.po-msgstr "تائید"
fa.public-gui-ingame.po-msgstr "تایید"
fa.public-gui-lobby.po-msgstr "تائید"
fa.public-gui-other.po-msgstr "تایید"
fi.public-gui-ingame.po-msgstr "Vahvistus"
fi.public-gui-ingame.po-msgstr "Vahvistus"
fi.public-gui-lobby.po-msgstr "Vahvistus"
fi.public-gui-other.po-msgstr "Vahvistus"
fr_CA.public-gui-ingame.po-msgstr ""
fr_CA.public-gui-ingame.po-msgstr ""
fr_CA.public-gui-lobby.po-msgstr ""
fr_CA.public-gui-other.po-msgstr ""
frp.public-gui-ingame.po-msgstr "Confirmacion"
frp.public-gui-ingame.po-msgstr "Confirmacion"
frp.public-gui-lobby.po-msgstr "Confirmacion"
frp.public-gui-other.po-msgstr "Confirmacion"
fr.public-gui-ingame.po-msgstr "Confirmation"
fr.public-gui-ingame.po-msgstr "Confirmation"
fr.public-gui-lobby.po-msgstr "Confirmation"
fr.public-gui-other.po-msgstr "Confirmation"
ga.public-gui-ingame.po-msgstr "Deimhniú"
ga.public-gui-ingame.po-msgstr "Deimhniú"
ga.public-gui-lobby.po-msgstr "Deimhniú"
ga.public-gui-other.po-msgstr "Deimhniú"
gd.public-gui-ingame.po-msgstr "Dearbhadh"
gd.public-gui-ingame.po-msgstr "Dearbhadh"
gd.public-gui-lobby.po-msgstr "Dearbhadh"
gd.public-gui-other.po-msgstr "Dearbhadh"
gl.public-gui-ingame.po-msgstr "Confirmación"
gl.public-gui-ingame.po-msgstr "Confirmación"
gl.public-gui-lobby.po-msgstr "Confirmación"
gl.public-gui-other.po-msgstr "Confirmación"
he.public-gui-ingame.po-msgstr "אישור "
he.public-gui-ingame.po-msgstr "אישור"
he.public-gui-lobby.po-msgstr "אישור"
he.public-gui-other.po-msgstr "אישור "
hi.public-gui-ingame.po-msgstr ""
hi.public-gui-ingame.po-msgstr "पुष्टिकरण"
hi.public-gui-lobby.po-msgstr ""
hi.public-gui-other.po-msgstr "पुष्टिकरण"
hr.public-gui-ingame.po-msgstr "Potvrda"
hr.public-gui-ingame.po-msgstr "Potvrda"
hr.public-gui-lobby.po-msgstr "Potvrda"
hr.public-gui-other.po-msgstr "Potvrda"
hu.public-gui-ingame.po-msgstr "Megerősítés"
hu.public-gui-ingame.po-msgstr "Megerősítés"
hu.public-gui-lobby.po-msgstr "Megerősítés"
hu.public-gui-other.po-msgstr "Megerősítés"
hy.public-gui-ingame.po-msgstr "Հաստատում"
hy.public-gui-ingame.po-msgstr "Հաստատում"
hy.public-gui-lobby.po-msgstr "Հաստատում"
hy.public-gui-other.po-msgstr "Հաստատում"
id.public-gui-ingame.po-msgstr "Konfirmasi"
id.public-gui-ingame.po-msgstr "Konfirmasi"
id.public-gui-lobby.po-msgstr "Konfirmasi"
id.public-gui-other.po-msgstr "Konfirmasi"
it.public-gui-ingame.po-msgstr "Conferma"
it.public-gui-ingame.po-msgstr "Conferma"
it.public-gui-lobby.po-msgstr "Conferma"
it.public-gui-other.po-msgstr "Conferma"
ja.public-gui-ingame.po-msgstr "確認"
ja.public-gui-ingame.po-msgstr "確認"
ja.public-gui-lobby.po-msgstr "確認"
ja.public-gui-other.po-msgstr "確認"
jbo.public-gui-ingame.po-msgstr ""
jbo.public-gui-ingame.po-msgstr ""
jbo.public-gui-lobby.po-msgstr ""
jbo.public-gui-other.po-msgstr ""
ka.public-gui-ingame.po-msgstr ""
ka.public-gui-ingame.po-msgstr "დამოწმება"
ka.public-gui-lobby.po-msgstr ""
ka.public-gui-other.po-msgstr "დამოწმება"
kn.public-gui-ingame.po-msgstr ""
kn.public-gui-ingame.po-msgstr ""
kn.public-gui-lobby.po-msgstr ""
kn.public-gui-other.po-msgstr ""
ko.public-gui-ingame.po-msgstr "확인"
ko.public-gui-ingame.po-msgstr "확인"
ko.public-gui-lobby.po-msgstr "확인"
ko.public-gui-other.po-msgstr "확인"
krl.public-gui-ingame.po-msgstr ""
krl.public-gui-ingame.po-msgstr ""
krl.public-gui-lobby.po-msgstr ""
krl.public-gui-other.po-msgstr ""
ku.public-gui-ingame.po-msgstr ""
ku.public-gui-ingame.po-msgstr ""
ku.public-gui-lobby.po-msgstr ""
ku.public-gui-other.po-msgstr ""
kw.public-gui-ingame.po-msgstr ""
kw.public-gui-ingame.po-msgstr ""
kw.public-gui-lobby.po-msgstr ""
kw.public-gui-other.po-msgstr ""
la.public-gui-ingame.po-msgstr ""
la.public-gui-ingame.po-msgstr "Confirmatio"
la.public-gui-lobby.po-msgstr ""
la.public-gui-other.po-msgstr "Confirmatio"
lt.public-gui-ingame.po-msgstr "Patvirtinimas"
lt.public-gui-ingame.po-msgstr "Patvirtinimas"
lt.public-gui-lobby.po-msgstr "Patvirtinimas"
lt.public-gui-other.po-msgstr "Patvirtinimas"
lv.public-gui-ingame.po-msgstr "Apstiprinājums"
lv.public-gui-ingame.po-msgstr "Apstiprinājums"
lv.public-gui-lobby.po-msgstr "Apstiprinājums"
lv.public-gui-other.po-msgstr "Apstiprinājums"
mk.public-gui-ingame.po-msgstr ""
mk.public-gui-ingame.po-msgstr ""
mk.public-gui-lobby.po-msgstr ""
mk.public-gui-other.po-msgstr ""
ml.public-gui-ingame.po-msgstr ""
ml.public-gui-ingame.po-msgstr "ഉറപ്പിക്കല്‍"
ml.public-gui-lobby.po-msgstr ""
ml.public-gui-other.po-msgstr "ഉറപ്പിക്കല്‍"
mr.public-gui-ingame.po-msgstr "पुष्टीकरण"
mr.public-gui-ingame.po-msgstr "पुष्टीकरण"
mr.public-gui-lobby.po-msgstr "पुष्टीकरण"
mr.public-gui-other.po-msgstr "पुष्टीकरण"
ms.public-gui-ingame.po-msgstr "Pengesahan"
ms.public-gui-ingame.po-msgstr "Pengesahan"
ms.public-gui-lobby.po-msgstr "Pengesahan"
ms.public-gui-other.po-msgstr "Pengesahan"
nb.public-gui-ingame.po-msgstr "Bekreftelse"
nb.public-gui-ingame.po-msgstr "Bekreftelse"
nb.public-gui-lobby.po-msgstr "Bekreftelse"
nb.public-gui-other.po-msgstr "Bekreftelse"
nl.public-gui-ingame.po-msgstr "Bevestiging"
nl.public-gui-ingame.po-msgstr "Bevestiging"
nl.public-gui-lobby.po-msgstr "Bevestiging"
nl.public-gui-other.po-msgstr "Bevestiging"
nso.public-gui-ingame.po-msgstr ""
nso.public-gui-ingame.po-msgstr ""
nso.public-gui-lobby.po-msgstr ""
nso.public-gui-other.po-msgstr ""
pl.public-gui-ingame.po-msgstr "Potwierdzenie"
pl.public-gui-ingame.po-msgstr "Potwierdzenie"
pl.public-gui-lobby.po-msgstr "Potwierdzenie"
pl.public-gui-other.po-msgstr "Potwierdzenie"
pt_BR.public-gui-ingame.po-msgstr "Confirmação"
pt_BR.public-gui-ingame.po-msgstr "Confirmação"
pt_BR.public-gui-lobby.po-msgstr "Confirmação"
pt_BR.public-gui-other.po-msgstr "Confirmação"
pt_PT.public-gui-ingame.po-msgstr "Confirmação"
pt_PT.public-gui-ingame.po-msgstr "Confirmação"
pt_PT.public-gui-lobby.po-msgstr "Confirmação"
pt_PT.public-gui-other.po-msgstr "Confirmação"
public-gui-ingame.pot-msgstr ""
public-gui-ingame.pot-msgstr ""
public-gui-lobby.pot-msgstr ""
public-gui-other.pot-msgstr ""
ro.public-gui-ingame.po-msgstr "Confirmare"
ro.public-gui-ingame.po-msgstr "Confirmare"
ro.public-gui-lobby.po-msgstr "Confirmare"
ro.public-gui-other.po-msgstr "Confirmare"
ru.public-gui-ingame.po-msgstr "Подтверждение"
ru.public-gui-ingame.po-msgstr "Подтверждение"
ru.public-gui-lobby.po-msgstr "Подтверждение"
ru.public-gui-other.po-msgstr "Подтверждение"
si.public-gui-ingame.po-msgstr ""
si.public-gui-ingame.po-msgstr ""
si.public-gui-lobby.po-msgstr ""
si.public-gui-other.po-msgstr ""
sk.public-gui-ingame.po-msgstr "Potvrdenie"
sk.public-gui-ingame.po-msgstr "Potvrdenie"
sk.public-gui-lobby.po-msgstr "Potvrdenie"
sk.public-gui-other.po-msgstr "Potvrdenie"
sl.public-gui-ingame.po-msgstr "Potrditev"
sl.public-gui-ingame.po-msgstr "Potrditev"
sl.public-gui-lobby.po-msgstr ""
sl.public-gui-other.po-msgstr "Potrditev"
sq.public-gui-ingame.po-msgstr "Vërteto"
sq.public-gui-ingame.po-msgstr "Vërteto"
sq.public-gui-lobby.po-msgstr "Vërteto"
sq.public-gui-other.po-msgstr "Vërteto"
sr.public-gui-ingame.po-msgstr "Потврда"
sr.public-gui-ingame.po-msgstr "Потврда"
sr.public-gui-lobby.po-msgstr "Потврда"
sr.public-gui-other.po-msgstr "Потврда"
sv.public-gui-ingame.po-msgstr "Bekräfta"
sv.public-gui-ingame.po-msgstr "Bekräftelse"
sv.public-gui-lobby.po-msgstr "Bekräftelse"
sv.public-gui-other.po-msgstr "Bekräfta"
sw.public-gui-ingame.po-msgstr ""
sw.public-gui-ingame.po-msgstr ""
sw.public-gui-lobby.po-msgstr ""
sw.public-gui-other.po-msgstr ""
szl.public-gui-ingame.po-msgstr ""
szl.public-gui-ingame.po-msgstr ""
szl.public-gui-lobby.po-msgstr ""
szl.public-gui-other.po-msgstr ""
ta_IN.public-gui-ingame.po-msgstr ""
ta_IN.public-gui-ingame.po-msgstr "உறுதிசெய்"
ta_IN.public-gui-lobby.po-msgstr ""
ta_IN.public-gui-other.po-msgstr "உறுதிசெய்"
te.public-gui-ingame.po-msgstr ""
te.public-gui-ingame.po-msgstr "నిర్ధారణ"
te.public-gui-lobby.po-msgstr ""
te.public-gui-other.po-msgstr "నిర్ధారణ"
th.public-gui-ingame.po-msgstr "การยืนยัน"
th.public-gui-ingame.po-msgstr "การยืนยัน"
th.public-gui-lobby.po-msgstr "การยืนยัน"
th.public-gui-other.po-msgstr "การยืนยัน"
tl.public-gui-ingame.po-msgstr ""
tl.public-gui-ingame.po-msgstr ""
tl.public-gui-lobby.po-msgstr ""
tl.public-gui-other.po-msgstr ""
tr.public-gui-ingame.po-msgstr "Onay"
tr.public-gui-ingame.po-msgstr "Onay"
tr.public-gui-lobby.po-msgstr "Onay"
tr.public-gui-other.po-msgstr "Onay"
uk.public-gui-ingame.po-msgstr "Підтвердження"
uk.public-gui-ingame.po-msgstr "Підтвердження"
uk.public-gui-lobby.po-msgstr "Підтвердження"
uk.public-gui-other.po-msgstr "Підтвердження"
ur.public-gui-ingame.po-msgstr ""
ur.public-gui-ingame.po-msgstr ""
ur.public-gui-lobby.po-msgstr ""
ur.public-gui-other.po-msgstr ""
uz.public-gui-ingame.po-msgstr ""
uz.public-gui-ingame.po-msgstr ""
uz.public-gui-lobby.po-msgstr ""
uz.public-gui-other.po-msgstr ""
vi.public-gui-ingame.po-msgstr ""
vi.public-gui-ingame.po-msgstr "Xác nhận"
vi.public-gui-lobby.po-msgstr ""
vi.public-gui-other.po-msgstr "Xác nhận"
xh.public-gui-ingame.po-msgstr ""
xh.public-gui-ingame.po-msgstr ""
xh.public-gui-lobby.po-msgstr ""
xh.public-gui-other.po-msgstr ""
zh.public-gui-ingame.po-msgstr "确认"
zh.public-gui-ingame.po-msgstr "确认"
zh.public-gui-lobby.po-msgstr "确定"
zh.public-gui-other.po-msgstr "确认"
zh_TW.public-gui-ingame.po-msgstr "確認"
zh_TW.public-gui-ingame.po-msgstr "確認"
zh_TW.public-gui-lobby.po-msgstr "確認"
zh_TW.public-gui-other.po-msgstr "確認"

Other than that, "make sure that it works" and any behavior is changed and tested ingame and any string preserved.

There is also the question with regards to the folder structure and object hierarchy.
We notice both session.js and session/ are getting a bit crowded.

The plan for that is to transform everything into classes and then in the end have everything owned by
classes that own multiple classes. So it will be easier visible how to form the hierarchy if the transformation progressed more.

  • (3) Test the Resign button for players and observers and replaymode
  • (4) Test the Exit button for players replay observer hosts and observer clients
  • (1) Test timewarp
  • (1) Test deleting entities multiple times in the same match
  • (2) Notice the program is paused in singleplayer and replaymode upon msgbox, but never in networked mode
  • (2) Test out of sync
  • (1) Test replay oos
  • (1) test replay finished

-> running the game 10-15 times

Notice that using markForTranslation would be more consistent with the previously committed code but would yield inacceptably ugly class code.

Diff Detail

Repository
rP 0 A.D. Public Repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

elexis created this revision.Oct 29 2019, 3:21 PM

Successful build - Chance fights ever on the side of the prudent.

Link to build: https://jenkins.wildfiregames.com/job/vs2015-differential/497/display/redirect

Successful build - Chance fights ever on the side of the prudent.

Linter detected issues:
Executing section Source...
Executing section JS...
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 3.
|----|    | /zpool0/trunk/binaries/data/mods/public/gui/session/messages.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/gui/session/messages.js
| 414| 414| 	let notificationText =
| 415| 415| 		notification.instructions.reduce((instructions, item) =>
| 416| 416| 			instructions + (typeof item == "string" ? translate(item) : colorizeHotkey(translate(item.text), item.hotkey)),
| 417|    |-			"");
|    | 417|+		"");
| 418| 418| 
| 419| 419| 	Engine.GetGUIObjectByName("tutorialText").caption = g_TutorialMessages.concat(setStringTags(notificationText, g_TutorialNewMessageTags)).join("\n");
| 420| 420| 	g_TutorialMessages.push(notificationText);
|    | [NORMAL] ESLintBear (no-multi-spaces):
|    | Multiple spaces found before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/gui/session/message_box/DeleteSelectionConfirmation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/gui/session/message_box/DeleteSelectionConfirmation.js
|  15|  15| 	},
|  16|  16| 	{
|  17|  17| 		"caption": translate("Yes"),
|  18|    |-		"onPress": function() { this.deleteSelection();  }
|    |  18|+		"onPress": function() { this.deleteSelection(); }
|  19|  19| 	}
|  20|  20| ];
|    | [NORMAL] ESLintBear (semi):
|    | Missing semicolon.
|----|    | /zpool0/trunk/binaries/data/mods/public/gui/session/message_box/QuitConfirmationMenu.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/gui/session/message_box/QuitConfirmationMenu.js
|  15|  15| 	{
|  16|  16| 		return !g_IsNetworked || (!g_IsController && g_IsObserver);
|  17|  17| 	}
|  18|    |-}
|    |  18|+};
|  19|  19| 
|  20|  20| /**
|  21|  21|  * If the current player is the host of a networked match, have the player
|    | [NORMAL] ESLintBear (semi):
|    | Missing semicolon.
|----|    | /zpool0/trunk/binaries/data/mods/public/gui/session/message_box/QuitConfirmationMenu.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/gui/session/message_box/QuitConfirmationMenu.js
|  27|  27| 	{
|  28|  28| 		return g_IsNetworked && g_IsController;
|  29|  29| 	}
|  30|    |-}
|    |  30|+};
|  31|  31| 
|  32|  32| QuitConfirmationMenu.prototype.MultiplayerHost.prototype.Caption =
|  33|  33| 	translate("Are you sure you want to quit? Leaving will disconnect all other players.");
|    | [NORMAL] ESLintBear (semi):
|    | Missing semicolon.
|----|    | /zpool0/trunk/binaries/data/mods/public/gui/session/message_box/QuitConfirmationMenu.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/gui/session/message_box/QuitConfirmationMenu.js
|  41|  41| 	{
|  42|  42| 		return g_IsNetworked && !g_IsController && !g_IsObserver;
|  43|  43| 	}
|  44|    |-}
|    |  44|+};
|  45|  45| 
|  46|  46| QuitConfirmationMenu.prototype.MultiplayerClient.prototype.Buttons =
|  47|  47| [
|    | [NORMAL] ESLintBear (key-spacing):
|    | Extra space before value for key 'onPress'.
|----|    | /zpool0/trunk/binaries/data/mods/public/gui/session/message_box/QuitConfirmationMenu.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/gui/session/message_box/QuitConfirmationMenu.js
|  50|  50| 	},
|  51|  51| 	{
|  52|  52| 		"caption": translate("Yes"),
|  53|    |-		"onPress": 	() => {
|    |  53|+		"onPress": () => {
|  54|  54| 			(new ReturnQuestion()).display();
|  55|  55| 		}
|  56|  56| 	}
|    | [NORMAL] ESLintBear (semi):
|    | Missing semicolon.
|----|    | /zpool0/trunk/binaries/data/mods/public/gui/session/message_box/QuitConfirmationMenu.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/gui/session/message_box/QuitConfirmationMenu.js
|  61|  61| }
|  62|  62| 
|  63|  63| ReturnQuestion.prototype.Title = translate("Confirmation");
|  64|    |-ReturnQuestion.prototype.Caption = translate("Do you want to resign or will you return soon?")
|    |  64|+ReturnQuestion.prototype.Caption = translate("Do you want to resign or will you return soon?");
|  65|  65| ReturnQuestion.prototype.Buttons = [
|  66|  66| 	{
|  67|  67| 		"caption": translate("I will return"),

binaries/data/mods/public/gui/session/message_box/QuitConfirmationMenu.js
|  54| »   »   »   (new·ReturnQuestion()).display();
|    | [MAJOR] ESLintBear (no-use-before-define):
|    | 'ReturnQuestion' was used before it was defined.

binaries/data/mods/public/gui/session/message_box/QuitConfirmationMenu.js
|  18| }
|    | [NORMAL] JSHintBear:
|    | Missing semicolon.

binaries/data/mods/public/gui/session/message_box/QuitConfirmationMenu.js
|  30| }
|    | [NORMAL] JSHintBear:
|    | Missing semicolon.

binaries/data/mods/public/gui/session/message_box/QuitConfirmationMenu.js
|  44| }
|    | [NORMAL] JSHintBear:
|    | Missing semicolon.

binaries/data/mods/public/gui/session/message_box/QuitConfirmationMenu.js
|  59| class·ReturnQuestion·extends·SessionMessageBox
|    | [NORMAL] JSHintBear:
|    | 'ReturnQuestion' was used before it was defined.

binaries/data/mods/public/gui/session/message_box/QuitConfirmationMenu.js
|  64| ReturnQuestion.prototype.Caption·=·translate("Do·you·want·to·resign·or·will·you·return·soon?")
|    | [NORMAL] JSHintBear:
|    | Missing semicolon.

binaries/data/mods/public/gui/session/session.js
| 685| »   »   button.onpress·=·(function(i)·{·return·function()·{·performGroup((Engine.HotkeyIsPressed("selection.add")·?·"add"·:·"select"),·i);·};·})(i);
|    | [NORMAL] ESLintBear (no-shadow):
|    | 'i' is already declared in the upper scope.

binaries/data/mods/public/gui/session/session.js
| 686| »   »   button.ondoublepress·=·(function(i)·{·return·function()·{·performGroup("snap",·i);·};·})(i);
|    | [NORMAL] ESLintBear (no-shadow):
|    | 'i' is already declared in the upper scope.

binaries/data/mods/public/gui/session/session.js
| 687| »   »   button.onpressright·=·(function(i)·{·return·function()·{·performGroup("breakUp",·i);·};·})(i);
|    | [NORMAL] ESLintBear (no-shadow):
|    | 'i' is already declared in the upper scope.
|    | [NORMAL] ESLintBear (semi):
|    | Missing semicolon.
|----|    | /zpool0/trunk/binaries/data/mods/public/gui/session/message_box/OutOfSyncReplay.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/gui/session/message_box/OutOfSyncReplay.js
|  20|  20| OutOfSyncReplay.prototype.Width = 500;
|  21|  21| OutOfSyncReplay.prototype.Height = 140;
|  22|  22| 
|  23|    |-OutOfSyncReplay.prototype.Title = translate("Out of Sync")
|    |  23|+OutOfSyncReplay.prototype.Title = translate("Out of Sync");
|  24|  24| 
|  25|  25| OutOfSyncReplay.prototype.Captions = [
|  26|  26| 	translate("Out-Of-Sync error on turn %(turn)s."),

binaries/data/mods/public/gui/session/message_box/OutOfSyncReplay.js
|  23| OutOfSyncReplay.prototype.Title·=·translate("Out·of·Sync")
|    | [NORMAL] JSHintBear:
|    | Missing semicolon.

binaries/data/mods/public/gui/session/MenuButtons.js
| 118| »   »   »   data·=>
|    | [NORMAL] ESLintBear (brace-rules/brace-on-same-line):
|    | Opening curly brace does not appear on the same line as controlling statement.

binaries/data/mods/public/gui/session/developer_overlay/TimeWarp.js
|  28| »   »   »   (new·TimeWarpMessageBox()).display();
|    | [MAJOR] ESLintBear (no-use-before-define):
|    | 'TimeWarpMessageBox' was used before it was defined.

binaries/data/mods/public/gui/session/developer_overlay/TimeWarp.js
|  60| class·TimeWarpMessageBox·extends·SessionMessageBox
|    | [NORMAL] JSHintBear:
|    | 'TimeWarpMessageBox' was used before it was defined.

binaries/data/mods/public/gui/session/unit_actions.js
| 557| »   »   »   switch·(tradingDetails.type)
|    | [NORMAL] ESLintBear (default-case):
|    | Expected a default case.
Executing section cli...

Link to build: https://jenkins.wildfiregames.com/job/docker-differential/1012/display/redirect

Freagarach added inline comments.
binaries/data/mods/public/gui/session/message_box/OutOfSyncNetwork.js
36 ↗(On Diff #10222)

.?

39 ↗(On Diff #10222)

.?

binaries/data/mods/public/gui/session/message_box/OutOfSyncReplay.js
27 ↗(On Diff #10222)

.

binaries/data/mods/public/gui/session/message_box/QuitConfirmationDefeat.js
36 ↗(On Diff #10222)

.

binaries/data/mods/public/gui/session/message_box/QuitConfirmationReplay.js
22 ↗(On Diff #10222)

Kind of a strange context, but out of scope.

elexis added inline comments.Oct 29 2019, 5:35 PM
binaries/data/mods/public/gui/session/message_box/OutOfSyncNetwork.js
36 ↗(On Diff #10222)

Perhaps the period is more correct. In this case the string ends with a filepath, so the user should not assume that period is part of the filepath.
If we change the strings then every language will have to redo the translation. I dont know if its really easy enough for all translators to take over the previous string and add the period and whether its maintained enough. So I prefer to keep strings unless there is a good reason to change them.

binaries/data/mods/public/gui/session/message_box/QuitConfirmationReplay.js
22 ↗(On Diff #10222)

The purpose of the context here is not to provide information what this means but to allow the translator to use a different string for this particular question. For example it could be translated to "Quit" and "Cancel" in this context.

Stan added a subscriber: Stan.Oct 29 2019, 5:39 PM
Stan added inline comments.
binaries/data/mods/public/gui/session/MenuButtons.js
228 ↗(On Diff #10222)

I guess that's not that costly, but isn't it worth keeping a reference around and hide display it everytime instead of recreating it from scratch ?

binaries/data/mods/public/gui/session/message_box/OutOfSyncReplay.js
23 ↗(On Diff #10222)

Missing ;

binaries/data/mods/public/gui/session/unit_actions.js
1085 ↗(On Diff #10222)

Same here.

Freagarach added inline comments.Oct 29 2019, 5:46 PM
binaries/data/mods/public/gui/session/message_box/QuitConfirmationReplay.js
22 ↗(On Diff #10222)

Aye, but without the context we have here (that it is regarding a button) it can be interpreted as a "boolean" whether the replay has finished?

elexis added inline comments.Oct 29 2019, 5:59 PM
binaries/data/mods/public/gui/session/MenuButtons.js
228 ↗(On Diff #10222)

Missing substantiation

binaries/data/mods/public/gui/session/message_box/OutOfSyncReplay.js
23 ↗(On Diff #10222)

amongst others, see bot

binaries/data/mods/public/gui/session/message_box/QuitConfirmationReplay.js
22 ↗(On Diff #10222)

Which doesn't defy the fact that some languages may want to translate a binary choice differently depending on context.
I would have even removed the strings if it wasn't already translated differently in one language (irish), see testplan
https://www.irishamericanmom.com/irish-a-language-without-words-for-yes-and-no/

elexis edited the test plan for this revision. (Show Details)Oct 30 2019, 11:54 AM
elexis edited the test plan for this revision. (Show Details)
This revision was not accepted when it landed; it landed in state Needs Review.Oct 30 2019, 12:14 PM
This revision was automatically updated to reflect the committed changes.
Owners added a subscriber: Restricted Owners Package.Oct 30 2019, 12:14 PM
elexis edited the test plan for this revision. (Show Details)Oct 30 2019, 12:40 PM