Skip to content

Conversation

@shiqizhenyes
Copy link
Contributor

1、用 String(localized:) 代替 localizedInfoDictionary
2、使用 guard 语句提高 infoDictionary 访问的安全性
3、新增CFBundleDisplayName中文和英文对应文案

…d:) for localization

- Replaced `localizedInfoDictionary?[key.rawValue] as? String ?? "⚠️"` with `String(localized: String.LocalizationValue(key.rawValue))` to leverage modern localization API.
- This change improves code readability and ensures consistent behavior when fetching localized strings.
- Fallback to "⚠️" is no longer needed as `String(localized:)` returns the key itself if no localized value is found.
- Replaced direct optional chaining `infoDictionary?[key.rawValue] as? String ?? "⚠️"` with a guard statement to safely unwrap `infoDictionary`.
- This change ensures early return with fallback value "⚠️" if `infoDictionary` is nil, improving code safety and readability.
- Maintained the same fallback behavior for missing keys by returning "⚠️" if the key is not found or the value is not a String.
@XinshaoAir XinshaoAir merged commit 5a5a91c into Cement-Labs:main Feb 16, 2025
1 check failed
KrLite added a commit that referenced this pull request Jun 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants