laravel-langman-gui icon indicating copy to clipboard operation
laravel-langman-gui copied to clipboard

Filter the space around arguement in __() function

Open almas-x opened this issue 7 years ago • 0 comments

https://github.com/themsaid/laravel-langman-gui/blob/master/src/Manager.php#L151-L163

$pattern =
            // See https://regex101.com/r/jS5fX0/5
            '[^\w]'. // Must not start with any alphanum or _
            '(?<!->)'. // Must not start with ->
            '('.implode('|', $functions).')'.// Must start with one of the functions
            "\(".// Match opening parentheses
            "[\'\"]".// Match " or '
            '('.// Start a new group to match:
            '.+'.// Must start with group
            ')'.// Close group
            "[\'\"]".// Closing quote
            "[\),]"  // Close parentheses or new parameter
        ;

If there has space around the arguments in translate function,this pattern con not match . like: __( 'langman' ).

$pattern =
            // See https://regex101.com/r/jS5fX0/5
            '[^\w]'. // Must not start with any alphanum or _
            '(?<!->)'. // Must not start with ->
            '('.implode('|', $functions).')'.// Must start with one of the functions
            "\(".// Match opening parentheses
            "\s".
            "[\'\"]".// Match " or '
            '('.// Start a new group to match:
            '.+'.// Must start with group
            ')'.// Close group
            "[\'\"]".// Closing quote
            "\s".
            "[\),]"  // Close parentheses or new parameter
        ;

almas-x avatar Jan 25 '18 08:01 almas-x