Codechange: remove unused strings #9516
Merged
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.
Motivation / Problem
I assumed we had strings that were no longer used in our language files, as it is pretty easy to miss this. We do not validate if strings are used.
After trying to write some scripting to figure out if this is the case, I ended up figuring out how poorly we name our strings, and the weird hacks we have to reference a string.
For example, the setting-flag "zero-is-special" uses the next string after the "value" string. In other words, this special string is not referenced directly, but you have to calculate that based on another.
And it is not always in the forward direction. You can say you want to draw a "tiny" variant of a string, which is "- 1" from the original string.
After fiddling a while with a script I wrote, I finally managed to get through all the strings, and detect which are unused. Another PR will upstream that script, so we can link it to the CI, but for now, first a bit of cleanup.
Description
Removing string is tricky, as it is hard to tell if they really aren't used. So I have been doing some digging, but please confirm my findings:
STR_GAME_OPTIONS_REFRESH_RATE_OTHER
: introduced in 0464a50, but no reference to the string is being made.STR_CONFIG_SETTING_DISABLE_UNSUITABLE_BUILDING
: removed in 188bf0f.STR_NETWORK_SERVER_LIST_LANGUAGE
: removed in 05612d6.STR_NETWORK_START_SERVER_LANGUAGE_SPOKEN
and friend: removed in 05612d6.STR_NETWORK_SERVER
andSTR_NETWORK_CLIENT
: removed in 5266359.STR_NETWORK_ERROR_NNN
: no specific commits, but none of those are referenced indirectly from what I can tell, so it is fairly safe to assume they got removed "over time".STR_CONTENT_ERROR_COULD_NOT_DOWNLOAD_CONNECTION_LOST
: removed in eeb38a8.STR_FRAMERATE_BYTES_WARN
and friend: seems to be added to complete the list, but actually never used (see e7f6f07).STR_NEWGRF_SETTINGS_PRESET_SAVE_QUERY
: replaced with another window, never removed (see 8755c26).STR_STATION_VIEW_EN_ROUTE_FROM
: removed in 0fc198c.STR_VEHICLE_NAME_BUTTON
: removed in 589feba.STR_ERROR_INCOMPATIBLE_TRAMWAY
: introduced in c02ef3e, but no reference to the string is being made.Limitations
Checklist for review
Some things are not automated, and forgotten often. This list is a reminder for the reviewers.