-
Notifications
You must be signed in to change notification settings - Fork 663
feat(cli): add pseudo-localization mode #1629
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
feat(cli): add pseudo-localization mode #1629
Conversation
|
@sumitsaurabh927 @The-Best-Codes can you please review the PR? |
The-Best-Codes
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
pseudo-localization-docs/PSEUDO_LOCALIZATION_COMPLETE_SUMMARY.md
Outdated
Show resolved
Hide resolved
|
@The-Best-Codes I will keep that in mind next time, by the way thank you for the review! |
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