Search code examples
jsonangularjsgruntjsgettextgrunt-angular-gettext

angular-gettext library- fails to compile JSON files?


I am using grunt-angular-gettext.

I am trying to compile PO files present in PO folder and output the JSON files in different folder. The folder and JSON files are not getting generated. Below is the grunt config for compile:

nggettext_compile: {
            all: {
                options: {
                    format: "json"
                },
                files: [
                    {
                        expand: true,
                        cwd:"../",
                        src: ["po/*.po"],
                        dest: '../lang/',
                        ext: ".json"
                    }
                ]
            },
        },

Can anyone help me with configuration to generate JSON file in "lang" folder. "lang" folder is at the same level as "po" folder. How would i specify relative path for destination folder?

Thanks.


Solution

  • try

    nggettext_compile: {
                all: {
                    options: {
                        format: "json"
                    },
                    files: [
                        {
                            expand: true,
                            cwd:"[po-loc]",
                            src: ["*.po"],
                            dest: '[dest-loc]',
                            ext: ".json"
                        }
                    ]
                },
            },
    

    Change [po-loc] to where the po's are located
    And change [dest-loc] to where you want to have the JSON files located use full paths so no ../