Add Firefox-inspired Fluent localization foundations - #6
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a5d14b1b62
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| func transformText(input string, strategy Strategy) string { | ||
| if strategy == Bidi { | ||
| return reverseRunes(mapRunes(input, bidiRune)) |
There was a problem hiding this comment.
Preserve Fluent layout while reversing bidi text
When pseudo --strategy bidi processes a Fluent selector branch without an intervening protected token, the string passed here includes the newline and indentation before the next variant header. Reversing the entire segment moves that newline before the branch text and leaves the following *[other] header concatenated onto the text line; Generate then serializes the value without reparsing the result and writes an invalid .ftl artifact. Reverse only linguistic runs, not Fluent layout whitespace.
Useful? React with 👍 / 👎.
| parent, equals, ok := parseFluentMessageHeader(lines[index].content) | ||
| if !ok { | ||
| index++ | ||
| continue |
There was a problem hiding this comment.
Reject unrecognized Fluent source lines
Any top-level line that is neither a recognized message header nor diagnosed elsewhere is silently skipped here. Consequently, malformed Fluent such as bad id = Save is accepted with that source unit omitted; translation and validation can report success and preserve the junk in generated files instead of identifying an invalid resource. Blank lines and comment forms should be skipped explicitly, while other unrecognized lines should produce a parse error.
Useful? React with 👍 / 👎.
| targetPath, err := bundle.TargetPath(locale) | ||
| if err != nil { | ||
| return nil, err | ||
| } | ||
| if existing, readErr := os.ReadFile(targetPath); readErr == nil { | ||
| if !opts.Force && !pseudoOwnsArtifact(manifest, bundle.ID, canonicalLocale, format, existing) { |
There was a problem hiding this comment.
Prevent pseudolocales from targeting the source file
Because the pseudo locale is arbitrary and is not rechecked against bundle source paths, a typical template such as locales/{locale}.json resolves pseudo --locale en --force to the locales/en.json source itself. The subsequent atomic write replaces the source catalog with pseudolocalized text and records it as pseudo provenance; ValidateProject does not catch this because it only checks configured target locales. Reject a resolved pseudo target equal to the bundle source even when --force is supplied.
Useful? React with 👍 / 👎.
…undation # Conflicts: # README.md # docs/localization-core-v2.md # internal/state/manifest.go # internal/translate/translate.go # internal/translate/translate_test.go # internal/validate/protected.go # internal/validate/validate.go
Summary
main0.1.2for the post-merge CLI releaseVerification
go build ./...go test ./... -race -covermode=atomic -coverprofile=coverage.outgo vet ./...golangci-lint rungo test ./test/acceptance -count=1