F2592 locale date time#2677
Open
shewitt-au wants to merge 76 commits into
Open
Conversation
…u/SteveImHex into F2592-Locale-date-time
Non-Wondows builds now broken
I'm still thinking if it's possible
Contributor
Author
|
I have added locale filtering as I had started but not finished it. The locale drop down is now filtered to only show locales with the selected language. I do not plan on spending any more time on this. Seems pointless given the total lack of feedback. Anyway, here's a (somewhat clumsy) demonstration: ldtf.mp4 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Problem description
Dates and times currently have a fixed format and do not respect the selected language. MinGW’s (Windows)
std::localeclass is broken and basically useless. This PR implements, along with the libwolv PR linked below, date and time formatting using the Win32 API on Windows and the C runtime library on other OSes.The motivating feature request can be found here:
Format time based on locale #2592
The corresponding libwolv changes can be found here:
libwolv
The corresponding PatternLanguage changes can be found here:
PatternLanguage
The corresponding ImHex-Patterns changes:
ImHex-Patterns
Implementation description
For the most part, ImHex has been changed to use a new function in libwolv for date and time formatting. A notification was also added to update the Data Inspector when the language is changed. Some changes were made to fix issues in the existing code that make sense even without the broader changes:
time_twas being treated as unsigned, but it should be signed.time_t"Invalid" was displayed. Notime_tis invalid. The issue is with our ability to format it. I have changed the message to "Can't format" for now.Linux
On Linux only dates and times for which a locale is installed (
sudo locale-gen) will be formatted correctly.