Use class translation in construction and group construction by group id instead of description #44566
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
SUMMARY: I18N "Use class translation in construction and group construction by group id instead of description"
Purpose of change
Use
class translation
inconstruction
for translation correctness and text style check. Replace grouping by descriptions with grouping by dedicated group ids.Describe the solution
construction::pre_note
totranslation
and update related code.3.1 Construction descriptions are converted to ids by replacing consecutive or single non-alphabet/digit characters with a underscore, and then stripping any starting and ending underscores. The code also checks that a converted id always points to the exact same description, to avoid having conflicting ids from different descriptions (no such case is reported though).
3.2 The ids are written back to construction objects, while the ids and the corresponding descriptions are written to the mod dir as construction group objects. The descriptions are stripped of ending period for consistency.
3.3 Manually remove a repeated construction group (
cut_grass
) from CRT_EXPANSION (the script does not do this because it does not take mod dependency into account)Testing
Ran the unit test and no text style error was reported.
Tested in game and construction descriptions/pre notes were correctly translated and displayed.
Ran the string extraction script and the strings were correctly extracted.
Additional context
python code used to update construction json files