Skip to content
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

support specifying a custom regex #33

Merged
merged 1 commit into from
Feb 19, 2024
Merged

Conversation

jalalawqati
Copy link
Contributor

I have a convenient extension around NSLocalizedString:

var localized: String {
   NSLocalizedString(self, comment: "")
}

To make SwiftParser recognize this pattern I need to pass it a custom regex. This branch does exactly that. The configuration yml .stringslint.yml could then have:

swift_parser:
  regex:
    pattern: "\"([^\"]+)\".localized"
    match_index: 1

The match index indicates which index of the regex matches represents the localization key.

Please let me know if this is something you'd like to merge, otherwise I can move this to my fork. Thanks for the nice tool!

@dral3x
Copy link
Owner

dral3x commented Feb 19, 2024

Hi @jalalawqati, thank you very much for integrating this feature on stringslint!
I'm surely interested in having these changes merged.
Let me check the PR content 🚀

@dral3x dral3x self-requested a review February 19, 2024 09:44
Copy link
Owner

@dral3x dral3x left a comment

Choose a reason for hiding this comment

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

This is a very good work! Thank you @jalalawqati 👍

@dral3x dral3x merged commit a2928cc into dral3x:master Feb 19, 2024
@dral3x
Copy link
Owner

dral3x commented Feb 19, 2024

@jalalawqati stringslint 0.1.6 is out now. Thanks for your contribution!
https://github.com/dral3x/StringsLint/releases/tag/0.1.6

@jalalawqati
Copy link
Contributor Author

@dral3x Thanks for the quick review and for the release 👍

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.

2 participants