feat(cli): add pseudo-localization mode#1629
feat(cli): add pseudo-localization mode#1629maxprilutskiy merged 12 commits intolingodotdev:mainfrom
Conversation
|
@sumitsaurabh927 @The-Best-Codes can you please review the PR? |
The-Best-Codes
left a comment
There was a problem hiding this comment.
Lots of files could be removed, I've listed some with reasons why in my review. I'll also review the logic changes when I get a chance.
|
@The-Best-Codes I will keep that in mind next time, by the way thank you for the review! |
|
@sumitsaurabh927 can you review it? |
|
@ashutoshdebug please add change set |
Done |
|
Hey @ashutoshdebug! Just checking in - are you still working on this PR? We noticed there are some comments that may need addressing. If you need more time, no problem! Just let us know. If we don't hear back within a week, we'll close this to keep the repo tidy, but you can always reopen when ready. |
Waiting for reviews! |
|
@ashutoshdebug looking good! Please enable commit signature in your account, and re-push the commits so they're signed - otherwise GitHub won't let us merge the PR due to the security settings. Thank you! https://docs.github.com/en/authentication/managing-commit-signature-verification/signing-commits |
Head branch was pushed to by a user without write access
200a9cb to
2a2986f
Compare
2a2986f to
12cec29
Compare
|
@maxprilutskiy I have re-pushed the commits with signatures, can you please verify it! Thankyou! |
* feat(cli): add pseudo-localization mode * docs(cli): correct path references in README * docs(cli): remove unwanted files * fix: add changeset --------- Co-authored-by: Veronica Prilutskaya <veronica@lingo.dev> Co-authored-by: Max Prilutskiy <5614659+maxprilutskiy@users.noreply.github.com>
Summary
Adds Pseudo-Localization Mode (
--pseudoflag) to Lingo.dev CLI that automatically pseudo-translates all extracted strings with accented characters and visual markers without calling any external API, enabling developers to test UI internationalization readiness instantly.Changes
packages/cli/src/utils/pseudo-localize.ts): Core pseudo-localization engine with character mapping and recursive object/array handlingpackages/cli/src/cli/cmd/run/index.ts): Added--pseudooption to theruncommandpackages/cli/src/cli/localizer/pseudo.ts): ImplementsILocalizerinterface for seamless integration with existing translation pipelineILocalizerinterface andCmdRunFlagsschema to support pseudo modepackages/cli/src/cli/cmd/run/setup.ts): Updated provider selection and initialization logic to handle pseudo-localization modePSEUDO_LOCALIZATION_QUICK_START.md- Quick command referencePSEUDO_LOCALIZATION.md- Complete feature guidePSEUDO_LOCALIZATION_IMPLEMENTATION.md- Technical detailsPSEUDO_LOCALIZATION_COMPLETE_SUMMARY.md- Full overviewPSEUDO_LOCALIZATION_INDEX.md- Documentation hubpackages/cli/README.md): Added "🎭 Pseudo-Localization Mode" section with usage examplesTechnical Details
Character Mapping (en-XA style)
Replaces ASCII letters with visually similar accented versions:
Example Usage
Example Transformation
Testing
Unit Tests Added (16 tests, all passing ✅):
String Transformation Tests (10 tests)
Object/Array Transformation Tests (6 tests)
Test Execution
Test Command
Breaking Changes
None. This is a purely additive feature:
--pseudoCLI flag (doesn't affect existing behavior)ILocalizerinterface with union type (backward compatible)Compatibility
✅ Works with all existing CLI flags:
--target-locale- Filter by locale--bucket- Filter by bucket type--file- Filter by file pattern--key- Filter by key prefix--force- Force re-pseudo-translation--watch- Watch mode support--concurrency- Parallel processing control✅ Backward compatible:
Performance
Related Issues
This implements the feature requested in the "Pseudo-Localization Mode" proposal, addressing:
Checklist
Files Changed
New Files (3)
packages/cli/src/utils/pseudo-localize.ts(165 lines) - Core utilitypackages/cli/src/utils/pseudo-localize.spec.ts(123 lines) - Test suitepackages/cli/src/cli/localizer/pseudo.ts(31 lines) - Localizer implementationModified Files (6)
packages/cli/src/cli/cmd/run/_types.ts- Added pseudo flag to schemapackages/cli/src/cli/cmd/run/index.ts- Added --pseudo CLI optionpackages/cli/src/cli/localizer/_types.ts- Extended ILocalizer interfacepackages/cli/src/cli/localizer/index.ts- Updated factory functionpackages/cli/src/cli/cmd/run/setup.ts- Enhanced setup pipelinepackages/cli/README.md- Added feature documentationDocumentation Files (5)
packages/cli/PSEUDO_LOCALIZATION_QUICK_START.md- Quick referencepackages/cli/PSEUDO_LOCALIZATION.md- Complete guidePSEUDO_LOCALIZATION_IMPLEMENTATION.md- Technical detailsPSEUDO_LOCALIZATION_COMPLETE_SUMMARY.md- Full overviewPSEUDO_LOCALIZATION_INDEX.md- Documentation hubReview Focus Areas
PSEUDO_CHAR_MAPinpseudo-localize.tsfor correctnesspseudo.tsproperly implements the interfacepseudo-localize.spec.tsfor completenessDemo
To see the feature in action:
It closes #1435