Skip to content

Conversation

WebCimes
Copy link

@WebCimes WebCimes commented May 5, 2025

Why am I submitting this PR

This PR introduces a PhpLexer to support extraction of translation keys from both Laravel Blade templates and standard PHP files.
It handles common translation function calls such as t('...'), __('...'), @lang('...'), and trans('...').
The lexer supports escaped quotes, avoids concatenated strings, and correctly processes nested translation functions.
All features are covered by unit tests to ensure compatibility with typical PHP usages.

Does it fix an existing ticket?

No

WebCimes added 2 commits May 5, 2025 09:48
- Implement tests for extracting single and multiple keys from translation functions.
- Support for custom function names in extraction.
- Handle extraction when additional parameters are present.
- Test extraction from nested functions.
- Validate extraction of keys with special syntax (%key and :key).
- Ensure correct handling of escaped characters in strings.
- Confirm that no exceptions are thrown on invalid PHP input.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant