Skip to content

fix(project): keep escaped quotes in .strings files - #265

Merged
robingenz merged 1 commit into
mainfrom
fix/263-strings-escaped-quotes
Oct 20, 2026
Merged

robingenz merged 1 commit into
mainfrom
fix/263-strings-escaped-quotes

Conversation

@robingenz

Copy link
Copy Markdown
Collaborator

Summary

The .strings parser ended a key or value at any ", including an escaped \". A file like this failed to load with Error parsing .strings file: unknown character, so every ios.strings operation on it failed:

"NSCameraUsageDescription" = "Allow \"App\" to use the camera";

It also treated /* and */ inside a quoted string as comment markers.

Changes

  • The parser now handles quoted strings in one place. Inside a key or value, only an unescaped " ends the string. A \ and the character after it are kept verbatim, and /*, */ are plain text.
  • Escape sequences stay as they are in the file, so the file round-trips unchanged and the generator needs no changes.
  • New fixture strings-escaped.strings with escaped quotes in a key and a value, plus comment markers in a value.
  • Tests load the fixture through StringsFile, check the parsed entries, regenerate the file unchanged, and set a key next to escaped values.

Closes #263
Supersedes #264

Copilot AI balanced review requested due to automatic review settings October 20, 2026 10:47
@robingenz robingenz added the bug Something isn't working label Oct 20, 2026
@robingenz robingenz self-assigned this Oct 20, 2026
@vercel

vercel Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
trapeze Ready Ready Preview Oct 20, 2026 10:47am UTC

Request Review

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The focused parser fix addresses the reported failures with regression coverage and no unresolved findings.

No open issues 🎉

What changed in this PR

Fixes .strings parsing so iOS string operations can handle escaped quotes and comment markers inside quoted keys and values, addressing #263.

Changes:

  • Centralizes quoted-string parsing while preserving escape sequences verbatim.
  • Adds a fixture and regression tests for parsing, unchanged regeneration, and setting adjacent keys.
File Description
packages/​project/​test/​strings-file.test.ts Tests parsing, regeneration, and updates around escaped strings.
packages/​project/​src/​util/​strings.ts Handles escapes and treats quoted comment markers as text.
packages/​common/​test/​fixtures/​strings-escaped.strings Provides escaped quotes and embedded comment markers for regression tests.

Review effort: Balanced

@robingenz
robingenz merged commit 7573c07 into main Oct 20, 2026
7 checks passed
@robingenz
robingenz deleted the fix/263-strings-escaped-quotes branch October 20, 2026 10:49
@github-actions github-actions Bot mentioned this pull request Oct 20, 2026

This branch was successfully deployed

1 active deployment
Preview — db4d0a98 Deployed Oct 20, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ios.strings fails on .strings files that contain escaped quotes

2 participants