locale.rs: move more code outside of the unsafe block#9720
Merged
sylvestre merged 1 commit intouutils:mainfrom Dec 19, 2025
Merged
locale.rs: move more code outside of the unsafe block#9720sylvestre merged 1 commit intouutils:mainfrom
sylvestre merged 1 commit intouutils:mainfrom
Conversation
and refactor a few things
ac19636 to
17755d0
Compare
Collaborator
|
How would you feel if using the icu_datetime crate we were able to get the 12 or 24 hour status from that instead? I am proposing to add it as part of #9722 and it has the unsafe methods for getting that information |
ChrisDryden
reviewed
Dec 19, 2025
| fn detect_12_hour_format() -> bool { | ||
| // Helper function to check for 12-hour format indicators | ||
| fn has_12_hour_indicators(format_str: &str) -> bool { | ||
| const INDICATORS: &[&str] = &["%I", "%l", "%r"]; |
Collaborator
There was a problem hiding this comment.
let d_t_fmt = get_locale_info(nix::libc::D_T_FMT);
let t_fmt_opt = get_locale_info(nix::libc::T_FMT);
let t_fmt_ampm_opt = get_locale_info(nix::libc::T_FMT_AMPM);
Should we use the same notation here instead of the direct strings? Whats the reason for using the D_T_FMT notation below? Is there a possible difference on different platforms?
Contributor
Author
There was a problem hiding this comment.
i used the previous notation :)
Contributor
Author
|
unbreak the ci |
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.
No description provided.