Skip to content

Extract the i18n block in single file components and put them in in a bigger json translation (vuejs)

Notifications You must be signed in to change notification settings

tartinesKiller/SFC-i18n-extractor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

SFC-i18n-extractor

Simple Python script to extract i18n blocks from vuejs's single file component, in order to put them all in a single json.

Usage

python3 main.py path/to/src/folder > path/to/translations.json

Example

If both Hello.vue and Cheese.vue contains translations blocks like so:

...
</template>
<i18n>
{
    "en": {
        "hello": "Hello!"
    },
    "fr": {
        "hello": "Bonjour !"
    }
}
</i18n>
<script>
...

It will be converted like that:

{
    "en": {
        "Hello.vue": {
            "hello": "Hello!"
        },
        "Cheese.vue": {
            ...
        }        
    },
    "fr": {
        "Hello.vue": {
            "hello": "Bonjour !"
        },
        "Cheese.vue": {
            ...
        }        
    }
}

About

Extract the i18n block in single file components and put them in in a bigger json translation (vuejs)

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages