Replace culture sensitive string operations with invariant or ordinal#765
Merged
ManlyMarco merged 2 commits intomasterfrom Sep 27, 2025
Merged
Replace culture sensitive string operations with invariant or ordinal#765ManlyMarco merged 2 commits intomasterfrom
ManlyMarco merged 2 commits intomasterfrom
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR replaces culture-sensitive string operations with culture-invariant or ordinal comparisons to prevent issues in non-English locales where characters like "." might behave differently.
- Updates
IndexOf,LastIndexOf, andComparestring methods to use explicitStringComparisonparameters - Replaces
double.TryParseandToStringcalls to useCultureInfo.InvariantCulture - Changes some string-based searches to character-based searches for better performance
Reviewed Changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| StringExtensions.cs | Updated GetBetween method to use InvariantCulture for string searches |
| UnityTypes.cs | Changed dot search from string to character for better performance |
| ConnectionTrackingWebClient.cs | Added culture-invariant string comparison for content-type header |
| TemplatingHelper.cs | Updated string replacement logic to use InvariantCulture |
| TranslationFileLoadingContext.cs | Fixed comment parsing and added ordinal comparison |
| TextureTranslationCache.cs | Changed bracket searches from string to character |
| SimpleJson.cs (multiple files) | Updated number parsing and formatting to use invariant culture |
| WWW.cs | Added ordinal comparison for HTTP header parsing |
| PapagoTranslateEndpoint.cs | Updated timestamp formatting to use invariant culture |
| Multiple translator files | Updated HTML parsing to use ordinal comparisons and character searches |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
src/XUnity.AutoTranslator.Plugin.Core/TranslationFileLoadingContext.cs
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Pull Request Overview
Copilot reviewed 14 out of 14 changed files in this pull request and generated no new comments.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
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.
This should have no functional difference under ja-JP and en-US cultures, but may fix some issues under other cultures that do weird things with
.and such.