-
Notifications
You must be signed in to change notification settings - Fork 352
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Endgame screen with rmlui #4384
base: master
Are you sure you want to change the base?
Endgame screen with rmlui #4384
Conversation
Progress + conversation in discord: |
language/en/interface.json
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These additional entries shouldn't be needed. We need to be able to use the interpolated string entries, so if those aren't working, we need to fix that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
interpolated you mean those, which already presented. Right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The ones that contain variables. "Lorum ipsum %{interpolatedVariable}"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if rml supports interpolated, at least didn't find it in the doc. There're 2 things which are coming into my mind in order to work with such strings:
- Once game ended - dynamically put into RmlUi translations string with interpolated values. I mean already replaced variable with time and only then put it into RmlUi translation table
- In order to translate such string, use I18N in lua widget and pass it via documentHandler model. In this case we just avoid using RmlUi translation table
Not sure which approach is better
luaui/rml_setup.lua
Outdated
RmlUi.AddTranslationString("ui.awards.enemiesDestroyed", Spring.I18N('ui.awards.enemiesDestroyed')) | ||
RmlUi.AddTranslationString("ui.awards.resourcesDestroyed", Spring.I18N('ui.awards.enemiesDestroyed')) | ||
RmlUi.AddTranslationString("ui.awards.resourcesEfficiency", Spring.I18N('ui.awards.resourcesEfficiency')) | ||
RmlUi.AddTranslationString("ui.awards.traitor", Spring.I18N('ui.awards.traitor')) | ||
RmlUi.AddTranslationString("ui.awards.didEverything", Spring.I18N('ui.awards.didEverything')) | ||
|
||
RmlUi.AddTranslationString("ui.awards.ecoAward", Spring.I18N('ui.awards.ecoAward')) | ||
RmlUi.AddTranslationString("ui.awards.damageReceivedAward", Spring.I18N('ui.awards.damageReceivedAward')) | ||
RmlUi.AddTranslationString("ui.awards.commanderSleepAward", Spring.I18N('ui.awards.commanderSleepAward')) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are specific a single widget, they should not be in the general rmlui setup code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From one side - agree. From another - i would say widget is not the right place to work with translations. I think separate module need to work with translations for RmlUi including handling of changing language
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This question is being handled in #4387
luaui/Widgets/gui_awards.lua
Outdated
offset = offset + offsetAdd | ||
local function calculateAwardScore(award, score) | ||
if award == "commanderSleepAward" then | ||
return math.round(score / 60) .. " minutes" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs to support translation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is a tricky one tbh. Translations can be there using I18N. But let's take few examples of time-translations. English-Ukrainian:
a) 21 minute - "21 хвилина"
b) 22 minutes - "22 хвилини"
c) 23 minutes - "23 хвилини"
d) 25 minutes - "25 хвилин"
The point is that time cannot be translated 1:1 into every language as every language may have unique ending or suffix or similar. Thus separated module needs to handle translations of time. On the other hand - even if time will be slightly incorrect, maybe not a big deal as mainly it should show statistics and doesn't mean translation should be accurate in all and every place. What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The I18N library we use has pluralization support, we just haven't used it yet.
https://github.com/gajop/i18n?tab=readme-ov-file#pluralization
Any string we display on the UI needs to support translation.
ea55b6a
to
0cf44c2
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The folder structure has now been settled on, please rearrange as follows:
\luaui
\RmlWidgets
\gui_awards
gui_awards.lua
gui_awards.rcss
gui_awards.rml
You will have to create the RmlWidgets
folder, since this will be the first rml widget added to the repo.
Already done :) |
648271d
to
3543789
Compare
…s to new awards widget from legacy awards widget
24b20d7
to
e710a8d
Compare
Work done
Test steps
Screenshots:
BEFORE:
AFTER:
NOTE: On Second screen position of buttons is corrected