dral3x / StringsLint

๐Ÿ“ฑEnsure your localized strings are complete and never unused ๐Ÿ‘
MIT License
68 stars 10 forks source link

support specifying a custom regex #33

Closed jalalawqati closed 8 months ago

jalalawqati commented 8 months ago

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 commented 8 months ago

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 commented 8 months ago

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

jalalawqati commented 8 months ago

@dral3x Thanks for the quick review and for the release ๐Ÿ‘