Skip to content

Extract (transient) text notifications#20725

Merged
PunkPun merged 5 commits into
OpenRA:bleedfrom
Mailaender:transient-l10n
Aug 19, 2023
Merged

Extract (transient) text notifications#20725
PunkPun merged 5 commits into
OpenRA:bleedfrom
Mailaender:transient-l10n

Conversation

@Mailaender
Copy link
Copy Markdown
Member

This prepares #19872 for localization including some hard-coded but mostly trait defined strings.

@Mailaender Mailaender mentioned this pull request Mar 4, 2023
16 tasks
Comment thread OpenRA.Mods.Common/Lint/CheckTranslationReference.cs
Comment thread mods/cnc/languages/rules/en.ftl Outdated
@Mailaender Mailaender force-pushed the transient-l10n branch 2 times, most recently from 2c9a72f to 1a28c7f Compare March 5, 2023 10:04
Copy link
Copy Markdown
Member

@PunkPun PunkPun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm thinking it would be much cleaner to just translate inside AddTransientLine and AddFeedbackLine. We should try to embed translation support wherever possible.

As for AddSystemLine, there's still a bunch of untranslated strings for it and it is accessible via lua unlike the aforementioned ones

@Mailaender
Copy link
Copy Markdown
Member Author

Mailaender commented Mar 5, 2023

I tried that at first, but those are static methods that need a lot of context for translation like Map, ModData and the translation arguments also which line to use for empty vs. not, so I quickly abandoned that.

@pchote
Copy link
Copy Markdown
Member

pchote commented Mar 5, 2023

See discussion in #20387 (comment). This is currently continuing the trend of unwanted duplication 😞

@Mailaender
Copy link
Copy Markdown
Member Author

I agree. If you have a suggestion to make this easily feasible, then I am all ears.

@PunkPun
Copy link
Copy Markdown
Member

PunkPun commented Mar 8, 2023

I tried that at first, but those are static methods that need a lot of context for translation like Map, ModData and the translation arguments also which line to use for empty vs. not, so I quickly abandoned that.

Perhaps it's wrong for Map to contain the Translate method. The choice of wether to translate from map Translations or engine Translations should NOT be done on a case by case basis. This is just asking for trouble.

@PunkPun
Copy link
Copy Markdown
Member

PunkPun commented Mar 11, 2023

Hmm, though that would allow maps to overwrite UI translations. It may be something we want, or may be something we want to avoid.

I tried that at first, but those are static methods that need a lot of context for translation like Map, ModData and the translation arguments also which line to use for empty vs. not, so I quickly abandoned that.

Incase we want these separate, then these static methods can be split. One instance would take Map as an argument and another ModData

@pchote
Copy link
Copy Markdown
Member

pchote commented Mar 11, 2023

Perhaps it's wrong for Map to contain the Translate method. The choice of wether to translate from map Translations or engine Translations should NOT be done on a case by case basis. This is just asking for trouble.

Maps can define new actors / lobby options / other things that use strings that aren't defined in the base mod. They may also adjust balance in ways that need to be reflected in e.g. sidebar tooltips. IMO there is no choice here: Maps do need to be able to override translations.

@Mailaender
Copy link
Copy Markdown
Member Author

We have mod hard-coded and map defined (like these trait notifications). The new API is now less flexible and does not allow mixing them. I still fail to see the benefit so I kept it a separate commit we can easily revert later.

@pchote
Copy link
Copy Markdown
Member

pchote commented Mar 11, 2023

Where is this new API described and why is it less flexible?

Comment thread OpenRA.Mods.Common/Widgets/Logic/Ingame/Hotkeys/SelectAllUnitsHotkeyLogic.cs Outdated
Comment thread OpenRA.Mods.Common/Widgets/Logic/Ingame/Hotkeys/SelectUnitsByTypeHotkeyLogic.cs Outdated
@PunkPun
Copy link
Copy Markdown
Member

PunkPun commented Mar 11, 2023

Maps can define new actors / lobby options / other things that use strings that aren't defined in the base mod. They may also adjust balance in ways that need to be reflected in e.g. sidebar tooltips. IMO there is no choice here: Maps do need to be able to override translations.

This is a misunderstanding. The question is about, should only some translations be overwritable, or all?

@pchote
Copy link
Copy Markdown
Member

pchote commented Mar 11, 2023

I agree. If you have a suggestion to make this easily feasible, then I am all ears.

https://github.com/OpenRA/OpenRA/blob/bleed/OpenRA.Game/ModData.cs#L134-L144 Is where we pass map and mod state to the rest of the static objects. Do the same here.

@pchote
Copy link
Copy Markdown
Member

pchote commented Mar 11, 2023

Maps can define new actors / lobby options / other things that use strings that aren't defined in the base mod. They may also adjust balance in ways that need to be reflected in e.g. sidebar tooltips. IMO there is no choice here: Maps do need to be able to override translations.

This is a misunderstanding. The question is about, should only some translations be overwritable, or all?

All.

Comment thread OpenRA.Game/Network/UnitOrders.cs Outdated
Copy link
Copy Markdown
Member

@PunkPun PunkPun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, will just need the last commit squashed.

As for some of the structure inconsistencies, it will be easier to solve them in the followup PR which localises rest of system lines. We will also have to decide how we want to handle lua notifications

Comment thread OpenRA.Game/Network/LocalizedMessage.cs Outdated
Comment thread OpenRA.Game/Translation.cs
@PunkPun
Copy link
Copy Markdown
Member

PunkPun commented Apr 25, 2023

Needs a rebase

@penev92
Copy link
Copy Markdown
Member

penev92 commented May 16, 2023

What is the idea behind the optional flag on the TranslationReference attribute?

@PunkPun
Copy link
Copy Markdown
Member

PunkPun commented May 16, 2023

In runtime there are null checks to prevent some logic from executing, but the linter is unaware of such checks. I suppose this flag is the method of conveying the info to the linter.

@penev92
Copy link
Copy Markdown
Member

penev92 commented May 16, 2023

So basically the same as FieldLoader.Require, but for use by the translation linting?

Copy link
Copy Markdown
Member

@PunkPun PunkPun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@PunkPun PunkPun merged commit c609c4a into OpenRA:bleed Aug 19, 2023
@PunkPun
Copy link
Copy Markdown
Member

PunkPun commented Aug 19, 2023

Changelog

@Mailaender Mailaender deleted the transient-l10n branch August 19, 2023 19:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants