Skip to content
This repository has been archived by the owner on Jul 16, 2020. It is now read-only.

'Excludes' doesn't work for directories. #87

Open
aezur opened this issue Jun 25, 2019 · 8 comments
Open

'Excludes' doesn't work for directories. #87

aezur opened this issue Jun 25, 2019 · 8 comments

Comments

@aezur
Copy link

aezur commented Jun 25, 2019

Assuming a directory structure of:

- lang
    - en
        - file_name_1.php
        - directory_name
            - file_name_2.php

And in the config file:

'excludes' => [
        'file_name_1',    /* Works */
        "directory_name",    /* Doesn't work */
    ],

When art vue-i18n:generate is run, then everything inside directory_name will be included in the output file.

Placing directory_name/file_name_2' into the excludes` array is a workaround, but it doesn't suit my use case.

@martinlindhe
Copy link
Owner

See #81

@aezur
Copy link
Author

aezur commented Jul 8, 2019

Thanks for the reply, but it doesn't address my issue. I have defined my root folder. The comment of the excludes array states you can add directories to the array to exclude them. You cannot. This feature does not work.
EDIT: The desired behaviour is that when the path to a directory is added to the excludes array, that directory and the files it contains are excluded from the output of art vue-i18n:generate.

@martinlindhe martinlindhe reopened this Jul 8, 2019
@martinlindhe
Copy link
Owner

martinlindhe commented Jul 8, 2019

Alright, thanks for letting me know

@octfx
Copy link

octfx commented Jul 10, 2019

Looking at the source code (https://github.com/martinlindhe/laravel-vue-i18n-generator/blob/master/src/Generator.php#L56) the generator will only compare filenames ignoring the folder path.
So if you wanted to exclude file_name_2.php you could just add file_name_2 to your excludes array as a workaround.

@martinlindhe
Copy link
Owner

I'm not working on this code atm, but you are very welcome to submit a PR to fix this.

@karolispx
Copy link

Hi @martinlindhe , do you have any guidelines for PRs?

@martinlindhe
Copy link
Owner

@karolispx nothing special, just open a PR and we take it from there!

@karolispx
Copy link

I took a quick look at this and the code at https://github.com/martinlindhe/laravel-vue-i18n-generator/blob/master/src/Generator.php#L56 is used to exclude directories inside 'resources/lang/' directory, i.e. if you had a few languages: en, ko, ru - you could exclude the whole language directory by adding the folder name to 'excludes' at https://github.com/martinlindhe/laravel-vue-i18n-generator/blob/master/src/config/vue-i18n-generator.php#L41, i.e. 'excludes' => ['ko'],

The actual problem is not being able to exclude directory from a language folder, i.e. excluding directory '/resources/lang/en/custom' does not work.

This function https://github.com/martinlindhe/laravel-vue-i18n-generator/blob/master/src/Generator.php#L259 handles file exclusion so I think appropriatefunction needs to be written for excluding directories and called here https://github.com/martinlindhe/laravel-vue-i18n-generator/blob/master/src/Generator.php#L215

Will take a closer look when I have some time.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants