-
Notifications
You must be signed in to change notification settings - Fork 161
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
SCPUI Options Localization #5622
SCPUI Options Localization #5622
Conversation
For completeness sake, and safekeeping, here's a list of all the built-in XSTRs this adds. |
}; | ||
|
||
static void lcl_delayed_xstr_internal(tl::optional<xstr_delayed_order> to_init) { | ||
static SCP_vector<xstr_delayed_order> delayed_init; |
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.
Just as a point of clarification before anyone asks:
delayed_init
is very explicitly a static function variable as making it a global variable runs into issues of the order in which static globals are initialized, and it not being guaranteed to be initialized before the (also static global) option variables need to request a delayed XSTR. As a static function variable however, it is always guaranteed to be initialized by the time this function is called.
Yes, it does require this weird calling convention of fill the optional to add a value, keep it empty to fulfill the delayed XSTRs, but since this is an exclusively hidden part of the API, with any user just seeing the lcl_delayed_xstr
function, it should be fine.
Not sure why but there is suddenly a merge conflict. |
# Conflicts: # code/camera/camera.cpp
Resolved |
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.
Ok, now we're good.
Adds localization support to the SCPUI options builders. Because these are constructed before the localization system is initialized this includes a new method Lafiel and I came up with to set strings to XSTRs but delay their processing until localization has been initialized. I searched the code and the last built-in xstr I could find was 1673. But to be sure I started these at 1700. I know at least BtA uses 1674+ a few for Custom Controls. Since #5210 mapified the built-in strings, it's not essential that they be sequential anyway. Where possible I used existing options xstr IDs from the retail strings.tbl.
Additionally this cleans up all the options builders throughout the files to have consistent whitespace for readability.